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=Shift_JIS"));
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;
1258 char *attr_style = NULL;
1259 char *attr_clear = NULL;
1262 /*--------------------------------------------------------------------------*/
1263 /* Get Attributes */
1264 /*--------------------------------------------------------------------------*/
1265 for (attr = qs_get_attr(doc,node);
1267 attr = qs_get_next_attr(doc,attr)) {
1268 char *name = qs_get_attr_name(doc,attr);
1269 char *value = qs_get_attr_value(doc,attr);
1270 if (STRCASEEQ('c','C',"clear",name)) {
1271 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('a','A',"all",value))) {
1275 else if (STRCASEEQ('s','S',"style",name)) {
1276 attr_style = apr_pstrdup(doc->buf.pool, value);
1279 if (IS_CSS_ON(xhtml->entryp)) {
1280 css_prop_list_t *style = s_xhtml_1_0_push_and_get_now_style(pdoc, node, attr_style);
1282 css_property_t *clear_prop = chxj_css_get_property_value(doc, style, "clear");
1283 css_property_t *cur;
1284 for (cur = clear_prop->next; cur != clear_prop; cur = cur->next) {
1285 if (cur->value && *cur->value) {
1286 if ( STRCASEEQ('l','L',"left", cur->value)
1287 || STRCASEEQ('r','R',"right", cur->value)
1288 || STRCASEEQ('b','B',"both" ,cur->value)) {
1289 attr_clear = apr_pstrdup(doc->pool, cur->value);
1308 * It is a handler who processes the BR tag.
1310 * @param pdoc [i/o] The pointer to the XHTML structure at the output
1311 * destination is specified.
1312 * @param node [i] The BR tag node is specified.
1313 * @return The conversion result is returned.
1316 s_xhtml_1_0_end_br_tag(void *pdoc, Node *UNUSED(child))
1318 xhtml_t *xhtml = GET_XHTML(pdoc);
1325 * It is a handler who processes the TR tag.
1327 * @param pdoc [i/o] The pointer to the XHTML structure at the output
1328 * destination is specified.
1329 * @param node [i] The TR tag node is specified.
1330 * @return The conversion result is returned.
1333 s_xhtml_1_0_start_tr_tag(void *pdoc, Node *UNUSED(node))
1335 xhtml_t *xhtml = GET_XHTML(pdoc);
1336 Doc *doc = xhtml->doc;
1345 * It is a handler who processes the TR tag.
1347 * @param pdoc [i/o] The pointer to the XHTML structure at the output
1348 * destination is specified.
1349 * @param node [i] The TR tag node is specified.
1350 * @return The conversion result is returned.
1353 s_xhtml_1_0_end_tr_tag(void *pdoc, Node *UNUSED(child))
1355 xhtml_t *xhtml = GET_XHTML(pdoc);
1362 * It is a handler who processes the FONT tag.
1364 * @param pdoc [i/o] The pointer to the XHTML structure at the output
1365 * destination is specified.
1366 * @param node [i] The FONT tag node is specified.
1367 * @return The conversion result is returned.
1370 s_xhtml_1_0_start_font_tag(void *pdoc, Node *node)
1372 xhtml_t *xhtml = GET_XHTML(pdoc);
1373 Doc *doc = xhtml->doc;
1375 char *attr_color = NULL;
1376 char *attr_size = NULL;
1377 char *attr_style = NULL;
1379 /*--------------------------------------------------------------------------*/
1380 /* Get Attributes */
1381 /*--------------------------------------------------------------------------*/
1382 for (attr = qs_get_attr(doc,node);
1384 attr = qs_get_next_attr(doc,attr)) {
1385 char *name = qs_get_attr_name(doc,attr);
1386 char *value = qs_get_attr_value(doc,attr);
1387 if (STRCASEEQ('c','C',"color",name) && value && *value) {
1388 attr_color = apr_pstrdup(doc->buf.pool, value);
1390 else if (STRCASEEQ('s','S',"size",name) && value && *value) {
1391 /*----------------------------------------------------------------------*/
1393 /*----------------------------------------------------------------------*/
1394 attr_size = apr_pstrdup(doc->buf.pool, value);
1396 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
1397 attr_style = apr_pstrdup(doc->buf.pool, value);
1400 if (IS_CSS_ON(xhtml->entryp)) {
1401 css_prop_list_t *style = s_xhtml_1_0_push_and_get_now_style(pdoc, node, attr_style);
1403 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
1404 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
1405 css_property_t *cur;
1406 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
1407 if (cur->value && *cur->value) {
1408 attr_color = apr_pstrdup(doc->pool, cur->value);
1411 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
1412 if (cur->value && *cur->value) {
1413 attr_size = apr_pstrdup(doc->pool, cur->value);
1414 if (STRCASEEQ('x','X',"xx-small",attr_size)) {
1415 attr_size = apr_pstrdup(doc->pool, "1");
1417 else if (STRCASEEQ('x','X',"x-small",attr_size)) {
1418 attr_size = apr_pstrdup(doc->pool, "2");
1420 else if (STRCASEEQ('s','S',"small",attr_size)) {
1421 attr_size = apr_pstrdup(doc->pool, "3");
1423 else if (STRCASEEQ('m','M',"medium",attr_size)) {
1424 attr_size = apr_pstrdup(doc->pool, "4");
1426 else if (STRCASEEQ('l','L',"large",attr_size)) {
1427 attr_size = apr_pstrdup(doc->pool, "5");
1429 else if (STRCASEEQ('x','X',"x-large",attr_size)) {
1430 attr_size = apr_pstrdup(doc->pool, "6");
1432 else if (STRCASEEQ('x','X',"xx-large",attr_size)) {
1433 attr_size = apr_pstrdup(doc->pool, "7");
1440 xhtml_flags_t *flg = (xhtml_flags_t *)apr_palloc(doc->pool, sizeof(*flg));
1441 memset(flg, 0, sizeof(*flg));
1443 W_L("<font color=\"");
1446 flg->font_color_flag = 1;
1449 flg->font_size_flag = 1;
1450 switch(*attr_size) {
1451 case '1': W_L("<span style=\"font-size: xx-small\">"); break;
1452 case '2': W_L("<span style=\"font-size: x-small\">"); break;
1453 case '3': W_L("<span style=\"font-size: small\">"); break;
1454 case '4': W_L("<span style=\"font-size: medium\">"); break;
1455 case '5': W_L("<span style=\"font-size: large\">"); break;
1456 case '6': W_L("<span style=\"font-size: x-large\">"); break;
1457 case '7': W_L("<span style=\"font-size: xx-large\">"); break;
1459 if (*(attr_size + 1) == '1') {
1460 W_L("<span style=\"font-size: small\">");
1463 if (*(attr_size + 1) == '2') {
1464 W_L("<span style=\"font-size: x-small\">");
1467 if (*(attr_size + 1) == '3') {
1468 W_L("<span style=\"font-size: xx-small\">");
1471 flg->font_size_flag = 0;
1475 if (*(attr_size + 1) == '1') {
1476 W_L("<span style=\"font-size: large\">");
1479 if (*(attr_size + 1) == '2') {
1480 W_L("<span style=\"font-size: x-large\">");
1483 if (*(attr_size + 1) == '3') {
1484 W_L("<span style=\"font-size: xx-large\">");
1487 flg->font_size_flag = 0;
1491 WRN(doc->r, "invlalid font size. [%s] != (1|2|3|4|5|6|7|+1|+2|+3|-1|-2|-3)", attr_size);
1492 flg->font_size_flag = 0;
1495 node->userData = flg;
1502 * It is a handler who processes the FONT tag.
1504 * @param pdoc [i/o] The pointer to the XHTML structure at the output
1505 * destination is specified.
1506 * @param node [i] The FONT tag node is specified.
1507 * @return The conversion result is returned.
1510 s_xhtml_1_0_end_font_tag(void *pdoc, Node *node)
1512 xhtml_t *xhtml = GET_XHTML(pdoc);
1513 Doc *doc = xhtml->doc;
1515 xhtml_flags_t *flg = (xhtml_flags_t *)node->userData;
1516 if (flg && flg->font_size_flag) {
1519 if (flg && flg->font_color_flag) {
1522 if (IS_CSS_ON(xhtml->entryp)) {
1523 chxj_css_pop_prop_list(xhtml->css_prop_stack);
1530 * It is a handler who processes the FORM tag.
1532 * @param pdoc [i/o] The pointer to the XHTML structure at the output
1533 * destination is specified.
1534 * @param node [i] The FORM tag node is specified.
1535 * @return The conversion result is returned.
1538 s_xhtml_1_0_start_form_tag(void *pdoc, Node *node)
1540 xhtml_t *xhtml = GET_XHTML(pdoc);
1541 Doc *doc = xhtml->doc;
1542 request_rec *r = doc->r;
1544 char *attr_action = NULL;
1545 char *attr_method = NULL;
1546 char *attr_style = NULL;
1547 char *attr_color = NULL;
1548 char *attr_align = NULL;
1549 char *attr_name = NULL;
1550 char *new_hidden_tag = NULL;
1552 /*--------------------------------------------------------------------------*/
1553 /* Get Attributes */
1554 /*--------------------------------------------------------------------------*/
1555 for (attr = qs_get_attr(doc,node);
1557 attr = qs_get_next_attr(doc,attr)) {
1558 char *name = qs_get_attr_name(doc,attr);
1559 char *value = qs_get_attr_value(doc,attr);
1563 if (strcasecmp(name, "action") == 0) {
1564 /*--------------------------------------------------------------------*/
1566 /*--------------------------------------------------------------------*/
1567 attr_action = value;
1573 if (strcasecmp(name, "method") == 0) {
1574 /*--------------------------------------------------------------------*/
1576 /*--------------------------------------------------------------------*/
1577 attr_method = value;
1583 if (strcasecmp(name, "name") == 0) {
1584 /*--------------------------------------------------------------------*/
1586 /*--------------------------------------------------------------------*/
1593 if (strcasecmp(name, "style") == 0) {
1602 if (IS_CSS_ON(xhtml->entryp)) {
1603 css_prop_list_t *style = s_xhtml_1_0_push_and_get_now_style(pdoc, node, attr_style);
1605 css_property_t *text_align_prop = chxj_css_get_property_value(doc, style, "text-align");
1606 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
1607 css_property_t *cur;
1608 for (cur = text_align_prop->next; cur != text_align_prop; cur = cur->next) {
1609 if (STRCASEEQ('l','L',"left", cur->value)) {
1610 attr_align = apr_pstrdup(doc->pool, "left");
1612 else if (STRCASEEQ('c','C',"center",cur->value)) {
1613 attr_align = apr_pstrdup(doc->pool, "center");
1615 else if (STRCASEEQ('r','R',"right",cur->value)) {
1616 attr_align = apr_pstrdup(doc->pool, "right");
1619 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
1620 attr_color = apr_pstrdup(doc->pool, cur->value);
1625 int post_flag = (attr_method && strcasecmp(attr_method, "post") == 0) ? 1 : 0;
1629 attr_action = chxj_encoding_parameter(r, attr_action, 1);
1630 attr_action = chxj_add_cookie_parameter(r, attr_action, xhtml->cookie);
1632 char *old_qs = NULL;
1633 q = strchr(attr_action, '?');
1635 new_hidden_tag = chxj_form_action_to_hidden_tag(r, doc->pool, attr_action, 1, post_flag, &old_qs, CHXJ_FALSE, CHXJ_FALSE, xhtml->entryp);
1636 if (new_hidden_tag || old_qs) {
1660 xhtml_flags_t *flg = (xhtml_flags_t *)apr_palloc(doc->pool, sizeof(xhtml_flags_t));
1661 memset(flg, 0, sizeof(*flg));
1663 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
1664 W_L("<font color=\"");
1667 flg->with_font_flag = 1;
1670 W_L("<div align=\"");
1673 flg->with_div_flag = 1;
1675 node->userData = flg;
1676 if (new_hidden_tag) {
1677 W_V(new_hidden_tag);
1684 * It is a handler who processes the FORM tag.
1686 * @param pdoc [i/o] The pointer to the XHTML structure at the output
1687 * destination is specified.
1688 * @param node [i] The FORM tag node is specified.
1689 * @return The conversion result is returned.
1692 s_xhtml_1_0_end_form_tag(void *pdoc, Node *node)
1694 xhtml_t *xhtml = GET_XHTML(pdoc);
1695 Doc *doc = xhtml->doc;
1697 xhtml_flags_t *flg = (xhtml_flags_t *)node->userData;
1698 if (flg && flg->with_div_flag) {
1701 if (flg && flg->with_font_flag) {
1705 if (IS_CSS_ON(xhtml->entryp)) {
1706 chxj_css_pop_prop_list(xhtml->css_prop_stack);
1714 * It is a handler who processes the INPUT tag.
1716 * @param pdoc [i/o] The pointer to the XHTML structure at the output
1717 * destination is specified.
1718 * @param node [i] The INPUT tag node is specified.
1719 * @return The conversion result is returned.
1722 s_xhtml_1_0_start_input_tag(void *pdoc, Node *node)
1724 xhtml_t *xhtml = GET_XHTML(pdoc);
1725 Doc *doc = xhtml->doc;
1726 request_rec *r = doc->r;
1728 char *attr_max_length = NULL;
1729 char *attr_type = NULL;
1730 char *attr_name = NULL;
1731 char *attr_value = NULL;
1732 char *attr_istyle = NULL;
1733 char *attr_size = NULL;
1734 char *attr_checked = NULL;
1735 char *attr_accesskey = NULL;
1736 char *attr_style = NULL;
1738 /*--------------------------------------------------------------------------*/
1739 /* Get Attributes */
1740 /*--------------------------------------------------------------------------*/
1741 for (attr = qs_get_attr(doc,node);
1743 attr = qs_get_next_attr(doc,attr)) {
1744 char *name = qs_get_attr_name(doc,attr);
1745 char *value = qs_get_attr_value(doc,attr);
1746 if (STRCASEEQ('t','T',"type",name) && value && *value) {
1747 char *tmp_type = qs_trim_string(doc->buf.pool, value);
1748 if (tmp_type && (STRCASEEQ('t','T',"text", tmp_type) ||
1749 STRCASEEQ('p','P',"password",tmp_type) ||
1750 STRCASEEQ('c','C',"checkbox",tmp_type) ||
1751 STRCASEEQ('r','R',"radio", tmp_type) ||
1752 STRCASEEQ('h','H',"hidden", tmp_type) ||
1753 STRCASEEQ('s','S',"submit", tmp_type) ||
1754 STRCASEEQ('r','R',"reset", tmp_type))) {
1755 attr_type = tmp_type;
1758 else if (STRCASEEQ('n','N',"name",name) && value && *value) {
1761 else if (STRCASEEQ('v','V',"value",name) && value && *value) {
1764 else if (STRCASEEQ('i','I',"istyle",name) && value && *value) {
1765 attr_istyle = value;
1767 else if (STRCASEEQ('m','M',"maxlength",name) && value && *value) {
1768 attr_max_length = value;
1770 else if (STRCASEEQ('c','C',"checked", name)) {
1771 attr_checked = value;
1773 else if (STRCASEEQ('a','A',"accesskey", name) && value && *value) {
1774 attr_accesskey = value;
1776 else if (STRCASEEQ('s','S',"size", name) && value && *value) {
1779 else if (STRCASEEQ('s','S',"style", name) && value && *value) {
1784 if (IS_CSS_ON(xhtml->entryp)) {
1785 css_prop_list_t *style = s_xhtml_1_0_nopush_and_get_now_style(pdoc, node, attr_style);
1787 css_property_t *wap_input_format = chxj_css_get_property_value(doc, style, "-wap-input-format");
1788 css_property_t *cur;
1789 for (cur = wap_input_format->next; cur != wap_input_format; cur = cur->next) {
1790 if (strcasestr(cur->value, "<ja:n>")) {
1793 else if (strcasestr(cur->value, "<ja:en>")) {
1796 else if (strcasestr(cur->value, "<ja:hk>")) {
1799 else if (strcasestr(cur->value, "<ja:h>")) {
1807 attr_type = qs_trim_string(doc->buf.pool, attr_type);
1808 if (attr_type && (STRCASEEQ('t','T',"text", attr_type) ||
1809 STRCASEEQ('p','P',"password",attr_type) ||
1810 STRCASEEQ('c','C',"checkbox",attr_type) ||
1811 STRCASEEQ('r','R',"radio", attr_type) ||
1812 STRCASEEQ('h','H',"hidden", attr_type) ||
1813 STRCASEEQ('s','S',"submit", attr_type) ||
1814 STRCASEEQ('r','R',"reset", attr_type))) {
1820 if (attr_size && *attr_size) {
1825 if (attr_name && *attr_name) {
1830 if (attr_value && *attr_value) {
1832 W_V(chxj_add_slash_to_doublequote(doc->pool, attr_value));
1835 if (attr_accesskey && *attr_accesskey) {
1836 W_L(" accesskey=\"");
1837 W_V(attr_accesskey);
1840 if (attr_istyle && *attr_istyle && (*attr_istyle == '1' || *attr_istyle == '2' || *attr_istyle == '3' || *attr_istyle == '4')) {
1841 char *fmt = qs_conv_istyle_to_format(r->pool,attr_istyle);
1842 if (attr_max_length && *attr_max_length) {
1844 for (ii=0; (unsigned int)ii<strlen(attr_max_length); ii++) {
1845 if (attr_max_length[ii] < '0' || attr_max_length[ii] > '9') {
1846 attr_max_length = apr_psprintf(r->pool, "0");
1851 if (strcmp(attr_max_length, "0")) {
1852 char *vv = apr_psprintf(r->pool, " FORMAT=\"%d%s\"", atoi(attr_max_length), fmt);
1864 if (attr_max_length && *attr_max_length) {
1865 if (chxj_chk_numeric(attr_max_length) != 0) {
1866 attr_max_length = apr_psprintf(r->pool, "0");
1868 if (strcmp(attr_max_length, "0")) {
1869 char *vv = apr_psprintf(r->pool, " FORMAT=\"%dm\"", atoi(attr_max_length));
1874 /*--------------------------------------------------------------------------*/
1875 /* The figure is default for the password. */
1876 /*--------------------------------------------------------------------------*/
1877 if (attr_type && (attr_istyle == NULL || *attr_istyle == 0) && STRCASEEQ('p','P',"password", attr_type) && ! xhtml->entryp->pc_flag) {
1878 if (attr_max_length) {
1880 W_V(attr_max_length);
1884 W_L(" FORMAT=\"*N\"");
1888 W_L(" checked=\"checked\"");
1893 /*--------------------------------------------------------------------------*/
1894 /* Get Attributes */
1895 /*--------------------------------------------------------------------------*/
1896 type = qs_get_type_attr(doc, node, doc->buf.pool);
1897 name = qs_get_name_attr(doc, node, doc->buf.pool);
1898 value = qs_get_value_attr(doc,node, doc->buf.pool);
1899 istyle = qs_get_istyle_attr(doc,node,doc->buf.pool);
1900 max_length = qs_get_maxlength_attr(doc,node,doc->buf.pool);
1901 checked = qs_get_checked_attr(doc,node, doc->buf.pool);
1902 accesskey = qs_get_accesskey_attr(doc, node, doc->buf.pool);
1903 size = qs_get_size_attr(doc, node, doc->buf.pool);
1906 type = qs_trim_string(doc->buf.pool, type);
1907 if (type && (STRCASEEQ('t','T',"text", type) ||
1908 STRCASEEQ('p','P',"password",type) ||
1909 STRCASEEQ('c','C',"checkbox",type) ||
1910 STRCASEEQ('r','R',"radio", type) ||
1911 STRCASEEQ('h','H',"hidden", type) ||
1912 STRCASEEQ('s','S',"submit", type) ||
1913 STRCASEEQ('r','R',"reset", type))) {
1919 if (size && *size) {
1924 if (name && *name) {
1929 if (value && *value) {
1930 if (type && (STRCASEEQ('s','S',"submit",type) || STRCASEEQ('r','R',"reset",type))) {
1931 apr_size_t value_len = strlen(value);
1932 value = chxj_conv_z2h(r, value, &value_len, xhtml->entryp);
1936 W_V(chxj_add_slash_to_doublequote(doc->pool, value));
1939 if (accesskey && *accesskey) {
1940 W_L(" accesskey=\"");
1944 if (istyle && *istyle && (*istyle == '1' || *istyle == '2' || *istyle == '3' || *istyle == '4')) {
1945 char *fmt = qs_conv_istyle_to_format(r->pool,istyle);
1946 if (max_length && *max_length) {
1948 for (ii=0; (unsigned int)ii<strlen(max_length); ii++) {
1949 if (max_length[ii] < '0' || max_length[ii] > '9') {
1950 max_length = apr_psprintf(r->pool, "0");
1955 if (strcmp(max_length, "0")) {
1956 char *vv = apr_psprintf(r->pool, " FORMAT=\"%d%s\"", atoi(max_length), fmt);
1968 if (max_length && *max_length) {
1969 if (chxj_chk_numeric(max_length) != 0) {
1970 max_length = apr_psprintf(r->pool, "0");
1972 if (strcmp(max_length, "0")) {
1973 char *vv = apr_psprintf(r->pool, " FORMAT=\"%dm\"", atoi(max_length));
1978 /*--------------------------------------------------------------------------*/
1979 /* The figure is default for the password. */
1980 /*--------------------------------------------------------------------------*/
1981 if (type && (istyle == NULL || *istyle == 0) && STRCASEEQ('p','P',"password", type) && ! xhtml->entryp->pc_flag) {
1988 W_L(" FORMAT=\"*N\"");
1992 W_L(" checked=\"checked\"");
2002 * It is a handler who processes the INPUT tag.
2004 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2005 * destination is specified.
2006 * @param node [i] The INPUT tag node is specified.
2007 * @return The conversion result is returned.
2010 s_xhtml_1_0_end_input_tag(void *pdoc, Node *UNUSED(child))
2012 xhtml_t *xhtml = GET_XHTML(pdoc);
2019 * It is a handler who processes the CENTER tag.
2021 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2022 * destination is specified.
2023 * @param node [i] The CENTER tag node is specified.
2024 * @return The conversion result is returned.
2027 s_xhtml_1_0_start_center_tag(void *pdoc, Node *node)
2032 char *attr_style = NULL;
2033 char *attr_color = NULL;
2034 char *attr_size = NULL;
2036 xhtml = GET_XHTML(pdoc);
2039 for (attr = qs_get_attr(doc,node);
2041 attr = qs_get_next_attr(doc,attr)) {
2042 char *name = qs_get_attr_name(doc,attr);
2043 char *value = qs_get_attr_value(doc,attr);
2044 if (STRCASEEQ('s','S',"style",name) && value && *value) {
2048 if (IS_CSS_ON(xhtml->entryp)) {
2049 css_prop_list_t *style = s_xhtml_1_0_push_and_get_now_style(pdoc, node, attr_style);
2051 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
2052 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
2053 css_property_t *cur;
2054 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
2055 if (cur->value && *cur->value) {
2056 attr_color = apr_pstrdup(doc->pool, cur->value);
2059 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
2060 if (cur->value && *cur->value) {
2061 attr_size = apr_pstrdup(doc->pool, cur->value);
2068 if (attr_size || attr_color) {
2076 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
2090 * It is a handler who processes the CENTER tag.
2092 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2093 * destination is specified.
2094 * @param node [i] The CENTER tag node is specified.
2095 * @return The conversion result is returned.
2098 s_xhtml_1_0_end_center_tag(void *pdoc, Node *UNUSED(node))
2100 xhtml_t *xhtml = GET_XHTML(pdoc);
2101 Doc *doc = xhtml->doc;
2104 if (IS_CSS_ON(xhtml->entryp)) {
2105 chxj_css_pop_prop_list(xhtml->css_prop_stack);
2112 * It is a handler who processes the HR tag.
2114 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2115 * destination is specified.
2116 * @param node [i] The HR tag node is specified.
2117 * @return The conversion result is returned.
2120 s_xhtml_1_0_start_hr_tag(void *pdoc, Node *node)
2126 char *attr_align = NULL;
2127 char *attr_size = NULL;
2128 char *attr_width = NULL;
2129 char *attr_noshade = NULL;
2130 char *attr_style = NULL;
2131 char *attr_color = NULL;
2133 xhtml = GET_XHTML(pdoc);
2137 for (attr = qs_get_attr(doc,node);
2139 attr = qs_get_next_attr(doc,attr)) {
2140 char *name = qs_get_attr_name (doc,attr);
2141 char *value = qs_get_attr_value(doc,attr);
2145 if (strcasecmp(name, "align") == 0) {
2146 /*--------------------------------------------------------------------*/
2148 /*--------------------------------------------------------------------*/
2149 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
2157 if (strcasecmp(name, "size") == 0) {
2158 /*--------------------------------------------------------------------*/
2160 /*--------------------------------------------------------------------*/
2161 if (value && *value) {
2165 else if (strcasecmp(name, "style") == 0) {
2166 if (value && *value) {
2174 if (strcasecmp(name, "width") == 0) {
2175 /*--------------------------------------------------------------------*/
2177 /*--------------------------------------------------------------------*/
2178 if (value && *value) {
2186 if (strcasecmp(name, "noshade") == 0) {
2187 /*--------------------------------------------------------------------*/
2189 /*--------------------------------------------------------------------*/
2190 attr_noshade = apr_pstrdup(doc->pool, "noshade");
2196 if (strcasecmp(name, "color") == 0 && value && *value) {
2197 /*--------------------------------------------------------------------*/
2199 /*--------------------------------------------------------------------*/
2208 if (IS_CSS_ON(xhtml->entryp)) {
2209 css_prop_list_t *style = s_xhtml_1_0_nopush_and_get_now_style(pdoc, node, attr_style);
2211 css_property_t *border_style_prop = chxj_css_get_property_value(doc, style, "border-style");
2212 css_property_t *height_prop = chxj_css_get_property_value(doc, style, "height");
2213 css_property_t *width_prop = chxj_css_get_property_value(doc, style, "width");
2215 css_property_t *float_prop = chxj_css_get_property_value(doc, style, "float");
2216 css_property_t *border_color_prop = chxj_css_get_property_value(doc, style, "border-color");
2219 css_property_t *cur;
2220 for (cur = border_style_prop->next; cur != border_style_prop; cur = cur->next) {
2221 if (STRCASEEQ('s','S',"solid",cur->value)) {
2222 attr_noshade = "noshade";
2225 for (cur = height_prop->next; cur != height_prop; cur = cur->next) {
2226 char *tmp = apr_pstrdup(doc->pool, cur->value);
2227 char *tmpp = strstr(tmp, "px");
2229 size_t len = strlen(tmp) - strlen(tmpp);
2230 attr_size = apr_pstrndup(doc->pool, tmp,len);
2233 char *tmp2 = strstr(tmp,"%");
2235 attr_size = apr_pstrdup(doc->pool, tmp);
2239 for (cur = width_prop->next; cur != width_prop; cur = cur->next) {
2240 char *tmp = apr_pstrdup(doc->pool, cur->value);
2241 char *tmpp = strstr(tmp, "px");
2243 attr_width = apr_pstrdup(doc->pool, tmp);
2246 tmpp = strstr(tmp, "%");
2248 attr_width = apr_pstrdup(doc->pool, tmp);
2253 for (cur = float_prop->next; cur != float_prop; cur = cur->next) {
2254 char *tmp = apr_pstrdup(doc->pool, cur->value);
2255 char *tmpp = strstr(tmp,"none");
2257 attr_align = "center";
2261 attr_align = apr_pstrdup(doc->pool, tmp);
2267 for (cur = border_color_prop->next; cur != border_color_prop; cur = cur->next) {
2268 char *tmp = apr_pstrdup(doc->pool, cur->value);
2270 attr_color = apr_pstrdup(doc->pool, tmp);
2290 if (!strstr(attr_width, "px") && !strstr(attr_width, "%")) {
2318 * It is a handler who processes the HR tag.
2320 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2321 * destination is specified.
2322 * @param node [i] The HR tag node is specified.
2323 * @return The conversion result is returned.
2326 s_xhtml_1_0_end_hr_tag(void *pdoc, Node *UNUSED(child))
2328 xhtml_t *xhtml = GET_XHTML(pdoc);
2335 * It is a handler who processes the PRE tag.
2337 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2338 * destination is specified.
2339 * @param node [i] The PRE tag node is specified.
2340 * @return The conversion result is returned.
2343 s_xhtml_1_0_start_pre_tag(void *pdoc, Node *node)
2345 xhtml_t *xhtml = GET_XHTML(pdoc);
2346 Doc *doc = xhtml->doc;
2348 char *attr_style = NULL;
2350 for (attr = qs_get_attr(doc,node);
2352 attr = qs_get_next_attr(doc,attr)) {
2353 char *nm = qs_get_attr_name(doc,attr);
2354 char *val = qs_get_attr_value(doc,attr);
2355 if (val && STRCASEEQ('s','S',"style", nm)) {
2360 if (IS_CSS_ON(xhtml->entryp)) {
2361 s_xhtml_1_0_push_and_get_now_style(pdoc, node, attr_style);
2371 * It is a handler who processes the PRE tag.
2373 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2374 * destination is specified.
2375 * @param node [i] The PRE tag node is specified.
2376 * @return The conversion result is returned.
2379 s_xhtml_1_0_end_pre_tag(void *pdoc, Node *UNUSED(child))
2381 xhtml_t *xhtml = GET_XHTML(pdoc);
2382 Doc *doc = xhtml->doc;
2386 if (IS_CSS_ON(xhtml->entryp)) {
2387 chxj_css_pop_prop_list(xhtml->css_prop_stack);
2395 * It is a handler who processes the P tag.
2397 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2398 * destination is specified.
2399 * @param node [i] The P tag node is specified.
2400 * @return The conversion result is returned.
2403 s_xhtml_1_0_start_p_tag(void *pdoc, Node *node)
2405 xhtml_t *xhtml = GET_XHTML(pdoc);
2406 Doc *doc = xhtml->doc;
2408 char *attr_align = NULL;
2409 char *attr_style = NULL;
2410 char *attr_color = NULL;
2411 char *attr_blink = NULL;
2412 char *css_clear = NULL;
2414 for (attr = qs_get_attr(doc,node);
2416 attr = qs_get_next_attr(doc,attr)) {
2417 char *nm = qs_get_attr_name(doc,attr);
2418 char *val = qs_get_attr_value(doc,attr);
2419 if (STRCASEEQ('a','A',"align", nm)) {
2420 /*----------------------------------------------------------------------*/
2421 /* CHTML 1.0 (W3C version 3.2) */
2422 /*----------------------------------------------------------------------*/
2423 if (val && (STRCASEEQ('l','L',"left",val) || STRCASEEQ('r','R',"right",val) || STRCASEEQ('c','C',"center",val))) {
2424 attr_align = apr_pstrdup(doc->buf.pool, val);
2428 else if (STRCASEEQ('s','S',"style", nm) && val && *val) {
2429 attr_style = apr_pstrdup(doc->buf.pool, val);
2432 if (IS_CSS_ON(xhtml->entryp)) {
2433 css_prop_list_t *style = s_xhtml_1_0_push_and_get_now_style(pdoc, node, attr_style);
2435 css_property_t *text_align_prop = chxj_css_get_property_value(doc, style, "text-align");
2436 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
2437 css_property_t *text_deco_prop = chxj_css_get_property_value(doc, style, "text-decoration");
2438 css_property_t *clear_prop = chxj_css_get_property_value(doc, style, "clear");
2439 css_property_t *cur;
2440 for (cur = text_align_prop->next; cur != text_align_prop; cur = cur->next) {
2441 if (STRCASEEQ('l','L',"left",cur->value)) {
2442 attr_align = apr_pstrdup(doc->pool, "left");
2444 else if (STRCASEEQ('c','C',"center",cur->value)) {
2445 attr_align = apr_pstrdup(doc->pool, "center");
2447 else if (STRCASEEQ('r','R',"right",cur->value)) {
2448 attr_align = apr_pstrdup(doc->pool, "right");
2451 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
2452 if (cur->value && *cur->value) {
2453 attr_color = apr_pstrdup(doc->pool, cur->value);
2456 for (cur = text_deco_prop->next; cur != text_deco_prop; cur = cur->next) {
2457 if (cur->value && *cur->value && STRCASEEQ('b','B',"blink",cur->value)) {
2458 attr_blink = apr_pstrdup(doc->pool, cur->value);
2461 for (cur = clear_prop->next; cur != clear_prop; cur = cur->next) {
2462 css_clear = apr_pstrdup(doc->pool, cur->value);
2467 if ((attr_align && *attr_align) || (attr_color && *attr_color) || (attr_blink && *attr_blink) || css_clear) {
2475 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
2481 W_L("text-decoration:");
2498 * It is a handler who processes the P tag.
2500 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2501 * destination is specified.
2502 * @param node [i] The P tag node is specified.
2503 * @return The conversion result is returned.
2506 s_xhtml_1_0_end_p_tag(void *pdoc, Node *UNUSED(child))
2508 xhtml_t *xhtml = GET_XHTML(pdoc);
2509 Doc *doc = xhtml->doc;
2512 if (IS_CSS_ON(xhtml->entryp)) {
2513 chxj_css_pop_prop_list(xhtml->css_prop_stack);
2520 * It is a handler who processes the UL tag.
2522 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2523 * destination is specified.
2524 * @param node [i] The UL tag node is specified.
2525 * @return The conversion result is returned.
2528 s_xhtml_1_0_start_ul_tag(void *pdoc, Node *node)
2530 xhtml_t *xhtml = GET_XHTML(pdoc);
2531 Doc *doc = xhtml->doc;
2533 char *attr_type = NULL;
2534 char *attr_style = NULL;
2535 /*--------------------------------------------------------------------------*/
2536 /* Get Attributes */
2537 /*--------------------------------------------------------------------------*/
2538 for (attr = qs_get_attr(doc,node);
2540 attr = qs_get_next_attr(doc,attr)) {
2541 char *name = qs_get_attr_name(doc,attr);
2542 char *value = qs_get_attr_value(doc,attr);
2543 if (STRCASEEQ('t','T',"type",name)) {
2544 if (value && (STRCASEEQ('d','D',"disc",value) || STRCASEEQ('c','C',"circle",value) || STRCASEEQ('s','S',"square",value))) {
2548 else if (value && *value && STRCASEEQ('s','S',"style", name)) {
2552 if (IS_CSS_ON(xhtml->entryp)) {
2553 css_prop_list_t *style = s_xhtml_1_0_push_and_get_now_style(pdoc, node, attr_style);
2555 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "list-style-type");
2556 css_property_t *cur;
2557 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
2558 if (STRCASEEQ('d','D',"disc",cur->value)) {
2559 attr_type = apr_pstrdup(doc->pool, "disc");
2561 else if (STRCASEEQ('c','C',"circle",cur->value)) {
2562 attr_type = apr_pstrdup(doc->pool, "circle");
2564 else if (STRCASEEQ('s','S',"square",cur->value)) {
2565 attr_type = apr_pstrdup(doc->pool, "square");
2573 W_L("list-style-type:");
2584 * It is a handler who processes the UL tag.
2586 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2587 * destination is specified.
2588 * @param node [i] The UL tag node is specified.
2589 * @return The conversion result is returned.
2592 s_xhtml_1_0_end_ul_tag(void *pdoc, Node *UNUSED(child))
2594 xhtml_t *xhtml = GET_XHTML(pdoc);
2595 Doc *doc = xhtml->doc;
2598 if (IS_CSS_ON(xhtml->entryp)) {
2599 chxj_css_pop_prop_list(xhtml->css_prop_stack);
2606 * It is a handler who processes the H1 tag.
2608 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2609 * destination is specified.
2610 * @param node [i] The H1 tag node is specified.
2611 * @return The conversion result is returned.
2614 s_xhtml_1_0_start_h1_tag(void *pdoc, Node *node)
2616 xhtml_t *xhtml = GET_XHTML(pdoc);
2617 Doc *doc = xhtml->doc;
2619 char *attr_style = NULL;
2620 char *attr_align = NULL;
2621 char *css_clear = NULL;
2623 for (attr = qs_get_attr(doc,node);
2625 attr = qs_get_next_attr(doc,attr)) {
2626 char *name = qs_get_attr_name(doc,attr);
2627 char *value = qs_get_attr_value(doc,attr);
2628 if (STRCASEEQ('a','A',"align", name)) {
2629 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
2633 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
2637 if (IS_CSS_ON(xhtml->entryp)) {
2638 css_prop_list_t *style = s_xhtml_1_0_push_and_get_now_style(pdoc, node, attr_style);
2640 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
2641 css_property_t *clear_prop = chxj_css_get_property_value(doc, style, "clear");
2642 css_property_t *cur;
2643 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
2644 if (STRCASEEQ('l','L',"left", cur->value)) {
2645 attr_align = apr_pstrdup(doc->pool, "left");
2647 else if (STRCASEEQ('c','C',"center",cur->value)) {
2648 attr_align = apr_pstrdup(doc->pool, "center");
2650 else if (STRCASEEQ('r','R',"right",cur->value)) {
2651 attr_align = apr_pstrdup(doc->pool, "right");
2654 for (cur = clear_prop->next; cur != clear_prop; cur = cur->next) {
2655 if (STRCASEEQ('b','B',"both", cur->value)) {
2656 css_clear = apr_pstrdup(doc->pool, "both");
2658 else if (STRCASEEQ('r','R',"right", cur->value)) {
2659 css_clear = apr_pstrdup(doc->pool, "right");
2661 else if (STRCASEEQ('l','L',"left", cur->value)) {
2662 css_clear = apr_pstrdup(doc->pool, "left");
2668 if (attr_align || css_clear ) {
2689 * It is a handler who processes the H1 tag.
2691 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2692 * destination is specified.
2693 * @param node [i] The H1 tag node is specified.
2694 * @return The conversion result is returned.
2697 s_xhtml_1_0_end_h1_tag(void *pdoc, Node *UNUSED(child))
2699 xhtml_t *xhtml = GET_XHTML(pdoc);
2700 Doc *doc = xhtml->doc;
2703 if (IS_CSS_ON(xhtml->entryp)) {
2704 chxj_css_pop_prop_list(xhtml->css_prop_stack);
2711 * It is a handler who processes the H2 tag.
2713 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2714 * destination is specified.
2715 * @param node [i] The H2 tag node is specified.
2716 * @return The conversion result is returned.
2719 s_xhtml_1_0_start_h2_tag(void *pdoc, Node *node)
2721 xhtml_t *xhtml = GET_XHTML(pdoc);
2722 Doc *doc = xhtml->doc;
2724 char *attr_style = NULL;
2725 char *attr_align = NULL;
2726 char *css_clear = NULL;
2728 for (attr = qs_get_attr(doc,node);
2730 attr = qs_get_next_attr(doc,attr)) {
2731 char *name = qs_get_attr_name(doc,attr);
2732 char *value = qs_get_attr_value(doc,attr);
2733 if (STRCASEEQ('a','A',"align", name)) {
2734 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
2738 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
2742 if (IS_CSS_ON(xhtml->entryp)) {
2743 css_prop_list_t *style = s_xhtml_1_0_push_and_get_now_style(pdoc, node, attr_style);
2745 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
2746 css_property_t *clear_prop = chxj_css_get_property_value(doc, style, "clear");
2747 css_property_t *cur;
2748 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
2749 if (STRCASEEQ('l','L',"left", cur->value)) {
2750 attr_align = apr_pstrdup(doc->pool, "left");
2752 else if (STRCASEEQ('c','C',"center",cur->value)) {
2753 attr_align = apr_pstrdup(doc->pool, "center");
2755 else if (STRCASEEQ('r','R',"right",cur->value)) {
2756 attr_align = apr_pstrdup(doc->pool, "right");
2759 for (cur = clear_prop->next; cur != clear_prop; cur = cur->next) {
2760 if (STRCASEEQ('b','B',"both", cur->value)) {
2761 css_clear = apr_pstrdup(doc->pool, "both");
2763 else if (STRCASEEQ('r','R',"right", cur->value)) {
2764 css_clear = apr_pstrdup(doc->pool, "right");
2766 else if (STRCASEEQ('l','L',"left", cur->value)) {
2767 css_clear = apr_pstrdup(doc->pool, "left");
2773 if (attr_align || css_clear ) {
2794 * It is a handler who processes the H2 tag.
2796 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2797 * destination is specified.
2798 * @param node [i] The H2 tag node is specified.
2799 * @return The conversion result is returned.
2802 s_xhtml_1_0_end_h2_tag(void *pdoc, Node *UNUSED(child))
2804 xhtml_t *xhtml = GET_XHTML(pdoc);
2805 Doc *doc = xhtml->doc;
2808 if (IS_CSS_ON(xhtml->entryp)) {
2809 chxj_css_pop_prop_list(xhtml->css_prop_stack);
2816 * It is a handler who processes the H3 tag.
2818 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2819 * destination is specified.
2820 * @param node [i] The H3 tag node is specified.
2821 * @return The conversion result is returned.
2824 s_xhtml_1_0_start_h3_tag(void *pdoc, Node *node)
2826 xhtml_t *xhtml = GET_XHTML(pdoc);
2827 Doc *doc = xhtml->doc;
2829 char *attr_style = NULL;
2830 char *attr_align = NULL;
2831 char *css_clear = NULL;
2833 for (attr = qs_get_attr(doc,node);
2835 attr = qs_get_next_attr(doc,attr)) {
2836 char *name = qs_get_attr_name(doc,attr);
2837 char *value = qs_get_attr_value(doc,attr);
2838 if (STRCASEEQ('a','A',"align", name)) {
2839 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
2843 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
2847 if (IS_CSS_ON(xhtml->entryp)) {
2848 css_prop_list_t *style = s_xhtml_1_0_push_and_get_now_style(pdoc, node, attr_style);
2850 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
2851 css_property_t *clear_prop = chxj_css_get_property_value(doc, style, "clear");
2852 css_property_t *cur;
2853 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
2854 if (STRCASEEQ('l','L',"left", cur->value)) {
2855 attr_align = apr_pstrdup(doc->pool, "left");
2857 else if (STRCASEEQ('c','C',"center",cur->value)) {
2858 attr_align = apr_pstrdup(doc->pool, "center");
2860 else if (STRCASEEQ('r','R',"right",cur->value)) {
2861 attr_align = apr_pstrdup(doc->pool, "right");
2864 for (cur = clear_prop->next; cur != clear_prop; cur = cur->next) {
2865 if (STRCASEEQ('b','B',"both", cur->value)) {
2866 css_clear = apr_pstrdup(doc->pool, "both");
2868 else if (STRCASEEQ('r','R',"right", cur->value)) {
2869 css_clear = apr_pstrdup(doc->pool, "right");
2871 else if (STRCASEEQ('l','L',"left", cur->value)) {
2872 css_clear = apr_pstrdup(doc->pool, "left");
2878 if (attr_align || css_clear ) {
2899 * It is a handler who processes the H3 tag.
2901 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2902 * destination is specified.
2903 * @param node [i] The H3 tag node is specified.
2904 * @return The conversion result is returned.
2907 s_xhtml_1_0_end_h3_tag(void *pdoc, Node *UNUSED(child))
2909 xhtml_t *xhtml = GET_XHTML(pdoc);
2910 Doc *doc = xhtml->doc;
2913 if (IS_CSS_ON(xhtml->entryp)) {
2914 chxj_css_pop_prop_list(xhtml->css_prop_stack);
2922 * It is a handler who processes the H4 tag.
2924 * @param pdoc [i/o] The pointer to the XHTML structure at the output
2925 * destination is specified.
2926 * @param node [i] The H4 tag node is specified.
2927 * @return The conversion result is returned.
2930 s_xhtml_1_0_start_h4_tag(void *pdoc, Node *node)
2932 xhtml_t *xhtml = GET_XHTML(pdoc);
2933 Doc *doc = xhtml->doc;
2935 char *attr_style = NULL;
2936 char *attr_align = NULL;
2937 char *css_clear = NULL;
2939 for (attr = qs_get_attr(doc,node);
2941 attr = qs_get_next_attr(doc,attr)) {
2942 char *name = qs_get_attr_name(doc,attr);
2943 char *value = qs_get_attr_value(doc,attr);
2944 if (STRCASEEQ('a','A',"align", name)) {
2945 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
2949 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
2953 if (IS_CSS_ON(xhtml->entryp)) {
2954 css_prop_list_t *style = s_xhtml_1_0_push_and_get_now_style(pdoc, node, attr_style);
2956 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
2957 css_property_t *clear_prop = chxj_css_get_property_value(doc, style, "clear");
2958 css_property_t *cur;
2959 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
2960 if (STRCASEEQ('l','L',"left", cur->value)) {
2961 attr_align = apr_pstrdup(doc->pool, "left");
2963 else if (STRCASEEQ('c','C',"center",cur->value)) {
2964 attr_align = apr_pstrdup(doc->pool, "center");
2966 else if (STRCASEEQ('r','R',"right",cur->value)) {
2967 attr_align = apr_pstrdup(doc->pool, "right");
2970 for (cur = clear_prop->next; cur != clear_prop; cur = cur->next) {
2971 if (STRCASEEQ('b','B',"both", cur->value)) {
2972 css_clear = apr_pstrdup(doc->pool, "both");
2974 else if (STRCASEEQ('r','R',"right", cur->value)) {
2975 css_clear = apr_pstrdup(doc->pool, "right");
2977 else if (STRCASEEQ('l','L',"left", cur->value)) {
2978 css_clear = apr_pstrdup(doc->pool, "left");
2984 if (attr_align || css_clear ) {
3005 * It is a handler who processes the H4 tag.
3007 * @param pdoc [i/o] The pointer to the XHTML structure at the output
3008 * destination is specified.
3009 * @param node [i] The H4 tag node is specified.
3010 * @return The conversion result is returned.
3013 s_xhtml_1_0_end_h4_tag(void *pdoc, Node *UNUSED(child))
3015 xhtml_t *xhtml = GET_XHTML(pdoc);
3016 Doc *doc = xhtml->doc;
3019 if (IS_CSS_ON(xhtml->entryp)) {
3020 chxj_css_pop_prop_list(xhtml->css_prop_stack);
3028 * It is a handler who processes the H5 tag.
3030 * @param pdoc [i/o] The pointer to the XHTML structure at the output
3031 * destination is specified.
3032 * @param node [i] The H5 tag node is specified.
3033 * @return The conversion result is returned.
3036 s_xhtml_1_0_start_h5_tag(void *pdoc, Node *node)
3038 xhtml_t *xhtml = GET_XHTML(pdoc);
3039 Doc *doc = xhtml->doc;
3041 char *attr_style = NULL;
3042 char *attr_align = NULL;
3043 char *css_clear = NULL;
3045 for (attr = qs_get_attr(doc,node);
3047 attr = qs_get_next_attr(doc,attr)) {
3048 char *name = qs_get_attr_name(doc,attr);
3049 char *value = qs_get_attr_value(doc,attr);
3050 if (STRCASEEQ('a','A',"align", name)) {
3051 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
3055 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
3059 if (IS_CSS_ON(xhtml->entryp)) {
3060 css_prop_list_t *style = s_xhtml_1_0_push_and_get_now_style(pdoc, node, attr_style);
3062 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
3063 css_property_t *clear_prop = chxj_css_get_property_value(doc, style, "clear");
3064 css_property_t *cur;
3065 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
3066 if (STRCASEEQ('l','L',"left", cur->value)) {
3067 attr_align = apr_pstrdup(doc->pool, "left");
3069 else if (STRCASEEQ('c','C',"center",cur->value)) {
3070 attr_align = apr_pstrdup(doc->pool, "center");
3072 else if (STRCASEEQ('r','R',"right",cur->value)) {
3073 attr_align = apr_pstrdup(doc->pool, "right");
3076 for (cur = clear_prop->next; cur != clear_prop; cur = cur->next) {
3077 if (STRCASEEQ('b','B',"both", cur->value)) {
3078 css_clear = apr_pstrdup(doc->pool, "both");
3080 else if (STRCASEEQ('r','R',"right", cur->value)) {
3081 css_clear = apr_pstrdup(doc->pool, "right");
3083 else if (STRCASEEQ('l','L',"left", cur->value)) {
3084 css_clear = apr_pstrdup(doc->pool, "left");
3090 if (attr_align || css_clear ) {
3111 * It is a handler who processes the H5 tag.
3113 * @param pdoc [i/o] The pointer to the XHTML structure at the output
3114 * destination is specified.
3115 * @param node [i] The H5 tag node is specified.
3116 * @return The conversion result is returned.
3119 s_xhtml_1_0_end_h5_tag(void *pdoc, Node *UNUSED(child))
3121 xhtml_t *xhtml = GET_XHTML(pdoc);
3122 Doc *doc = xhtml->doc;
3125 if (IS_CSS_ON(xhtml->entryp)) {
3126 chxj_css_pop_prop_list(xhtml->css_prop_stack);
3134 * It is a handler who processes the H6 tag.
3136 * @param pdoc [i/o] The pointer to the XHTML structure at the output
3137 * destination is specified.
3138 * @param node [i] The H6 tag node is specified.
3139 * @return The conversion result is returned.
3142 s_xhtml_1_0_start_h6_tag(void *pdoc, Node *node)
3144 xhtml_t *xhtml = GET_XHTML(pdoc);
3145 Doc *doc = xhtml->doc;
3147 char *attr_style = NULL;
3148 char *attr_align = NULL;
3149 char *css_clear = NULL;
3151 for (attr = qs_get_attr(doc,node);
3153 attr = qs_get_next_attr(doc,attr)) {
3154 char *name = qs_get_attr_name(doc,attr);
3155 char *value = qs_get_attr_value(doc,attr);
3156 if (STRCASEEQ('a','A',"align", name)) {
3157 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
3161 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
3165 if (IS_CSS_ON(xhtml->entryp)) {
3166 css_prop_list_t *style = s_xhtml_1_0_push_and_get_now_style(pdoc, node, attr_style);
3168 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
3169 css_property_t *clear_prop = chxj_css_get_property_value(doc, style, "clear");
3170 css_property_t *cur;
3171 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
3172 if (STRCASEEQ('l','L',"left", cur->value)) {
3173 attr_align = apr_pstrdup(doc->pool, "left");
3175 else if (STRCASEEQ('c','C',"center",cur->value)) {
3176 attr_align = apr_pstrdup(doc->pool, "center");
3178 else if (STRCASEEQ('r','R',"right",cur->value)) {
3179 attr_align = apr_pstrdup(doc->pool, "right");
3182 for (cur = clear_prop->next; cur != clear_prop; cur = cur->next) {
3183 if (STRCASEEQ('b','B',"both", cur->value)) {
3184 css_clear = apr_pstrdup(doc->pool, "both");
3186 else if (STRCASEEQ('r','R',"right", cur->value)) {
3187 css_clear = apr_pstrdup(doc->pool, "right");
3189 else if (STRCASEEQ('l','L',"left", cur->value)) {
3190 css_clear = apr_pstrdup(doc->pool, "left");
3196 if (attr_align || css_clear ) {
3217 * It is a handler who processes the H6 tag.
3219 * @param pdoc [i/o] The pointer to the XHTML structure at the output
3220 * destination is specified.
3221 * @param node [i] The H6 tag node is specified.
3222 * @return The conversion result is returned.
3225 s_xhtml_1_0_end_h6_tag(void *pdoc, Node *UNUSED(child))
3227 xhtml_t *xhtml = GET_XHTML(pdoc);
3228 Doc *doc = xhtml->doc;
3231 if (IS_CSS_ON(xhtml->entryp)) {
3232 chxj_css_pop_prop_list(xhtml->css_prop_stack);
3240 * It is a handler who processes the OL tag.
3242 * @param pdoc [i/o] The pointer to the XHTML structure at the output
3243 * destination is specified.
3244 * @param node [i] The OL tag node is specified.
3245 * @return The conversion result is returned.
3248 s_xhtml_1_0_start_ol_tag(void *pdoc, Node *node)
3250 xhtml_t *xhtml = GET_XHTML(pdoc);
3251 Doc *doc = xhtml->doc;
3253 char *attr_style = NULL;
3254 char *attr_start = NULL;
3255 char *attr_type = NULL;
3257 /*--------------------------------------------------------------------------*/
3258 /* Get Attributes */
3259 /*--------------------------------------------------------------------------*/
3260 for (attr = qs_get_attr(doc,node);
3262 attr = qs_get_next_attr(doc,attr)) {
3263 char *name = qs_get_attr_name(doc,attr);
3264 char *value = qs_get_attr_value(doc,attr);
3265 if (STRCASEEQ('t','T',"type",name) && value) {
3266 if (*value == '1') {
3267 attr_type = apr_pstrdup(doc->pool, "decimal");
3269 else if (*value == 'a') {
3270 attr_type = apr_pstrdup(doc->pool, "lower-alpha");
3272 else if (*value == 'A') {
3273 attr_type = apr_pstrdup(doc->pool, "upper-alpha");
3276 else if (STRCASEEQ('s','S',"start",name) && value && *value) {
3279 else if (STRCASEEQ('s','S',"style", name) && value && *value) {
3283 if (IS_CSS_ON(xhtml->entryp)) {
3284 css_prop_list_t *style = s_xhtml_1_0_push_and_get_now_style(pdoc, node, attr_style);
3286 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "list-style-type");
3287 css_property_t *cur;
3288 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
3289 if (STRCASEEQ('d','D',"decimal", cur->value)) {
3290 attr_type = apr_pstrdup(doc->pool, "decimal");
3292 else if (STRCASEEQ('u','U',"upper-alpha", cur->value)) {
3293 attr_type = apr_pstrdup(doc->pool, "upper-alpha");
3295 else if (STRCASEEQ('l','L',"lower-alpha", cur->value)) {
3296 attr_type = apr_pstrdup(doc->pool, "lower-alpha");
3304 W_L("list-style-type:");
3321 * It is a handler who processes the OL tag.
3323 * @param pdoc [i/o] The pointer to the XHTML structure at the output
3324 * destination is specified.
3325 * @param node [i] The OL tag node is specified.
3326 * @return The conversion result is returned.
3329 s_xhtml_1_0_end_ol_tag(void *pdoc, Node *UNUSED(child))
3331 xhtml_t *xhtml = GET_XHTML(pdoc);
3332 Doc *doc = xhtml->doc;
3335 if (IS_CSS_ON(xhtml->entryp)) {
3336 chxj_css_pop_prop_list(xhtml->css_prop_stack);
3344 * It is a handler who processes the LI tag.
3346 * @param pdoc [i/o] The pointer to the XHTML structure at the output
3347 * destination is specified.
3348 * @param node [i] The LI tag node is specified.
3349 * @return The conversion result is returned.
3352 s_xhtml_1_0_start_li_tag(void *pdoc, Node *node)
3354 xhtml_t *xhtml = GET_XHTML(pdoc);
3355 Doc *doc = xhtml->doc;
3357 char *attr_type = NULL;
3358 char *attr_value = NULL;
3359 char *attr_style = NULL;
3361 for (attr = qs_get_attr(doc,node);
3363 attr = qs_get_next_attr(doc,attr)) {
3364 char *name = qs_get_attr_name(doc,attr);
3365 char *value = qs_get_attr_value(doc,attr);
3366 if (STRCASEEQ('t','T',"type",name)) {
3367 if (value && (*value == '1' || *value == 'a' || *value == 'A' || STRCASEEQ('d','D',"disc",value) || STRCASEEQ('s','S',"square",value) || STRCASEEQ('c','C',"circle",value))) {
3368 if (*value == '1') {
3369 attr_type = apr_pstrdup(doc->pool, "decimal");
3371 else if (*value == 'a') {
3372 attr_type = apr_pstrdup(doc->pool, "lower-alpha");
3374 else if (*value == 'A') {
3375 attr_type = apr_pstrdup(doc->pool, "upper-alpha");
3382 else if (STRCASEEQ('v','V',"value", name) && value && *value) {
3385 else if (STRCASEEQ('s','S',"style", name) && value && *value) {
3389 if (IS_CSS_ON(xhtml->entryp)) {
3390 css_prop_list_t *style = s_xhtml_1_0_push_and_get_now_style(pdoc, node, attr_style);
3392 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "list-style-type");
3393 css_property_t *cur;
3394 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
3395 if (STRCASEEQ('d','D',"decimal", cur->value)) {
3396 attr_type = apr_pstrdup(doc->pool, "decimal");
3398 else if (STRCASEEQ('u','U',"upper-alpha", cur->value)) {
3399 attr_type = apr_pstrdup(doc->pool, "upper-alpha");
3401 else if (STRCASEEQ('l','L',"lower-alpha", cur->value)) {
3402 attr_type = apr_pstrdup(doc->pool, "lower-alpha");
3404 else if (STRCASEEQ('d','D',"disc", cur->value)) {
3405 attr_type = apr_pstrdup(doc->pool, "disc");
3407 else if (STRCASEEQ('s','S',"square", cur->value)) {
3408 attr_type = apr_pstrdup(doc->pool, "square");
3410 else if (STRCASEEQ('c','C',"circle", cur->value)) {
3411 attr_type = apr_pstrdup(doc->pool, "circle");
3421 W_L("list-style-type:");
3437 ** It is a handler who processes the LI tag.
3439 * @param pdoc [i/o] The pointer to the XHTML structure at the output
3440 * destination is specified.
3441 * @param node [i] The LI tag node is specified.
3442 * @return The conversion result is returned.
3445 s_xhtml_1_0_end_li_tag(void *pdoc, Node *UNUSED(child))
3447 xhtml_t *xhtml = GET_XHTML(pdoc);
3448 Doc *doc = xhtml->doc;
3451 if (IS_CSS_ON(xhtml->entryp)) {
3452 chxj_css_pop_prop_list(xhtml->css_prop_stack);
3458 * It is a handler who processes the IMG tag.
3460 * @param pdoc [i/o] The pointer to the XHTML structure at the output
3461 * destination is specified.
3462 * @param node [i] The IMG tag node is specified.
3463 * @return The conversion result is returned.
3466 s_xhtml_1_0_start_img_tag(void *pdoc, Node *node)
3468 xhtml_t *xhtml = GET_XHTML(pdoc);
3469 Doc *doc = xhtml->doc;
3470 request_rec *r = doc->r;
3472 char *attr_src = NULL;
3473 char *attr_alt = NULL;
3474 char *attr_height = NULL;
3475 char *attr_width = NULL;
3476 char *attr_align = NULL;
3477 char *attr_style = NULL;
3478 char *attr_hspace = NULL;
3479 char *attr_vspace = NULL;
3481 char *css_margin_left = NULL;
3482 char *css_margin_right = NULL;
3483 char *css_margin_top = NULL;
3484 char *css_margin_bottom = NULL;
3485 char *css_display = NULL;
3486 char *css_valign = NULL;
3489 #ifndef IMG_NOT_CONVERT_FILENAME
3490 device_table *spec = xhtml->spec;
3493 /*--------------------------------------------------------------------------*/
3494 /* Get Attributes */
3495 /*--------------------------------------------------------------------------*/
3496 for (attr = qs_get_attr(doc,node);
3498 attr = qs_get_next_attr(doc,attr)) {
3499 char *name = qs_get_attr_name(doc,attr);
3500 char *value = qs_get_attr_value(doc,attr);
3502 if (STRCASEEQ('s','S',"src",name)) {
3503 value = chxj_encoding_parameter(r, value, 1);
3504 value = chxj_add_cookie_parameter(r, value, xhtml->cookie);
3505 value = chxj_add_cookie_no_update_parameter(r, value);
3506 #ifdef IMG_NOT_CONVERT_FILENAME
3512 attr_src = chxj_img_conv(r,spec,value);
3518 if (STRCASEEQ('a','A',"align",name)) {
3520 if (STRCASEEQ('t','T',"top", value) ||
3521 STRCASEEQ('m','M',"middle",value) ||
3522 STRCASEEQ('b','B',"bottom",value)) {
3525 else if( STRCASEEQ('l','L',"left", value) ||
3526 STRCASEEQ('r','R',"right", value)) {
3529 else if (STRCASEEQ('c','C',"center", value)) {
3530 css_valign = apr_pstrdup(doc->pool, "middle");
3534 else if (STRCASEEQ('a','A',"alt",name) && value && *value) {
3537 else if (STRCASEEQ('w','W',"width",name) && value && *value) {
3540 else if (STRCASEEQ('h','H',"height",name) && value && *value) {
3541 attr_height = value;
3543 else if (STRCASEEQ('h','H',"hspace",name) && value && *value) {
3544 attr_hspace = value;
3546 else if (STRCASEEQ('v','V',"vspace",name) && value && *value) {
3547 attr_vspace = value;
3549 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
3554 if (IS_CSS_ON(xhtml->entryp)) {
3555 css_prop_list_t *style = s_xhtml_1_0_nopush_and_get_now_style(pdoc, node, attr_style);
3557 css_property_t *height_prop = chxj_css_get_property_value(doc, style, "height");
3558 css_property_t *width_prop = chxj_css_get_property_value(doc, style, "width");
3559 css_property_t *valign_prop = chxj_css_get_property_value(doc, style, "vertical-align");
3560 css_property_t *margin_left_prop = chxj_css_get_property_value(doc, style, "margin-left");
3561 css_property_t *margin_right_prop = chxj_css_get_property_value(doc, style, "margin-right");
3562 css_property_t *margin_top_prop = chxj_css_get_property_value(doc, style, "margin-top");
3563 css_property_t *margin_bottom_prop = chxj_css_get_property_value(doc, style, "margin-bottom");
3565 css_property_t *cur;
3566 for (cur = height_prop->next; cur != height_prop; cur = cur->next) {
3567 attr_height = apr_pstrdup(doc->pool, cur->value);
3569 for (cur = width_prop->next; cur != width_prop; cur = cur->next) {
3570 attr_width = apr_pstrdup(doc->pool, cur->value);
3573 for (cur = valign_prop->next; cur != valign_prop; cur = cur->next) {
3574 css_valign = apr_pstrdup(doc->pool, cur->value);
3578 if (! attr_hspace) {
3579 for (cur = margin_left_prop->next; cur != margin_left_prop; cur = cur->next) {
3580 css_margin_left = apr_pstrdup(doc->pool, cur->value);
3582 for (cur = margin_right_prop->next; cur != margin_right_prop; cur = cur->next) {
3583 css_margin_right = apr_pstrdup(doc->pool, cur->value);
3587 if (! attr_vspace) {
3588 for (cur = margin_top_prop->next; cur != margin_top_prop; cur = cur->next) {
3589 css_margin_top = apr_pstrdup(doc->pool, cur->value);
3591 for (cur = margin_bottom_prop->next; cur != margin_bottom_prop; cur = cur->next) {
3592 css_margin_bottom = apr_pstrdup(doc->pool, cur->value);
3596 // float:[left|right] -> align
3598 css_property_t *float_prop = chxj_css_get_property_value(doc, style, "float");
3599 for (cur = float_prop->next; cur != float_prop; cur = cur->next) {
3600 attr_align = apr_pstrdup(doc->pool, cur->value);
3603 css_property_t *display_prop = chxj_css_get_property_value(doc, style, "display");
3604 for (cur = display_prop->next; cur != display_prop; cur = cur->next) {
3605 char *tmp = apr_pstrdup(doc->pool, cur->value);
3606 char *tmpp = strstr(tmp, "none");
3608 css_display = apr_pstrdup(doc->pool, tmp);
3635 if (attr_hspace || attr_vspace || css_margin_left || css_margin_right || css_margin_top || css_margin_bottom || css_valign || css_display) {
3638 W_L("vertical-align:");
3643 W_L("margin-left:");
3646 W_L("margin-right:");
3651 if(css_margin_left){
3652 W_L("margin-left:");
3653 W_V(css_margin_left);
3656 if(css_margin_right){
3657 W_L("margin-right:");
3658 W_V(css_margin_right);
3666 W_L("margin-bottom:");
3673 W_V(css_margin_top);
3676 if(css_margin_bottom){
3677 W_L("margin-bottom:");
3678 W_V(css_margin_bottom);
3683 W_L("display:none;");
3701 * It is a handler who processes the IMG tag.
3703 * @param xhtml [i/o] The pointer to the XHTML structure at the output
3704 * destination is specified.
3705 * @param node [i] The IMG tag node is specified.
3706 * @return The conversion result is returned.
3709 s_xhtml_1_0_end_img_tag(void *pdoc, Node *UNUSED(child))
3711 xhtml_t *xhtml = GET_XHTML(pdoc);
3718 * It is a handler who processes the SELECT tag.
3720 * @param pdoc [i/o] The pointer to the XHTML structure at the output
3721 * destination is specified.
3722 * @param node [i] The SELECT tag node is specified.
3723 * @return The conversion result is returned.
3726 s_xhtml_1_0_start_select_tag(void *pdoc, Node *node)
3728 xhtml_t *xhtml = GET_XHTML(pdoc);
3729 Doc *doc = xhtml->doc;
3732 char *multiple = NULL;
3734 char *attr_style = NULL;
3737 for (attr = qs_get_attr(doc,node);
3739 attr = qs_get_next_attr(doc,attr)) {
3740 char *nm = qs_get_attr_name(doc,attr);
3741 char *val = qs_get_attr_value(doc,attr);
3742 if (STRCASEEQ('s','S',"size",nm)) {
3743 /*----------------------------------------------------------------------*/
3744 /* CHTML 1.0 version 2.0 */
3745 /*----------------------------------------------------------------------*/
3746 size = apr_pstrdup(doc->buf.pool, val);
3748 else if (STRCASEEQ('s','S',"style",nm) && val && *val) {
3749 /*----------------------------------------------------------------------*/
3750 /* CHTML 1.0 version 2.0 */
3751 /*----------------------------------------------------------------------*/
3752 attr_style = apr_pstrdup(doc->buf.pool, val);
3754 else if (STRCASEEQ('n','N',"name",nm)) {
3755 /*----------------------------------------------------------------------*/
3756 /* CHTML 1.0 version 2.0 */
3757 /*----------------------------------------------------------------------*/
3758 name = apr_pstrdup(doc->buf.pool, val);
3760 else if (STRCASEEQ('m','M',"multiple",nm)) {
3761 /*----------------------------------------------------------------------*/
3762 /* CHTML 1.0 version 2.0 */
3763 /*----------------------------------------------------------------------*/
3764 multiple = apr_pstrdup(doc->buf.pool, val);
3767 if (size && *size) {
3772 if (name && *name) {
3778 /* "true" is *NOT* W3C. it is specification of WAP2.0 for EZWEB */
3779 W_L(" multiple=\"true\"");
3782 if (IS_CSS_ON(xhtml->entryp)) {
3783 s_xhtml_1_0_push_and_get_now_style(pdoc, node, attr_style);
3791 * It is a handler who processes the SELECT tag.
3793 * @param pdoc [i/o] The pointer to the XHTML structure at the output
3794 * destination is specified.
3795 * @param node [i] The SELECT tag node is specified.
3796 * @return The conversion result is returned.
3799 s_xhtml_1_0_end_select_tag(void *pdoc, Node *UNUSED(child))
3801 xhtml_t *xhtml = GET_XHTML(pdoc);
3802 Doc *doc = xhtml->doc;
3805 if (IS_CSS_ON(xhtml->entryp)) {
3806 chxj_css_pop_prop_list(xhtml->css_prop_stack);
3813 * It is a handler who processes the OPTION tag.
3815 * @param pdoc [i/o] The pointer to the XHTML structure at the output
3816 * destination is specified.
3817 * @param node [i] The OPTION tag node is specified.
3818 * @return The conversion result is returned.
3821 s_xhtml_1_0_start_option_tag(void *pdoc, Node *node)
3823 xhtml_t *xhtml = GET_XHTML(pdoc);
3824 Doc *doc = xhtml->doc;
3826 char *attr_style = NULL;
3828 char *selected = NULL;
3832 for (attr = qs_get_attr(doc,node);
3834 attr = qs_get_next_attr(doc,attr)) {
3835 char *nm = qs_get_attr_name(doc,attr);
3836 char *val = qs_get_attr_value(doc,attr);
3837 if (STRCASEEQ('s','S',"selected",nm)) {
3838 /* CHTML version 2.0 */
3839 selected = apr_pstrdup(doc->buf.pool, val);
3841 else if (STRCASEEQ('s','S',"style",nm) && val && *val) {
3842 /* CHTML version 2.0 */
3843 attr_style = apr_pstrdup(doc->buf.pool, val);
3845 else if (STRCASEEQ('v','V',"value",nm)) {
3846 /* CHTML version 2.0 */
3847 value = apr_pstrdup(doc->buf.pool, val);
3856 W_L(" selected=\"selected\"");
3859 if (IS_CSS_ON(xhtml->entryp)) {
3860 s_xhtml_1_0_push_and_get_now_style(pdoc, node, attr_style);
3867 * It is a handler who processes the OPTION tag.
3869 * @param pdoc [i/o] The pointer to the XHTML structure at the output
3870 * destination is specified.
3871 * @param node [i] The OPTION tag node is specified.
3872 * @return The conversion result is returned.
3875 s_xhtml_1_0_end_option_tag(void *pdoc, Node *UNUSED(child))
3877 xhtml_t *xhtml = GET_XHTML(pdoc);
3878 Doc *doc = xhtml->doc;
3881 if (IS_CSS_ON(xhtml->entryp)) {
3882 chxj_css_pop_prop_list(xhtml->css_prop_stack);
3890 * It is a handler who processes the DIV tag.
3892 * @param pdoc [i/o] The pointer to the XHTML structure at the output
3893 * destination is specified.
3894 * @param node [i] The DIV tag node is specified.
3895 * @return The conversion result is returned.
3898 s_xhtml_1_0_start_div_tag(void *pdoc, Node *node)
3900 xhtml_t *xhtml = GET_XHTML(pdoc);
3901 Doc *doc = xhtml->doc;
3903 char *attr_style = NULL;
3904 char *attr_align = NULL;
3905 char *attr_display = NULL;
3906 char *attr_decoration = NULL;
3907 char *attr_wap_marquee_style = NULL;
3908 char *attr_wap_marquee_dir = NULL;
3909 char *attr_wap_marquee_loop = NULL;
3910 char *attr_color = NULL;
3911 char *attr_bgcolor = NULL;
3912 char *attr_font_size = NULL;
3913 char *css_clear = NULL;
3915 for (attr = qs_get_attr(doc,node);
3917 attr = qs_get_next_attr(doc,attr)) {
3918 char *nm = qs_get_attr_name(doc,attr);
3919 char *val = qs_get_attr_value(doc,attr);
3920 if (STRCASEEQ('a','A',"align",nm)) {
3921 /*----------------------------------------------------------------------*/
3922 /* CHTML 1.0 (W3C version 3.2) */
3923 /*----------------------------------------------------------------------*/
3924 if (val && (STRCASEEQ('l','L',"left",val) || STRCASEEQ('r','R',"right",val) || STRCASEEQ('c','C',"center",val))) {
3925 attr_align = apr_pstrdup(doc->buf.pool, val);
3928 else if (STRCASEEQ('s','S',"style",nm) && val && *val) {
3929 attr_style = apr_pstrdup(doc->buf.pool, val);
3933 if (IS_CSS_ON(xhtml->entryp)) {
3934 css_prop_list_t *style = s_xhtml_1_0_nopush_and_get_now_style(pdoc, node, attr_style);
3936 css_property_t *display_prop = chxj_css_get_property_value(doc, style, "display");
3937 css_property_t *text_decoration_prop = chxj_css_get_property_value(doc, style, "text-decoration");
3938 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
3939 css_property_t *text_align_prop = chxj_css_get_property_value(doc, style, "text-align");
3940 css_property_t *font_size_prop = chxj_css_get_property_value(doc, style, "font-size");
3941 css_property_t *background_color_prop = chxj_css_get_property_value(doc, style, "background-color");
3942 css_property_t *background_prop = chxj_css_get_property_value(doc, style, "background");
3943 css_property_t *clear_prop = chxj_css_get_property_value(doc, style, "clear");
3945 css_property_t *cur;
3946 for (cur = display_prop->next; cur != display_prop; cur = cur->next) {
3947 if (strcasecmp("-wap-marquee", cur->value) == 0) {
3948 attr_display = apr_pstrdup(doc->pool, cur->value);
3951 for (cur = text_decoration_prop->next; cur != text_decoration_prop; cur = cur->next) {
3952 if (STRCASEEQ('b','B',"blink", cur->value)) {
3953 attr_decoration = apr_pstrdup(doc->pool, cur->value);
3956 for (cur = background_color_prop->next; cur != background_color_prop; cur = cur->next) {
3957 attr_bgcolor = apr_pstrdup(doc->pool, cur->value);
3958 attr_bgcolor = chxj_css_rgb_func_to_value(doc->pool, attr_bgcolor);
3960 for (cur = background_prop->next; cur != background_prop; cur = cur->next) {
3961 char *ss = strchr(cur->value, '#');
3963 attr_bgcolor = apr_pstrdup(doc->pool, cur->value);
3964 attr_bgcolor = chxj_css_rgb_func_to_value(doc->pool, attr_bgcolor);
3967 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
3968 attr_color = apr_pstrdup(doc->pool, cur->value);
3970 for (cur = text_align_prop->next; cur != text_align_prop; cur = cur->next) {
3971 attr_align = apr_pstrdup(doc->pool, cur->value);
3973 for (cur = font_size_prop->next; cur != font_size_prop; cur = cur->next) {
3974 if ( STRCASEEQ('x','X',"xx-small",cur->value)
3975 || STRCASEEQ('x','X',"x-small",cur->value)
3976 || STRCASEEQ('s','S',"small",cur->value)
3977 || STRCASEEQ('m','M',"medium",cur->value)
3978 || STRCASEEQ('l','L',"large",cur->value)
3979 || STRCASEEQ('x','X',"x-large",cur->value)
3980 || STRCASEEQ('x','X',"xx-large",cur->value)) {
3981 attr_font_size = apr_pstrdup(doc->pool, cur->value);
3985 css_property_t *wap_marquee_style_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-style");
3986 css_property_t *wap_marquee_dir_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-dir");
3987 css_property_t *wap_marquee_loop_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-loop");
3988 for (cur = wap_marquee_style_prop->next; cur != wap_marquee_style_prop; cur = cur->next) {
3989 if (STRCASEEQ('s','S',"scroll", cur->value) || STRCASEEQ('s','S',"slide",cur->value) || STRCASEEQ('a','A',"alternate",cur->value)) {
3990 attr_wap_marquee_style = apr_pstrdup(doc->pool, cur->value);
3993 for (cur = wap_marquee_dir_prop->next; cur != wap_marquee_dir_prop; cur = cur->next) {
3994 if (STRCASEEQ('l','L',"ltr",cur->value)) {
3995 attr_wap_marquee_dir = apr_pstrdup(doc->pool, cur->value);
3997 else if (STRCASEEQ('r','R',"rtl",cur->value)) {
3998 attr_wap_marquee_dir = apr_pstrdup(doc->pool, cur->value);
4001 for (cur = wap_marquee_loop_prop->next; cur != wap_marquee_loop_prop; cur = cur->next) {
4002 if(strcmp(cur->value,"0") == 0 || strcmp(cur->value,"-1") == 0){
4003 attr_wap_marquee_loop = "infinite";
4006 attr_wap_marquee_loop = apr_pstrdup(doc->pool, cur->value);
4010 for (cur = clear_prop->next; cur != clear_prop; cur = cur->next) {
4011 css_clear = apr_pstrdup(doc->pool, cur->value);
4019 || attr_wap_marquee_style
4020 || attr_wap_marquee_dir
4021 || attr_wap_marquee_loop
4037 if (attr_decoration) {
4038 W_L("text-decoration:");
4039 W_V(attr_decoration);
4042 if (attr_wap_marquee_style) {
4043 W_L("-wap-marquee-style:");
4044 W_V(attr_wap_marquee_style);
4047 if (attr_wap_marquee_dir) {
4048 W_L("-wap-marquee-dir:");
4049 W_V(attr_wap_marquee_dir);
4052 if (attr_wap_marquee_loop) {
4053 W_L("-wap-marquee-loop:");
4054 W_V(attr_wap_marquee_loop);
4063 W_L("background-color:");
4067 if (attr_font_size) {
4069 W_V(attr_font_size);
4085 * It is a handler who processes the DIV tag.
4087 * @param pdoc [i/o] The pointer to the XHTML structure at the output
4088 * destination is specified.
4089 * @param node [i] The DIV tag node is specified.
4090 * @return The conversion result is returned.
4093 s_xhtml_1_0_end_div_tag(void *pdoc, Node *UNUSED(child))
4095 xhtml_t *xhtml = GET_XHTML(pdoc);
4096 Doc *doc = xhtml->doc;
4098 if (IS_CSS_ON(xhtml->entryp)) {
4099 chxj_css_pop_prop_list(xhtml->css_prop_stack);
4106 * It is a handler who processes the B tag.
4108 * @param pdoc [i/o] The pointer to the XHTML structure at the output
4109 * destination is specified.
4110 * @param node [i] The B tag node is specified.
4111 * @return The conversion result is returned.
4114 s_xhtml_1_0_start_b_tag(void *pdoc, Node *UNUSED(child))
4116 xhtml_t *xhtml = GET_XHTML(pdoc);
4117 Doc *doc = xhtml->doc;
4119 W_L("<div style=\"font-weight:bold\">");
4125 * It is a handler who processes the B tag.
4127 * @param pdoc [i/o] The pointer to the XHTML structure at the output
4128 * destination is specified.
4129 * @param node [i] The B tag node is specified.
4130 * @return The conversion result is returned.
4133 s_xhtml_1_0_end_b_tag(void *pdoc, Node *UNUSED(child))
4135 xhtml_t *xhtml = GET_XHTML(pdoc);
4136 Doc *doc = xhtml->doc;
4144 * It is a handler who processes the CHXJ:IF tag.
4146 * @param pdoc [i/o] The pointer to the XHTML structure at the output
4147 * destination is specified.
4148 * @param node [i] The CHXJ:IF tag node is specified.
4151 s_xhtml_1_0_chxjif_tag(void *pdoc, Node *node)
4153 xhtml_t *xhtml = GET_XHTML(pdoc);
4154 Doc *doc = xhtml->doc;
4157 for (child = qs_get_child_node(doc, node);
4159 child = qs_get_next_node(doc, child)) {
4161 s_xhtml_1_0_chxjif_tag(xhtml, child);
4169 * It is a handler who processes the TEXTARE tag.
4171 * @param pdoc [i/o] The pointer to the CHTML structure at the output
4172 * destination is specified.
4173 * @param node [i] The TEXTAREA tag node is specified.
4174 * @return The conversion result is returned.
4177 s_xhtml_1_0_start_textarea_tag(void *pdoc, Node *node)
4179 xhtml_t *xhtml = GET_XHTML(pdoc);
4180 Doc *doc = xhtml->doc;
4182 char *attr_accesskey = NULL;
4183 char *attr_name = NULL;
4184 char *attr_rows = NULL;
4185 char *attr_cols = NULL;
4186 char *attr_istyle = NULL;
4187 char *attr_style = NULL;
4189 xhtml->textarea_flag++;
4190 for (attr = qs_get_attr(doc,node);
4192 attr = qs_get_next_attr(doc,attr)) {
4193 char *name = qs_get_attr_name(doc,attr);
4194 char *value = qs_get_attr_value(doc,attr);
4195 if (STRCASEEQ('n','N',"name",name) && value && *value) {
4198 else if (STRCASEEQ('r','R',"rows",name) && value && *value) {
4201 else if (STRCASEEQ('c','C',"cols",name) && value && *value) {
4204 else if (STRCASEEQ('i','I',"istyle", name) && value && (*value == '1' || *value == '2' || *value == '3' || *value == '4')) {
4205 attr_istyle = value;
4207 char *fmt = qs_conv_istyle_to_format(doc->r->pool,value);
4213 else if (STRCASEEQ('a','A',"accesskey",name) && value && *value != 0) {
4214 attr_accesskey = value;
4216 else if (STRCASEEQ('s','S',"style",name) && value && *value != 0) {
4220 if (IS_CSS_ON(xhtml->entryp)) {
4221 css_prop_list_t *style = s_xhtml_1_0_nopush_and_get_now_style(pdoc, node, attr_style);
4223 css_property_t *wap_input_format = chxj_css_get_property_value(doc, style, "-wap-input-format");
4224 css_property_t *cur;
4225 for (cur = wap_input_format->next; cur != wap_input_format; cur = cur->next) {
4226 if (strcasestr(cur->value, "<ja:n>")) {
4229 else if (strcasestr(cur->value, "<ja:en>")) {
4232 else if (strcasestr(cur->value, "<ja:hk>")) {
4235 else if (strcasestr(cur->value, "<ja:h>")) {
4242 if (attr_accesskey) {
4243 W_L(" accesskey=\"");
4244 W_V(attr_accesskey);
4263 char *fmt = qs_conv_istyle_to_format(doc->r->pool, attr_istyle);
4274 * It is a handler who processes the TEXTAREA tag.
4276 * @param pdoc [i/o] The pointer to the CHTML structure at the output
4277 * destination is specified.
4278 * @param node [i] The TEXTAREA tag node is specified.
4279 * @return The conversion result is returned.
4282 s_xhtml_1_0_end_textarea_tag(void *pdoc, Node *UNUSED(child))
4284 xhtml_t *xhtml = GET_XHTML(pdoc);
4285 Doc *doc = xhtml->doc;
4288 xhtml->textarea_flag--;
4294 s_xhtml_1_0_text_tag(void *pdoc, Node *child)
4296 xhtml_t *xhtml = GET_XHTML(pdoc);
4297 Doc *doc = xhtml->doc;
4298 request_rec *r = doc->r;
4305 apr_size_t z2h_input_len;
4307 textval = qs_get_node_value(doc,child);
4308 if (strlen(textval) == 0) {
4312 tmp = apr_palloc(r->pool, qs_get_node_size(doc,child)+1);
4313 memset(tmp, 0, qs_get_node_size(doc,child)+1);
4315 tdst = qs_alloc_zero_byte_string(doc->buf.pool);
4316 memset(one_byte, 0, sizeof(one_byte));
4319 for (ii=0; ii<qs_get_node_size(doc,child); ii++) {
4321 int rtn = s_xhtml_search_emoji(xhtml, &textval[ii], &out);
4323 DBG(r,"[%s][%d]", out, rtn);
4324 tdst = qs_out_apr_pstrcat(r, tdst, out, &tdst_len);
4328 if (is_sjis_kanji(textval[ii])) {
4329 one_byte[0] = textval[ii+0];
4330 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
4331 one_byte[0] = textval[ii+1];
4332 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
4335 else if (xhtml->pre_flag) {
4336 one_byte[0] = textval[ii+0];
4337 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
4339 else if (xhtml->textarea_flag) {
4340 one_byte[0] = textval[ii+0];
4341 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
4343 else if (textval[ii] != '\r' && textval[ii] != '\n') {
4344 one_byte[0] = textval[ii+0];
4345 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
4348 z2h_input_len = strlen(tdst);
4349 tdst = chxj_conv_z2h(r, tdst, &z2h_input_len, xhtml->entryp);
4357 * It is a handler who processes the BLOCKQUOTE tag.
4359 * @param pdoc [i/o] The pointer to the XHTML structure at the output
4360 * destination is specified.
4361 * @param node [i] The BLOCKQUOTE tag node is specified.
4362 * @return The conversion result is returned.
4365 s_xhtml_1_0_start_blockquote_tag(void *pdoc, Node *node)
4370 char *attr_style = NULL;
4371 char *attr_color = NULL;
4372 char *attr_size = NULL;
4374 xhtml = GET_XHTML(pdoc);
4376 for (attr = qs_get_attr(doc,node);
4378 attr = qs_get_next_attr(doc,attr)) {
4379 char *nm = qs_get_attr_name(doc,attr);
4380 char *val = qs_get_attr_value(doc,attr);
4381 if (val && STRCASEEQ('s','S',"style", nm)) {
4385 if (IS_CSS_ON(xhtml->entryp)) {
4386 css_prop_list_t *style = s_xhtml_1_0_push_and_get_now_style(pdoc, node, attr_style);
4388 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
4389 css_property_t *font_size_prop = chxj_css_get_property_value(doc, style, "font-size");
4390 css_property_t *cur;
4391 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
4392 if (cur->value && *cur->value) {
4393 attr_color = apr_pstrdup(doc->pool, cur->value);
4396 for (cur = font_size_prop->next; cur != font_size_prop; cur = cur->next) {
4397 if (cur->value && *cur->value) {
4398 if (STRCASEEQ('x','X',"xx-small",cur->value)) {
4399 attr_size = apr_pstrdup(doc->pool, cur->value);
4401 else if (STRCASEEQ('x','X',"x-small",cur->value)) {
4402 attr_size = apr_pstrdup(doc->pool, cur->value);
4404 else if (STRCASEEQ('s','S',"small",cur->value)) {
4405 attr_size = apr_pstrdup(doc->pool, cur->value);
4407 else if (STRCASEEQ('m','M',"medium",cur->value)) {
4408 attr_size = apr_pstrdup(doc->pool, cur->value);
4410 else if (STRCASEEQ('l','L',"large",cur->value)) {
4411 attr_size = apr_pstrdup(doc->pool, cur->value);
4413 else if (STRCASEEQ('x','X',"x-large",cur->value)) {
4414 attr_size = apr_pstrdup(doc->pool, cur->value);
4416 else if (STRCASEEQ('x','X',"xx-large",cur->value)) {
4417 attr_size = apr_pstrdup(doc->pool, cur->value);
4424 if (attr_color || attr_size) {
4427 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
4445 * It is a handler who processes the BLOCKQUOTE tag.
4447 * @param pdoc [i/o] The pointer to the XHTML structure at the output
4448 * destination is specified.
4449 * @param node [i] The BLOCKQUOTE tag node is specified.
4450 * @return The conversion result is returned.
4453 s_xhtml_1_0_end_blockquote_tag(void *pdoc, Node *UNUSED(child))
4455 xhtml_t *xhtml = GET_XHTML(pdoc);
4456 Doc *doc = xhtml->doc;
4457 W_L("</blockquote>");
4458 if (IS_CSS_ON(xhtml->entryp)) {
4459 chxj_css_pop_prop_list(xhtml->css_prop_stack);
4466 * It is a handler who processes the DIR tag.
4468 * @param pdoc [i/o] The pointer to the XHTML structure at the output
4469 * destination is specified.
4470 * @param node [i] The DIR tag node is specified.
4471 * @return The conversion result is returned.
4474 s_xhtml_1_0_start_dir_tag(void *pdoc, Node *node)
4476 xhtml_t *xhtml = GET_XHTML(pdoc);
4477 Doc *doc = xhtml->doc;
4479 char *attr_style = NULL;
4480 char *attr_color = NULL;
4481 char *attr_type = NULL;
4482 char *attr_size = NULL;
4483 for (attr = qs_get_attr(doc,node);
4485 attr = qs_get_next_attr(doc,attr)) {
4486 char *name = qs_get_attr_name(doc,attr);
4487 char *value = qs_get_attr_value(doc,attr);
4488 if (STRCASEEQ('t','T',"type",name)) {
4489 if (value && (STRCASEEQ('d','D',"disc",value) || STRCASEEQ('c','C',"circle",value) || STRCASEEQ('s','S',"square",value))) {
4493 else if (STRCASEEQ('s','S',"style", name) && value && *value) {
4497 if (IS_CSS_ON(xhtml->entryp)) {
4498 css_prop_list_t *style = s_xhtml_1_0_push_and_get_now_style(pdoc, node, attr_style);
4500 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
4501 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
4502 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "list-style-type");
4503 css_property_t *cur;
4504 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
4505 if (cur->value && *cur->value) {
4506 attr_color = apr_pstrdup(doc->pool, cur->value);
4509 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
4510 if (cur->value && *cur->value) {
4511 attr_type = apr_pstrdup(doc->pool, cur->value);
4514 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
4515 if (cur->value && *cur->value) {
4516 if (STRCASEEQ('x','X',"xx-small",cur->value)) {
4517 attr_size = apr_pstrdup(doc->pool, cur->value);
4519 else if (STRCASEEQ('x','X',"x-small",cur->value)) {
4520 attr_size = apr_pstrdup(doc->pool, cur->value);
4522 else if (STRCASEEQ('s','S',"small",cur->value)) {
4523 attr_size = apr_pstrdup(doc->pool, cur->value);
4525 else if (STRCASEEQ('m','M',"medium",cur->value)) {
4526 attr_size = apr_pstrdup(doc->pool, cur->value);
4528 else if (STRCASEEQ('l','L',"large",cur->value)) {
4529 attr_size = apr_pstrdup(doc->pool, cur->value);
4531 else if (STRCASEEQ('x','X',"x-large",cur->value)) {
4532 attr_size = apr_pstrdup(doc->pool, cur->value);
4534 else if (STRCASEEQ('x','X',"xx-large",cur->value)) {
4535 attr_size = apr_pstrdup(doc->pool, cur->value);
4542 if (attr_type || attr_color || attr_size) {
4545 W_L("list-style-type:");
4550 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
4568 * It is a handler who processes the DIR tag.
4570 * @param pdoc [i/o] The pointer to the XHTML structure at the output
4571 * destination is specified.
4572 * @param node [i] The DIR tag node is specified.
4573 * @return The conversion result is returned.
4576 s_xhtml_1_0_end_dir_tag(void *pdoc, Node *UNUSED(child))
4578 xhtml_t *xhtml = GET_XHTML(pdoc);
4579 Doc *doc = xhtml->doc;
4581 if (IS_CSS_ON(xhtml->entryp)) {
4582 chxj_css_pop_prop_list(xhtml->css_prop_stack);
4589 * It is a handler who processes the DL tag.
4591 * @param pdoc [i/o] The pointer to the XHTML structure at the output
4592 * destination is specified.
4593 * @param node [i] The DL tag node is specified.
4594 * @return The conversion result is returned.
4597 s_xhtml_1_0_start_dl_tag(void *pdoc, Node *node)
4599 xhtml_t *xhtml = GET_XHTML(pdoc);
4600 Doc *doc = xhtml->doc;
4602 char *attr_style = NULL;
4603 char *attr_color = NULL;
4604 char *attr_size = NULL;
4606 for (attr = qs_get_attr(doc,node);
4608 attr = qs_get_next_attr(doc,attr)) {
4609 char *name = qs_get_attr_name(doc,attr);
4610 char *value = qs_get_attr_value(doc,attr);
4611 if (STRCASEEQ('s','S',"style", name) && value && *value) {
4615 if (IS_CSS_ON(xhtml->entryp)) {
4616 css_prop_list_t *style = s_xhtml_1_0_push_and_get_now_style(pdoc, node, attr_style);
4618 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
4619 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
4620 css_property_t *cur;
4621 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
4622 if (cur->value && *cur->value) {
4623 attr_color = apr_pstrdup(doc->pool, cur->value);
4626 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
4627 if (cur->value && *cur->value) {
4628 if (STRCASEEQ('x','X',"xx-small",cur->value)) {
4629 attr_size = apr_pstrdup(doc->pool, cur->value);
4631 else if (STRCASEEQ('x','X',"x-small",cur->value)) {
4632 attr_size = apr_pstrdup(doc->pool, cur->value);
4634 else if (STRCASEEQ('s','S',"small",cur->value)) {
4635 attr_size = apr_pstrdup(doc->pool, cur->value);
4637 else if (STRCASEEQ('m','M',"medium",cur->value)) {
4638 attr_size = apr_pstrdup(doc->pool, cur->value);
4640 else if (STRCASEEQ('l','L',"large",cur->value)) {
4641 attr_size = apr_pstrdup(doc->pool, cur->value);
4643 else if (STRCASEEQ('x','X',"x-large",cur->value)) {
4644 attr_size = apr_pstrdup(doc->pool, cur->value);
4646 else if (STRCASEEQ('x','X',"xx-large",cur->value)) {
4647 attr_size = apr_pstrdup(doc->pool, cur->value);
4654 if (attr_color || attr_size) {
4657 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
4675 * It is a handler who processes the DL tag.
4677 * @param pdoc [i/o] The pointer to the XHTML structure at the output
4678 * destination is specified.
4679 * @param node [i] The DL tag node is specified.
4680 * @return The conversion result is returned.
4683 s_xhtml_1_0_end_dl_tag(void *pdoc, Node *UNUSED(child))
4685 xhtml_t *xhtml = GET_XHTML(pdoc);
4686 Doc *doc = xhtml->doc;
4688 if (IS_CSS_ON(xhtml->entryp)) {
4689 chxj_css_pop_prop_list(xhtml->css_prop_stack);
4696 * It is a handter who processes the DT tag.
4698 * @param pdoc [i/o] The pointer to the XHTML structure at the output
4699 * destination is specified.
4700 * @param node [i] The DT tag node is specified.
4701 * @return The conversion result is returned.
4704 s_xhtml_1_0_start_dt_tag(void *pdoc, Node *node)
4706 xhtml_t *xhtml = GET_XHTML(pdoc);
4707 Doc *doc = xhtml->doc;
4709 char *attr_style = NULL;
4710 char *attr_color = NULL;
4711 char *attr_size = NULL;
4713 for (attr = qs_get_attr(doc,node);
4715 attr = qs_get_next_attr(doc,attr)) {
4716 char *name = qs_get_attr_name(doc,attr);
4717 char *value = qs_get_attr_value(doc,attr);
4718 if (STRCASEEQ('s','S',"style", name) && value && *value) {
4722 if (IS_CSS_ON(xhtml->entryp)) {
4723 css_prop_list_t *style = s_xhtml_1_0_push_and_get_now_style(pdoc, node, attr_style);
4725 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
4726 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
4727 css_property_t *cur;
4728 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
4729 if (cur->value && *cur->value) {
4730 attr_color = apr_pstrdup(doc->pool, cur->value);
4733 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
4734 if (cur->value && *cur->value) {
4735 if (STRCASEEQ('x','X',"xx-small",cur->value)) {
4736 attr_size = apr_pstrdup(doc->pool, cur->value);
4738 else if (STRCASEEQ('x','X',"x-small",cur->value)) {
4739 attr_size = apr_pstrdup(doc->pool, cur->value);
4741 else if (STRCASEEQ('s','S',"small",cur->value)) {
4742 attr_size = apr_pstrdup(doc->pool, cur->value);
4744 else if (STRCASEEQ('m','M',"medium",cur->value)) {
4745 attr_size = apr_pstrdup(doc->pool, cur->value);
4747 else if (STRCASEEQ('l','L',"large",cur->value)) {
4748 attr_size = apr_pstrdup(doc->pool, cur->value);
4750 else if (STRCASEEQ('x','X',"x-large",cur->value)) {
4751 attr_size = apr_pstrdup(doc->pool, cur->value);
4753 else if (STRCASEEQ('x','X',"xx-large",cur->value)) {
4754 attr_size = apr_pstrdup(doc->pool, cur->value);
4761 if (attr_color || attr_size) {
4764 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
4782 * It is a handter who processes the DT tag.
4784 * @param pdoc [i/o] The pointer to the XHTML structure at the output
4785 * destination is specified.
4786 * @param node [i] The DT tag node is specified.
4787 * @return The conversion result is returned.
4790 s_xhtml_1_0_end_dt_tag(void *pdoc, Node *UNUSED(child))
4792 xhtml_t *xhtml = GET_XHTML(pdoc);
4793 Doc *doc = xhtml->doc;
4795 if (IS_CSS_ON(xhtml->entryp)) {
4796 chxj_css_pop_prop_list(xhtml->css_prop_stack);
4803 * It is a handder who processes the DD tag.
4805 * @param pdoc [i/o] The pointer to the XHTML structure at the output
4806 * destination is specified.
4807 * @param node [i] The DD tag node is specified.
4808 * @return The conversion result is returned.
4811 s_xhtml_1_0_start_dd_tag(void *pdoc, Node *node)
4813 xhtml_t *xhtml = GET_XHTML(pdoc);
4814 Doc *doc = xhtml->doc;
4816 char *attr_style = NULL;
4817 char *attr_color = NULL;
4818 char *attr_size = NULL;
4820 for (attr = qs_get_attr(doc,node);
4822 attr = qs_get_next_attr(doc,attr)) {
4823 char *name = qs_get_attr_name(doc,attr);
4824 char *value = qs_get_attr_value(doc,attr);
4825 if (STRCASEEQ('s','S',"style", name) && value && *value) {
4829 if (IS_CSS_ON(xhtml->entryp)) {
4830 css_prop_list_t *style = s_xhtml_1_0_push_and_get_now_style(pdoc, node, attr_style);
4832 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
4833 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
4834 css_property_t *cur;
4835 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
4836 if (cur->value && *cur->value) {
4837 attr_color = apr_pstrdup(doc->pool, cur->value);
4840 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
4841 if (cur->value && *cur->value) {
4842 if (STRCASEEQ('x','X',"xx-small",cur->value)) {
4843 attr_size = apr_pstrdup(doc->pool, cur->value);
4845 else if (STRCASEEQ('x','X',"x-small",cur->value)) {
4846 attr_size = apr_pstrdup(doc->pool, cur->value);
4848 else if (STRCASEEQ('s','S',"small",cur->value)) {
4849 attr_size = apr_pstrdup(doc->pool, cur->value);
4851 else if (STRCASEEQ('m','M',"medium",cur->value)) {
4852 attr_size = apr_pstrdup(doc->pool, cur->value);
4854 else if (STRCASEEQ('l','L',"large",cur->value)) {
4855 attr_size = apr_pstrdup(doc->pool, cur->value);
4857 else if (STRCASEEQ('x','X',"x-large",cur->value)) {
4858 attr_size = apr_pstrdup(doc->pool, cur->value);
4860 else if (STRCASEEQ('x','X',"xx-large",cur->value)) {
4861 attr_size = apr_pstrdup(doc->pool, cur->value);
4868 if (attr_color || attr_size) {
4871 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
4889 * It is a handler who processes the DD tag.
4891 * @param pdoc [i/o] The pointer to the XHTML structure at the output
4892 * destination is specified.
4893 * @param node [i] The DD tag node is specified.
4894 * @return The conversion result is returned.
4897 s_xhtml_1_0_end_dd_tag(void *pdoc, Node *UNUSED(child))
4899 xhtml_t *xhtml = GET_XHTML(pdoc);
4900 Doc *doc = xhtml->doc;
4902 if (IS_CSS_ON(xhtml->entryp)) {
4903 chxj_css_pop_prop_list(xhtml->css_prop_stack);
4910 * It is a handler who processes the MENU tag.
4912 * @param pdoc [i/o] The pointer to the XHTML structure at the output
4913 * destination is specified.
4914 * @param node [i] The MENU tag node is specified.
4915 * @return The conversion result is returned.
4918 s_xhtml_1_0_start_menu_tag(void *pdoc, Node *node)
4920 xhtml_t *xhtml = GET_XHTML(pdoc);
4921 Doc *doc = xhtml->doc;
4923 char *attr_style = NULL;
4924 char *attr_color = NULL;
4925 char *attr_type = NULL;
4926 char *attr_size = NULL;
4927 for (attr = qs_get_attr(doc,node);
4929 attr = qs_get_next_attr(doc,attr)) {
4930 char *name = qs_get_attr_name(doc,attr);
4931 char *value = qs_get_attr_value(doc,attr);
4932 if (STRCASEEQ('t','T',"type",name)) {
4933 if (value && (STRCASEEQ('d','D',"disc",value) || STRCASEEQ('c','C',"circle",value) || STRCASEEQ('s','S',"square",value))) {
4937 else if (STRCASEEQ('s','S',"style", name) && value && *value) {
4941 if (IS_CSS_ON(xhtml->entryp)) {
4942 css_prop_list_t *style = s_xhtml_1_0_push_and_get_now_style(pdoc, node, attr_style);
4944 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
4945 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
4946 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "list-style-type");
4947 css_property_t *cur;
4948 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
4949 if (cur->value && *cur->value) {
4950 attr_color = apr_pstrdup(doc->pool, cur->value);
4953 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
4954 if (cur->value && *cur->value) {
4955 attr_type = apr_pstrdup(doc->pool, cur->value);
4958 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
4959 if (cur->value && *cur->value) {
4960 if (STRCASEEQ('x','X',"xx-small",cur->value)) {
4961 attr_size = apr_pstrdup(doc->pool, cur->value);
4963 else if (STRCASEEQ('x','X',"x-small",cur->value)) {
4964 attr_size = apr_pstrdup(doc->pool, cur->value);
4966 else if (STRCASEEQ('s','S',"small",cur->value)) {
4967 attr_size = apr_pstrdup(doc->pool, cur->value);
4969 else if (STRCASEEQ('m','M',"medium",cur->value)) {
4970 attr_size = apr_pstrdup(doc->pool, cur->value);
4972 else if (STRCASEEQ('l','L',"large",cur->value)) {
4973 attr_size = apr_pstrdup(doc->pool, cur->value);
4975 else if (STRCASEEQ('x','X',"x-large",cur->value)) {
4976 attr_size = apr_pstrdup(doc->pool, cur->value);
4978 else if (STRCASEEQ('x','X',"xx-large",cur->value)) {
4979 attr_size = apr_pstrdup(doc->pool, cur->value);
4986 if (attr_type || attr_color || attr_size) {
4989 W_L("list-style-type:");
4994 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
5012 * It is a hanmenuer who processes the MENU tag.
5014 * @param pdoc [i/o] The pointer to the XHTML structure at the output
5015 * destination is specified.
5016 * @param node [i] The MENU tag node is specified.
5017 * @return The conversion result is returned.
5020 s_xhtml_1_0_end_menu_tag(void *pdoc, Node *UNUSED(child))
5022 xhtml_t *xhtml = GET_XHTML(pdoc);
5023 Doc *doc = xhtml->doc;
5025 if (IS_CSS_ON(xhtml->entryp)) {
5026 chxj_css_pop_prop_list(xhtml->css_prop_stack);
5033 * It is a handler who processes the PLAINTEXT tag.
5035 * @param pdoc [i/o] The pointer to the XHTML structure at the output
5036 * destination is specified.
5037 * @param node [i] The PLAINTEXT tag node is specified.
5038 * @return The conversion result is returned.
5041 s_xhtml_1_0_start_plaintext_tag(void *pdoc, Node *node)
5043 xhtml_t *xhtml = GET_XHTML(pdoc);
5044 Doc *doc = xhtml->doc;
5046 s_xhtml_1_0_start_plaintext_tag_inner(pdoc,node);
5051 s_xhtml_1_0_start_plaintext_tag_inner(void *pdoc, Node *node)
5053 xhtml_t *xhtml = GET_XHTML(pdoc);
5054 Doc *doc = xhtml->doc;
5056 for (child = qs_get_child_node(doc, node);
5058 child = qs_get_next_node(doc, child)) {
5060 s_xhtml_1_0_start_plaintext_tag_inner(pdoc, child);
5067 * It is a handler who processes the PLAINTEXT tag.
5069 * @param pdoc [i/o] The pointer to the XHTML structure at the output
5070 * destination is specified.
5071 * @param node [i] The PLAINTEXT tag node is specified.
5072 * @return The conversion result is returned.
5075 s_xhtml_1_0_end_plaintext_tag(void *pdoc, Node *UNUSED(child))
5077 xhtml_t *xhtml = GET_XHTML(pdoc);
5078 Doc *doc = xhtml->doc;
5079 W_L("</plaintext>");
5085 * It is a handler who processes the BLINK tag.
5087 * @param pdoc [i/o] The pointer to the XHTML structure at the output
5088 * destination is specified.
5089 * @param node [i] The BLINK tag node is specified.
5090 * @return The conversion result is returned.
5093 s_xhtml_1_0_start_blink_tag(void *pdoc, Node *node)
5095 xhtml_t *xhtml = GET_XHTML(pdoc);
5096 Doc *doc = xhtml->doc;
5098 char *attr_style = NULL;
5099 char *attr_color = NULL;
5100 char *attr_size = NULL;
5102 for (attr = qs_get_attr(doc,node);
5104 attr = qs_get_next_attr(doc,attr)) {
5105 char *name = qs_get_attr_name(doc,attr);
5106 char *value = qs_get_attr_value(doc,attr);
5107 if (STRCASEEQ('s','S',"style", name) && value && *value) {
5111 if (IS_CSS_ON(xhtml->entryp)) {
5112 css_prop_list_t *style = s_xhtml_1_0_push_and_get_now_style(pdoc, node, attr_style);
5114 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
5115 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
5116 css_property_t *cur;
5117 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
5118 if (cur->value && *cur->value) {
5119 attr_color = apr_pstrdup(doc->pool, cur->value);
5122 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
5123 if (cur->value && *cur->value) {
5124 if (STRCASEEQ('x','X',"xx-small",cur->value)) {
5125 attr_size = apr_pstrdup(doc->pool, cur->value);
5127 else if (STRCASEEQ('x','X',"x-small",cur->value)) {
5128 attr_size = apr_pstrdup(doc->pool, cur->value);
5130 else if (STRCASEEQ('s','S',"small",cur->value)) {
5131 attr_size = apr_pstrdup(doc->pool, cur->value);
5133 else if (STRCASEEQ('m','M',"medium",cur->value)) {
5134 attr_size = apr_pstrdup(doc->pool, cur->value);
5136 else if (STRCASEEQ('l','L',"large",cur->value)) {
5137 attr_size = apr_pstrdup(doc->pool, cur->value);
5139 else if (STRCASEEQ('x','X',"x-large",cur->value)) {
5140 attr_size = apr_pstrdup(doc->pool, cur->value);
5142 else if (STRCASEEQ('x','X',"xx-large",cur->value)) {
5143 attr_size = apr_pstrdup(doc->pool, cur->value);
5150 if (attr_color || attr_size) {
5153 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
5171 * It is a handler who processes the BLINK tag.
5173 * @param pdoc [i/o] The pointer to the XHTML structure at the output
5174 * destination is specified.
5175 * @param node [i] The BLINK tag node is specified.
5176 * @return The conversion result is returned.
5179 s_xhtml_1_0_end_blink_tag(void *pdoc, Node *UNUSED(node))
5181 xhtml_t *xhtml = GET_XHTML(pdoc);
5182 Doc *doc = xhtml->doc;
5184 if (IS_CSS_ON(xhtml->entryp)) {
5185 chxj_css_pop_prop_list(xhtml->css_prop_stack);
5192 * It is a handler who processes the MARQUEE tag.
5194 * @param pdoc [i/o] The pointer to the XHTML structure at the output
5195 * destination is specified.
5196 * @param node [i] The MARQUEE tag node is specified.
5197 * @return The conversion result is returned.
5200 s_xhtml_1_0_start_marquee_tag(void *pdoc, Node *node)
5202 xhtml_t *xhtml = GET_XHTML(pdoc);
5203 Doc *doc = xhtml->doc;
5205 char *attr_direction = NULL;
5206 char *attr_behavior = NULL;
5207 char *attr_loop = NULL;
5208 char *attr_style = NULL;
5209 char *attr_color = NULL;
5210 char *attr_size = NULL;
5211 char *attr_bgcolor = NULL;
5212 /*--------------------------------------------------------------------------*/
5213 /* Get Attributes */
5214 /*--------------------------------------------------------------------------*/
5215 for (attr = qs_get_attr(doc,node);
5217 attr = qs_get_next_attr(doc,attr)) {
5218 char *name = qs_get_attr_name(doc,attr);
5219 char *value = qs_get_attr_value(doc,attr);
5220 if (STRCASEEQ('d','D',"direction", name)) {
5222 if (STRCASEEQ('l','L',"left",value)) {
5223 attr_direction = "rtl";
5225 else if (STRCASEEQ('r','R',"right",value)) {
5226 attr_direction = "ltr";
5230 else if (STRCASEEQ('b','B',"behavior",name) && value && *value) {
5231 if (STRCASEEQ('s','S',"scroll",value) || STRCASEEQ('s','S',"slide",value) || STRCASEEQ('a','A',"alternate",value)) {
5232 attr_behavior = value;
5235 else if (STRCASEEQ('l','L',"loop",name) && value && *value) {
5238 else if (STRCASEEQ('b','B',"bgcolor",name)) {
5239 if (value && *value) {
5240 attr_bgcolor = value;
5243 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
5247 if (IS_CSS_ON(xhtml->entryp)) {
5248 css_prop_list_t *style = s_xhtml_1_0_push_and_get_now_style(pdoc, node, attr_style);
5250 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
5251 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
5252 css_property_t *bgcolor_prop = chxj_css_get_property_value(doc, style, "background-color");
5253 css_property_t *direction_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-dir");
5254 css_property_t *behavior_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-style");
5255 css_property_t *loop_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-loop");
5256 css_property_t *cur;
5257 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
5258 if (cur->value && *cur->value) {
5259 attr_color = apr_pstrdup(doc->pool, cur->value);
5262 for (cur = bgcolor_prop->next; cur != bgcolor_prop; cur = cur->next) {
5263 if (cur->value && *cur->value) {
5264 attr_bgcolor = apr_pstrdup(doc->pool, cur->value);
5267 for (cur = direction_prop->next; cur != direction_prop; cur = cur->next) {
5268 if (cur->value && *cur->value) {
5269 attr_direction = apr_pstrdup(doc->pool, cur->value);
5272 for (cur = behavior_prop->next; cur != behavior_prop; cur = cur->next) {
5273 if (cur->value && *cur->value) {
5274 if (STRCASEEQ('s','S',"scroll",cur->value) || STRCASEEQ('s','S',"slide",cur->value) || STRCASEEQ('a','A',"alternate",cur->value)) {
5275 attr_behavior = apr_pstrdup(doc->pool, cur->value);
5279 for (cur = loop_prop->next; cur != loop_prop; cur = cur->next) {
5280 if (cur->value && *cur->value) {
5281 attr_loop = apr_pstrdup(doc->pool, cur->value);
5284 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
5285 if (cur->value && *cur->value) {
5286 if (STRCASEEQ('x','X',"xx-small",cur->value)) {
5287 attr_size = apr_pstrdup(doc->pool, cur->value);
5289 else if (STRCASEEQ('x','X',"x-small",cur->value)) {
5290 attr_size = apr_pstrdup(doc->pool, cur->value);
5292 else if (STRCASEEQ('s','S',"small",cur->value)) {
5293 attr_size = apr_pstrdup(doc->pool, cur->value);
5295 else if (STRCASEEQ('m','M',"medium",cur->value)) {
5296 attr_size = apr_pstrdup(doc->pool, cur->value);
5298 else if (STRCASEEQ('l','L',"large",cur->value)) {
5299 attr_size = apr_pstrdup(doc->pool, cur->value);
5301 else if (STRCASEEQ('x','X',"x-large",cur->value)) {
5302 attr_size = apr_pstrdup(doc->pool, cur->value);
5304 else if (STRCASEEQ('x','X',"xx-large",cur->value)) {
5305 attr_size = apr_pstrdup(doc->pool, cur->value);
5312 if (attr_color || attr_size || attr_direction || attr_bgcolor || attr_behavior || attr_loop) {
5314 if (attr_direction) {
5315 W_L("-wap-marquee-dir:");
5316 W_V(attr_direction);
5319 if (attr_behavior) {
5320 W_L("-wap-marquee-style:");
5325 W_L("-wap-marquee-loop:");
5330 attr_bgcolor = chxj_css_rgb_func_to_value(doc->pool, attr_bgcolor);
5331 W_L("background-color:");
5336 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
5355 * It is a handler who processes the MARQUEE tag.
5357 * @param pdoc [i/o] The pointer to the XHTML structure at the output
5358 * destination is specified.
5359 * @param node [i] The MARQUEE tag node is specified.
5360 * @return The conversion result is returned.
5363 s_xhtml_1_0_end_marquee_tag(void *pdoc, Node *UNUSED(child))
5365 xhtml_t *xhtml = GET_XHTML(pdoc);
5366 Doc *doc = xhtml->doc;
5368 if (IS_CSS_ON(xhtml->entryp)) {
5369 chxj_css_pop_prop_list(xhtml->css_prop_stack);
5376 * It is handler who processes the New Line Code.
5379 s_xhtml_1_0_newline_mark(void *pdoc, Node *UNUSED(node))
5381 xhtml_t *xhtml = GET_XHTML(pdoc);
5382 Doc *doc = xhtml->doc;
5383 if (xhtml->start_html_flag) {
5391 * It is a handler who processes the LINK tag.
5393 * @param pdoc [i/o] The pointer to the CHTML structure at the output
5394 * destination is specified.
5395 * @param node [i] The LINK tag node is specified.
5396 * @return The conversion result is returned.
5399 s_xhtml_1_0_link_tag(void *pdoc, Node *node)
5408 xhtml = GET_XHTML(pdoc);
5411 if (! IS_CSS_ON(xhtml->entryp)) {
5415 for (attr = qs_get_attr(doc,node);
5417 attr = qs_get_next_attr(doc,attr)) {
5418 char *name = qs_get_attr_name(doc,attr);
5419 char *value = qs_get_attr_value(doc,attr);
5420 if (STRCASEEQ('r','R',"rel", name)) {
5421 if (value && *value && STRCASEEQ('s','S',"stylesheet", value)) {
5425 else if (STRCASEEQ('h','H',"href", name)) {
5426 if (value && *value) {
5430 else if (STRCASEEQ('t','T',"type", name)) {
5431 if (value && *value && STRCASEEQ('t','T',"text/css",value)) {
5437 if (rel && href && type) {
5438 DBG(doc->r, "start load CSS. url:[%s]", href);
5439 xhtml->style = chxj_css_parse_from_uri(doc->r, doc->pool, xhtml->style, href);
5440 DBG(doc->r, "end load CSS. url:[%s]", href);
5446 static css_prop_list_t *
5447 s_xhtml_1_0_push_and_get_now_style(void *pdoc, Node *node, const char *style_attr_value)
5449 xhtml_t *xhtml = GET_XHTML(pdoc);
5450 Doc *doc = xhtml->doc;
5451 css_prop_list_t *last_css = NULL;
5452 if (IS_CSS_ON(xhtml->entryp)) {
5453 css_prop_list_t *dup_css;
5454 css_selector_t *selector;
5456 last_css = chxj_css_get_last_prop_list(xhtml->css_prop_stack);
5457 dup_css = chxj_dup_css_prop_list(doc, last_css);
5458 selector = chxj_css_find_selector(doc, xhtml->style, node);
5460 chxj_css_prop_list_merge_property(doc, dup_css, selector);
5462 chxj_css_push_prop_list(xhtml->css_prop_stack, dup_css);
5463 last_css = chxj_css_get_last_prop_list(xhtml->css_prop_stack);
5465 if (style_attr_value) {
5466 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));
5468 chxj_css_prop_list_merge_property(doc, last_css, ssheet->selector_head.next);
5476 static css_prop_list_t *
5477 s_xhtml_1_0_nopush_and_get_now_style(void *pdoc, Node *node, const char *style_attr_value)
5479 xhtml_t *xhtml = GET_XHTML(pdoc);
5480 Doc *doc = xhtml->doc;
5481 css_prop_list_t *last_css = NULL;
5482 if (IS_CSS_ON(xhtml->entryp)) {
5483 css_prop_list_t *dup_css;
5484 css_selector_t *selector;
5486 last_css = chxj_css_get_last_prop_list(xhtml->css_prop_stack);
5487 dup_css = chxj_dup_css_prop_list(doc, last_css);
5488 selector = chxj_css_find_selector(doc, xhtml->style, node);
5490 chxj_css_prop_list_merge_property(doc, dup_css, selector);
5494 if (style_attr_value) {
5495 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));
5497 chxj_css_prop_list_merge_property(doc, last_css, ssheet->selector_head.next);
5506 * It is a handler who processes the SPAN tag.
5508 * @param pdoc [i/o] The pointer to the XHTML structure at the output
5509 * destination is specified.
5510 * @param node [i] The SPAN tag node is specified.
5511 * @return The conversion result is returned.
5514 s_xhtml_1_0_start_span_tag(void *pdoc, Node *node)
5519 char *attr_style = NULL;
5520 char *attr_color = NULL;
5521 char *attr_size = NULL;
5522 char *attr_align = NULL;
5523 char *attr_blink = NULL;
5524 char *attr_marquee = NULL;
5525 char *attr_marquee_dir = NULL;
5526 char *attr_marquee_style = NULL;
5527 char *attr_marquee_loop = NULL;
5528 char *css_bgcolor = NULL;
5530 xhtml = GET_XHTML(pdoc);
5533 for (attr = qs_get_attr(doc,node);
5535 attr = qs_get_next_attr(doc,attr)) {
5536 char *nm = qs_get_attr_name(doc,attr);
5537 char *val = qs_get_attr_value(doc,attr);
5538 if (val && STRCASEEQ('s','S',"style", nm)) {
5542 if (IS_CSS_ON(xhtml->entryp)) {
5543 css_prop_list_t *style = s_xhtml_1_0_push_and_get_now_style(pdoc, node, attr_style);
5545 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
5546 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
5547 css_property_t *text_align_prop = chxj_css_get_property_value(doc, style, "text-align");
5548 css_property_t *decoration_prop = chxj_css_get_property_value(doc, style, "text-decoration");
5549 css_property_t *display_prop = chxj_css_get_property_value(doc, style, "display");
5550 css_property_t *marquee_dir_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-dir");
5551 css_property_t *marquee_style_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-style");
5552 css_property_t *marquee_loop_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-loop");
5553 css_property_t *bgcolor_prop = chxj_css_get_property_value(doc, style, "background-color");
5555 css_property_t *cur;
5556 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
5557 attr_color = apr_pstrdup(doc->pool, cur->value);
5559 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
5560 if (cur->value && *cur->value) {
5561 if ( STRCASEEQ('x','X',"xx-small",cur->value)
5562 || STRCASEEQ('x','X',"x-small", cur->value)
5563 || STRCASEEQ('s','S',"small", cur->value)
5564 || STRCASEEQ('m','M',"medium", cur->value)
5565 || STRCASEEQ('l','L',"large", cur->value)
5566 || STRCASEEQ('x','X',"x-large", cur->value)
5567 || STRCASEEQ('x','X',"xx-large",cur->value)) {
5568 attr_size = apr_pstrdup(doc->pool, cur->value);
5572 for (cur = decoration_prop->next; cur != decoration_prop; cur = cur->next) {
5573 if (cur->value && STRCASEEQ('b','B',"blink",cur->value)) {
5574 attr_blink = apr_pstrdup(doc->pool, cur->value);
5577 for (cur = display_prop->next; cur != display_prop; cur = cur->next) {
5578 if (cur->value && strcasecmp("-wap-marquee",cur->value) == 0) {
5579 attr_marquee = apr_pstrdup(doc->pool, cur->value);
5582 for (cur = marquee_dir_prop->next; cur != marquee_dir_prop; cur = cur->next) {
5583 if (cur->value && *cur->value) {
5584 if ( STRCASEEQ('l','L',"ltr",cur->value)
5585 || STRCASEEQ('r','R',"rtl",cur->value)) {
5586 attr_marquee_dir = apr_pstrdup(doc->pool, cur->value);
5590 for (cur = marquee_style_prop->next; cur != marquee_style_prop; cur = cur->next) {
5591 if (cur->value && *cur->value) {
5592 if ( STRCASEEQ('s','S',"scroll",cur->value)
5593 || STRCASEEQ('s','S',"slide",cur->value)
5594 || STRCASEEQ('a','A',"alternate",cur->value)) {
5595 attr_marquee_style = apr_pstrdup(doc->pool, cur->value);
5599 for (cur = marquee_loop_prop->next; cur != marquee_loop_prop; cur = cur->next) {
5600 if (cur->value && *cur->value) {
5601 if(strcmp(cur->value,"0") == 0 || strcmp(cur->value,"-1") == 0){
5602 attr_marquee_loop = "infinite";
5605 attr_marquee_loop = apr_pstrdup(doc->pool, cur->value);
5609 for (cur = text_align_prop->next; cur != text_align_prop; cur = cur->next) {
5610 if (STRCASEEQ('l','L',"left", cur->value)) {
5611 attr_align = apr_pstrdup(doc->pool, "left");
5613 else if (STRCASEEQ('c','C',"center",cur->value)) {
5614 attr_align = apr_pstrdup(doc->pool, "center");
5616 else if (STRCASEEQ('r','R',"right",cur->value)) {
5617 attr_align = apr_pstrdup(doc->pool, "right");
5620 for (cur = bgcolor_prop->next; cur != bgcolor_prop; cur = cur->next) {
5621 if (cur->value && *cur->value) {
5622 css_bgcolor = apr_pstrdup(doc->pool, cur->value);
5629 if (attr_color || attr_size || attr_align || attr_blink || attr_marquee || css_bgcolor) {
5632 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
5648 W_L("text-decoration:");
5653 W_L("display:-wap-marquee;");
5654 if (attr_marquee_dir) {
5655 W_L("-wap-marquee-dir:");
5656 W_V(attr_marquee_dir);
5659 if (attr_marquee_style) {
5660 W_L("-wap-marquee-style:");
5661 W_V(attr_marquee_style);
5664 if (attr_marquee_loop) {
5665 W_L("-wap-marquee-loop:");
5666 W_V(attr_marquee_loop);
5671 W_L("background-color:");
5683 * It is a handler who processes the SPAN tag.
5685 * @param pdoc [i/o] The pointer to the XHTML structure at the output
5686 * destination is specified.
5687 * @param node [i] The SPAN tag node is specified.
5688 * @return The conversion result is returned.
5691 s_xhtml_1_0_end_span_tag(void *pdoc, Node *UNUSED(node))
5693 xhtml_t *xhtml = GET_XHTML(pdoc);
5694 Doc *doc = xhtml->doc;
5697 if (IS_CSS_ON(xhtml->entryp)) {
5698 chxj_css_pop_prop_list(xhtml->css_prop_stack);
5705 * It is a handler who processes the STYLE tag.
5707 * @param pdoc [i/o] The pointer to the XHTML structure at the output
5708 * destination is specified.
5709 * @param node [i] The STYLE tag node is specified.
5710 * @return The conversion result is returned.
5713 s_xhtml_1_0_style_tag(void *pdoc, Node *node)
5720 xhtml = GET_XHTML(pdoc);
5723 if (! IS_CSS_ON(xhtml->entryp)) {
5727 for (attr = qs_get_attr(doc,node);
5729 attr = qs_get_next_attr(doc,attr)) {
5730 char *name = qs_get_attr_name(doc,attr);
5731 char *value = qs_get_attr_value(doc,attr);
5732 if (STRCASEEQ('t','T',"type", name)) {
5733 if (value && *value && STRCASEEQ('t','T',"text/css",value)) {
5739 Node *child = qs_get_child_node(doc, node);
5740 if (type && child) {
5741 char *name = qs_get_node_name(doc, child);
5742 if (STRCASEEQ('t','T',"text", name)) {
5743 char *value = qs_get_node_value(doc, child);
5744 DBG(doc->r, "start load CSS. buf:[%s]", value);
5745 xhtml->style = chxj_css_parse_style_value(doc, xhtml->style, value);
5746 DBG(doc->r, "end load CSS. value:[%s]", value);