OSDN Git Service

* Changed Mode=WP action for iPhone/Android.
[modchxj/mod_chxj.git] / src / chxj_ixhtml10.c
1 /*
2  * Copyright (C) 2005-2011 Atsushi Konno All rights reserved.
3  * Copyright (C) 2005 QSDN,Inc. All rights reserved.
4  *
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
8  *
9  *     http://www.apache.org/licenses/LICENSE-2.0
10  *
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.
16  */
17 #include "chxj_ixhtml10.h"
18 #include "chxj_hdml.h"
19 #include "chxj_dump.h"
20 #include "chxj_img_conv.h"
21 #include "chxj_qr_code.h"
22 #include "chxj_encoding.h"
23 #include "chxj_url_encode.h"
24 #include "chxj_str_util.h"
25 #include "chxj_conv_z2h.h"
26 #include "chxj_header_inf.h"
27 #include "chxj_google.h"
28
29
30 #define GET_IXHTML10(X) ((ixhtml10_t *)(X))
31 #undef W_L
32 #undef W_V
33 #define W_L(X)          do { ixhtml10->out = BUFFERED_WRITE_LITERAL(ixhtml10->out, &doc->buf, (X)); } while(0)
34 #define W_V(X)          do { ixhtml10->out = (X) ? BUFFERED_WRITE_VALUE(ixhtml10->out, &doc->buf, (X))  \
35                                                : BUFFERED_WRITE_LITERAL(ixhtml10->out, &doc->buf, ""); } while(0)
36 #undef W_NLCODE
37 #define W_NLCODE()     do { char *nlcode = TO_NLCODE(ixhtml10->conf); W_V(nlcode); } while (0)
38
39 static char *s_ixhtml10_start_html_tag     (void *pdoc, Node *node);
40 static char *s_ixhtml10_end_html_tag       (void *pdoc, Node *node);
41 static char *s_ixhtml10_start_meta_tag     (void *pdoc, Node *node);
42 static char *s_ixhtml10_end_meta_tag       (void *pdoc, Node *node);
43 static char *s_ixhtml10_start_head_tag     (void *pdoc, Node *node);
44 static char *s_ixhtml10_end_head_tag       (void *pdoc, Node *node);
45 static char *s_ixhtml10_start_title_tag    (void *pdoc, Node *node);
46 static char *s_ixhtml10_end_title_tag      (void *pdoc, Node *node);
47 static char *s_ixhtml10_start_base_tag     (void *pdoc, Node *node);
48 static char *s_ixhtml10_end_base_tag       (void *pdoc, Node *node);
49 static char *s_ixhtml10_start_body_tag     (void *pdoc, Node *node);
50 static char *s_ixhtml10_end_body_tag       (void *pdoc, Node *node);
51 static char *s_ixhtml10_start_a_tag        (void *pdoc, Node *node);
52 static char *s_ixhtml10_end_a_tag          (void *pdoc, Node *node);
53 static char *s_ixhtml10_start_pre_tag      (void *pdoc, Node *node);
54 static char *s_ixhtml10_end_pre_tag        (void *pdoc, Node *node);
55 static char *s_ixhtml10_start_p_tag        (void *pdoc, Node *node);
56 static char *s_ixhtml10_end_p_tag          (void *pdoc, Node *node);
57 static char *s_ixhtml10_start_ul_tag       (void *pdoc, Node *node);
58 static char *s_ixhtml10_end_ul_tag         (void *pdoc, Node *node);
59 static char *s_ixhtml10_start_ol_tag       (void *pdoc, Node *node);
60 static char *s_ixhtml10_end_ol_tag         (void *pdoc, Node *node);
61 static char *s_ixhtml10_start_li_tag       (void *pdoc, Node *node);
62 static char *s_ixhtml10_end_li_tag         (void *pdoc, Node *node);
63 static char *s_ixhtml10_start_br_tag       (void *pdoc, Node *node);
64 static char *s_ixhtml10_end_br_tag         (void *pdoc, Node *node);
65 static char *s_ixhtml10_start_table_tag    (void *pdoc, Node *node);
66 static char *s_ixhtml10_end_table_tag      (void *pdoc, Node *node);
67 static char *s_ixhtml10_start_tr_tag       (void *pdoc, Node *node);
68 static char *s_ixhtml10_end_tr_tag         (void *pdoc, Node *node);
69 static char *s_ixhtml10_start_th_tag       (void *pdoc, Node *node);
70 static char *s_ixhtml10_end_th_tag         (void *pdoc, Node *node);
71 static char *s_ixhtml10_start_td_tag       (void *pdoc, Node *node);
72 static char *s_ixhtml10_end_td_tag         (void *pdoc, Node *node);
73 static char *s_ixhtml10_start_td_or_th_tag       (void *pdoc, Node *node,char *tagName);
74 static char *s_ixhtml10_end_td_or_th_tag         (void *pdoc, Node *node,char *tagName);
75 static char *s_ixhtml10_start_font_tag     (void *pdoc, Node *node);
76 static char *s_ixhtml10_end_font_tag       (void *pdoc, Node *node);
77 static char *s_ixhtml10_start_form_tag     (void *pdoc, Node *node);
78 static char *s_ixhtml10_end_form_tag       (void *pdoc, Node *node);
79 static char *s_ixhtml10_start_input_tag    (void *pdoc, Node *node);
80 static char *s_ixhtml10_end_input_tag      (void *pdoc, Node *node);
81 static char *s_ixhtml10_start_center_tag   (void *pdoc, Node *node);
82 static char *s_ixhtml10_end_center_tag     (void *pdoc, Node *node);
83 static char *s_ixhtml10_start_hr_tag       (void *pdoc, Node *node);
84 static char *s_ixhtml10_end_hr_tag         (void *pdoc, Node *node);
85 static char *s_ixhtml10_start_img_tag      (void *pdoc, Node *node);
86 static char *s_ixhtml10_end_img_tag        (void *pdoc, Node *node);
87 static char *s_ixhtml10_start_select_tag   (void *pdoc, Node *node);
88 static char *s_ixhtml10_end_select_tag     (void *pdoc, Node *node);
89 static char *s_ixhtml10_start_option_tag   (void *pdoc, Node *node);
90 static char *s_ixhtml10_end_option_tag     (void *pdoc, Node *node);
91 static char *s_ixhtml10_start_div_tag      (void *pdoc, Node *node);
92 static char *s_ixhtml10_end_div_tag        (void *pdoc, Node *node);
93 static char *s_ixhtml10_start_textarea_tag (void *pdoc, Node *node);
94 static char *s_ixhtml10_end_textarea_tag   (void *pdoc, Node *node);
95 static char *s_ixhtml10_start_b_tag        (void *pdoc, Node *node);
96 static char *s_ixhtml10_end_b_tag          (void *pdoc, Node *node);
97 static char *s_ixhtml10_chxjif_tag         (void *pdoc, Node *node);
98 static char *s_ixhtml10_text_tag           (void *pdoc, Node *node);
99 static char *s_ixhtml10_start_blockquote_tag (void *pdoc, Node *node);
100 static char *s_ixhtml10_end_blockquote_tag  (void *pdoc, Node *node);
101 static char *s_ixhtml10_start_dir_tag      (void *pdoc, Node *node);
102 static char *s_ixhtml10_end_dir_tag        (void *pdoc, Node *node);
103 static char *s_ixhtml10_start_dl_tag       (void *pdoc, Node *node);
104 static char *s_ixhtml10_end_dl_tag         (void *pdoc, Node *node);
105 static char *s_ixhtml10_start_dt_tag       (void *pdoc, Node *node);
106 static char *s_ixhtml10_end_dt_tag         (void *pdoc, Node *node);
107 static char *s_ixhtml10_start_dd_tag       (void *pdoc, Node *node);
108 static char *s_ixhtml10_end_dd_tag         (void *pdoc, Node *node);
109 static char *s_ixhtml10_start_h1_tag       (void *pdoc, Node *node);
110 static char *s_ixhtml10_end_h1_tag         (void *pdoc, Node *node);
111 static char *s_ixhtml10_start_h2_tag       (void *pdoc, Node *node);
112 static char *s_ixhtml10_end_h2_tag         (void *pdoc, Node *node);
113 static char *s_ixhtml10_start_h3_tag       (void *pdoc, Node *node);
114 static char *s_ixhtml10_end_h3_tag         (void *pdoc, Node *node);
115 static char *s_ixhtml10_start_h4_tag       (void *pdoc, Node *node);
116 static char *s_ixhtml10_end_h4_tag         (void *pdoc, Node *node);
117 static char *s_ixhtml10_start_h5_tag       (void *pdoc, Node *node);
118 static char *s_ixhtml10_end_h5_tag         (void *pdoc, Node *node);
119 static char *s_ixhtml10_start_h6_tag       (void *pdoc, Node *node);
120 static char *s_ixhtml10_end_h6_tag         (void *pdoc, Node *node);
121 static char *s_ixhtml10_start_menu_tag     (void *pdoc, Node *node);
122 static char *s_ixhtml10_end_menu_tag       (void *pdoc, Node *node);
123 static char *s_ixhtml10_start_plaintext_tag       (void *pdoc, Node *node);
124 static char *s_ixhtml10_start_plaintext_tag_inner (void *pdoc, Node *node);
125 static char *s_ixhtml10_end_plaintext_tag         (void *pdoc, Node *node);
126 static char *s_ixhtml10_start_blink_tag  (void *pdoc, Node *node);
127 static char *s_ixhtml10_end_blink_tag    (void *pdoc, Node *node);
128 static char *s_ixhtml10_start_marquee_tag (void *pdoc, Node *node);
129 static char *s_ixhtml10_end_marquee_tag  (void *pdoc, Node *node);
130 static char *s_ixhtml10_newline_mark       (void *pdoc, Node *node);
131 static char *s_ixhtml10_link_tag           (void *pdoc, Node *node);
132 static char *s_ixhtml10_start_span_tag     (void *pdoc, Node *node);
133 static char *s_ixhtml10_end_span_tag       (void *pdoc, Node *node);
134 static char *s_ixhtml10_style_tag       (void *pdoc, Node *node);
135 static char *s_ixhtml10_create_style_data(apr_pool_t *pool, const char *style_data);
136 static char *s_ixhtml10_start_nobr_tag     (void *pdoc, Node *node);
137 static char *s_ixhtml10_end_nobr_tag       (void *pdoc, Node *node);
138 static char *s_ixhtml10_start_small_tag    (void *pdoc, Node *node);
139 static char *s_ixhtml10_end_small_tag      (void *pdoc, Node *node);
140 static char *s_ixhtml10_start_object_tag    (void *pdoc, Node *node);
141 static char *s_ixhtml10_end_object_tag      (void *pdoc, Node *node);
142 static char *s_ixhtml10_start_param_tag    (void *pdoc, Node *node);
143 static char *s_ixhtml10_start_caption_tag    (void *pdoc, Node *node);
144 static char *s_ixhtml10_end_caption_tag      (void *pdoc, Node *node);
145
146 static void  s_init_ixhtml10(ixhtml10_t *ixhtml10, Doc *doc, request_rec *r, device_table *spec);
147
148 static int   s_ixhtml10_search_emoji(ixhtml10_t *ixhtml10, char *txt, char **rslt,Node *node);
149
150 static char *s_ixhtml10_istyle_to_wap_input_format(apr_pool_t *p, const char *s);
151 static css_prop_list_t *s_ixhtml10_nopush_and_get_now_style(void *pdoc, Node *node, const char *style_attr_value);
152 static css_prop_list_t *s_ixhtml10_push_and_get_now_style(void *pdoc, Node *node, const char *style_attr_value);
153
154
155 /*pend*/
156
157 tag_handler ixhtml10_handler[] = {
158   /* tagHTML */
159   {
160     s_ixhtml10_start_html_tag,
161     s_ixhtml10_end_html_tag,
162   },
163   /* tagMETA */
164   {
165     s_ixhtml10_start_meta_tag,
166     s_ixhtml10_end_meta_tag,
167   },
168   /* tagTEXTAREA */
169   {
170     s_ixhtml10_start_textarea_tag,
171     s_ixhtml10_end_textarea_tag,
172   },
173   /* tagP */
174   {
175     s_ixhtml10_start_p_tag,
176     s_ixhtml10_end_p_tag,
177   },
178   /* tagPRE */
179   {
180     s_ixhtml10_start_pre_tag,
181     s_ixhtml10_end_pre_tag,
182   },
183   /* tagUL */
184   {
185     s_ixhtml10_start_ul_tag,
186     s_ixhtml10_end_ul_tag,
187   },
188   /* tagLI */
189   {
190     s_ixhtml10_start_li_tag,
191     s_ixhtml10_end_li_tag,
192   },
193   /* tagOL */
194   {
195     s_ixhtml10_start_ol_tag,
196     s_ixhtml10_end_ol_tag,
197   },
198   /* tagH1 */
199   {
200     s_ixhtml10_start_h1_tag,
201     s_ixhtml10_end_h1_tag,
202   },
203   /* tagH2 */
204   {
205     s_ixhtml10_start_h2_tag,
206     s_ixhtml10_end_h2_tag,
207   },
208   /* tagH3 */
209   {
210     s_ixhtml10_start_h3_tag,
211     s_ixhtml10_end_h3_tag,
212   },
213   /* tagH4 */
214   {
215     s_ixhtml10_start_h4_tag,
216     s_ixhtml10_end_h4_tag,
217   },
218   /* tagH5 */
219   {
220     s_ixhtml10_start_h5_tag,
221     s_ixhtml10_end_h5_tag,
222   },
223   /* tagH6 */
224   {
225     s_ixhtml10_start_h6_tag,
226     s_ixhtml10_end_h6_tag,
227   },
228   /* tagHEAD */
229   {
230     s_ixhtml10_start_head_tag,
231     s_ixhtml10_end_head_tag,
232   },
233   /* tagTITLE */
234   {
235     s_ixhtml10_start_title_tag,
236     s_ixhtml10_end_title_tag,
237   },
238   /* tagBASE */
239   {
240     s_ixhtml10_start_base_tag,
241     s_ixhtml10_end_base_tag,
242   },
243   /* tagBODY */
244   {
245     s_ixhtml10_start_body_tag,
246     s_ixhtml10_end_body_tag,
247   },
248   /* tagA */
249   {
250     s_ixhtml10_start_a_tag,
251     s_ixhtml10_end_a_tag,
252   },
253   /* tagBR */
254   {
255     s_ixhtml10_start_br_tag,
256     s_ixhtml10_end_br_tag,
257   },
258   /* tagTABLE */
259   {
260     s_ixhtml10_start_table_tag,
261     s_ixhtml10_end_table_tag,
262   },
263   /* tagTR */
264   {
265     s_ixhtml10_start_tr_tag,
266     s_ixhtml10_end_tr_tag,
267   },
268   /* tagTD */
269   {
270     s_ixhtml10_start_td_tag,
271     s_ixhtml10_end_td_tag,
272   },
273   /* tagTBODY */
274   {
275     NULL,
276     NULL,
277   },
278   /* tagFONT */
279   {
280     s_ixhtml10_start_font_tag,
281     s_ixhtml10_end_font_tag,
282   },
283   /* tagFORM */
284   {
285     s_ixhtml10_start_form_tag,
286     s_ixhtml10_end_form_tag,
287   },
288   /* tagINPUT */
289   {
290     s_ixhtml10_start_input_tag,
291     s_ixhtml10_end_input_tag,
292   },
293   /* tagCENTER */
294   {
295     s_ixhtml10_start_center_tag,
296     s_ixhtml10_end_center_tag,
297   },
298   /* tagHR */
299   {
300     s_ixhtml10_start_hr_tag,
301     s_ixhtml10_end_hr_tag,
302   },
303   /* tagIMG */
304   {
305     s_ixhtml10_start_img_tag,
306     s_ixhtml10_end_img_tag,
307   },
308   /* tagSELECT */
309   {
310     s_ixhtml10_start_select_tag,
311     s_ixhtml10_end_select_tag,
312   },
313   /* tagOPTION */
314   {
315     s_ixhtml10_start_option_tag,
316     s_ixhtml10_end_option_tag,
317   },
318   /* tagDIV */
319   {
320     s_ixhtml10_start_div_tag,
321     s_ixhtml10_end_div_tag,
322   },
323   /* tagCHXJIF */
324   {
325     s_ixhtml10_chxjif_tag,
326     NULL,
327   },
328   /* tagCHXJRAW */
329   {
330     s_ixhtml10_chxjif_tag,
331     NULL,
332   },
333   /* tagNOBR */
334   {
335     s_ixhtml10_start_nobr_tag,
336     s_ixhtml10_end_nobr_tag,
337   },
338   /* tagSMALL */
339   {
340     s_ixhtml10_start_small_tag,
341     s_ixhtml10_end_small_tag,
342   },
343   /* tagSTYLE */
344   {
345     s_ixhtml10_style_tag,
346     NULL,
347   },
348   /* tagSPAN */
349   {
350     s_ixhtml10_start_span_tag,
351     s_ixhtml10_end_span_tag,
352   },
353   /* tagTEXT */
354   {
355     s_ixhtml10_text_tag,
356     NULL,
357   },
358   /* tagTH */
359   {
360     s_ixhtml10_start_th_tag,
361     s_ixhtml10_end_th_tag,
362   },
363   /* tagB */
364   {
365     s_ixhtml10_start_b_tag,
366     s_ixhtml10_end_b_tag,
367   },
368   /* tagFIELDSET */
369   {
370     NULL,
371     NULL,
372   },
373   /* tagDT */
374   {
375     s_ixhtml10_start_dt_tag,
376     s_ixhtml10_end_dt_tag,
377   },
378   /* tagLEGEND */
379   {
380     NULL,
381     NULL,
382   },
383   /* tagLABEL */
384   {
385     NULL,
386     NULL,
387   },
388   /* tagBLOCKQUOTE */
389   {
390     s_ixhtml10_start_blockquote_tag,
391     s_ixhtml10_end_blockquote_tag,
392   },
393   /* tagDIR */
394   {
395     s_ixhtml10_start_dir_tag,
396     s_ixhtml10_end_dir_tag,
397   },
398   /* tagDL */
399   {
400     s_ixhtml10_start_dl_tag,
401     s_ixhtml10_end_dl_tag,
402   },
403   /* tagDD */
404   {
405     s_ixhtml10_start_dd_tag,
406     s_ixhtml10_end_dd_tag,
407   },
408   /* tagMENU */
409   {
410     s_ixhtml10_start_menu_tag,
411     s_ixhtml10_end_menu_tag,
412   },
413   /* tagPLAINTEXT */
414   {
415     s_ixhtml10_start_plaintext_tag,
416     s_ixhtml10_end_plaintext_tag,
417   },
418   /* tagBLINK */
419   {
420     s_ixhtml10_start_blink_tag,
421     s_ixhtml10_end_blink_tag,
422   },
423   /* tagMARQUEE */
424   {
425     s_ixhtml10_start_marquee_tag,
426     s_ixhtml10_end_marquee_tag,
427   },
428   /* tagLINK */
429   {
430     s_ixhtml10_link_tag,
431     NULL,
432   },
433   /* tagNLMARK */
434   {
435     s_ixhtml10_newline_mark,
436     NULL,
437   },
438   /* tagObject */
439   {
440     s_ixhtml10_start_object_tag,
441     s_ixhtml10_end_object_tag,
442   },
443   /* tagParam */
444   {
445     s_ixhtml10_start_param_tag,
446     NULL,
447   },
448   /* tagCAPTION */
449   {
450     s_ixhtml10_start_caption_tag,
451     s_ixhtml10_end_caption_tag,
452   },
453 };
454
455
456 /**
457  * converts from CHTML5.0 to IXHTML10.
458  *
459  * @param r     [i]   Requet_rec is appointed.
460  * @param spec  [i]   The result of the device specification processing which
461  *                    was done in advance is appointed.
462  * @param src   [i]   The character string before the converting is appointed.
463  * @return The character string after the converting is returned.
464  */
465 char *
466 chxj_convert_ixhtml10(
467   request_rec         *r,
468   device_table        *spec,
469   const char          *src,
470   apr_size_t          srclen,
471   apr_size_t          *dstlen,
472   chxjconvrule_entry  *entryp,
473   cookie_t            *cookie
474 )
475 {
476   char      *dst;
477   char      *ss;
478   ixhtml10_t   ixhtml10;
479   Doc       doc;
480
481   dst = NULL;
482
483   /*--------------------------------------------------------------------------*/
484   /* If qrcode xml                                                            */
485   /*--------------------------------------------------------------------------*/
486   *dstlen = srclen;
487   dst = chxj_qr_code_blob_handler(r, src, (size_t*)dstlen);
488   if (dst) {
489     DBG(r,"REQ[%X] found qrcode xml",TO_ADDR(r));
490     return dst;
491   }
492
493   /*--------------------------------------------------------------------------*/
494   /* The CHTML structure is initialized.                                      */
495   /*--------------------------------------------------------------------------*/
496   s_init_ixhtml10(&ixhtml10, &doc, r, spec);
497
498   ixhtml10.entryp = entryp;
499   ixhtml10.cookie = cookie;
500
501   if (strcasecmp(spec->output_encoding,"UTF-8") == 0 ){
502     apr_table_setn(r->headers_out,HTTP_X_CHXJ_SET_CONTENT_TYPE,"application/xhtml+xml; charset=UTF-8");
503   }
504   chxj_set_content_type(r, chxj_header_inf_set_content_type(r, "application/xhtml+xml; charset=Shift_JIS"));
505
506   /*--------------------------------------------------------------------------*/
507   /* The character string of the input is analyzed.                           */
508   /*--------------------------------------------------------------------------*/
509   qs_init_malloc(&doc);
510   qs_init_root_node(&doc);
511
512   ss = apr_pcalloc(r->pool, srclen + 1);
513
514   memset(ss,   0, srclen + 1);
515   memcpy(ss, src, srclen);
516
517   if (IS_CSS_ON(ixhtml10.entryp)) {
518     /* current property list */
519     ixhtml10.css_prop_stack = chxj_new_prop_list_stack(&doc);
520   }
521 #ifdef DUMP_LOG
522   chxj_dump_out("[src] CHTML -> IXHTML10", ss, srclen);
523 #endif
524
525   qs_parse_string(&doc,ss,strlen(ss));
526
527   chxj_buffered_write_init(r->pool, &doc.buf);
528   /*--------------------------------------------------------------------------*/
529   /* It converts it from CHTML to IXHTML10.                                      */
530   /*--------------------------------------------------------------------------*/
531   chxj_node_convert(spec,r,(void*)&ixhtml10, &doc, qs_get_root(&doc), 0);
532   ixhtml10.out = chxj_buffered_write_flush(ixhtml10.out, &doc.buf);
533   dst = apr_pstrcat(r->pool, (! ixhtml10.prev_style_data) ? "" : ixhtml10.prev_style_data,
534                              s_ixhtml10_create_style_data(doc.pool, ixhtml10.style_data),
535                              ixhtml10.out, NULL);
536   chxj_buffered_write_terminate(&doc.buf);
537
538
539   qs_all_free(&doc,QX_LOGMARK);
540
541   if (! dst)
542     return apr_pstrdup(r->pool,ss);
543
544   if (! strlen(dst))
545     dst = apr_psprintf(r->pool, "\n");
546
547   *dstlen = strlen(dst);
548
549 #ifdef DUMP_LOG
550   chxj_dump_out("[dst] CHTML -> IXHTML10", dst, *dstlen);
551 #endif
552
553   return dst;
554 }
555
556
557 /**
558  * The IXHTML10 structure is initialized.
559  *
560  * @param ixhtml10 [i/o] The pointer to the IXHTML10 structure that wants to be
561  *                   initialized is specified.
562  * @param doc   [i]   The Doc structure that should be set to the initialized
563  *                   IXHTML10 structure is specified.
564  * @param r     [i]   To use POOL, the pointer to request_rec is specified.
565  * @param spec  [i]   The pointer to the device_table
566  */
567 static void
568 s_init_ixhtml10(ixhtml10_t *ixhtml10, Doc *doc, request_rec *r, device_table *spec)
569 {
570   memset(doc,   0, sizeof(Doc));
571   memset(ixhtml10, 0, sizeof(ixhtml10_t));
572
573   doc->r      = r;
574   ixhtml10->doc  = doc;
575   ixhtml10->spec = spec;
576   ixhtml10->out  = qs_alloc_zero_byte_string(r->pool);
577   ixhtml10->conf = chxj_get_module_config(r->per_dir_config, &chxj_module);
578   ixhtml10->doc->parse_mode = PARSE_MODE_CHTML;
579   ixhtml10->prev_style_data = NULL;
580   ixhtml10->style_data = NULL;
581 }
582
583
584 /**
585  * Corresponding EMOJI to a current character-code is retrieved.
586  * The substitution character string is stored in the rslt pointer if agreeing.
587  *
588  * @param ixhtml10   [i]   The pointer to the IXHTML10 structure is specified.
589  * @param txt     [i]   The character string to want to examine whether it is
590  *                      EMOJI is specified.
591  * @param rslt    [o]   The pointer to the pointer that stores the result is
592  *                      specified.
593  * @param node    [i]   The current node to check whether tag is span/font for CHXJ_IMODE_EMOJI_COLOR_AUTO.
594  * @return When corresponding EMOJI exists, it returns it excluding 0.
595  */
596 static int
597 s_ixhtml10_search_emoji(ixhtml10_t *ixhtml10, char *txt, char **rslt, Node *node)
598 {
599   emoji_t       *ee;
600   request_rec   *r;
601   device_table  *spec;
602   int           len;
603
604   spec = ixhtml10->spec;
605
606   len = strlen(txt);
607   r   = ixhtml10->doc->r;
608
609   if (!spec) {
610     DBG(r,"REQ[%X] spec is NULL",TO_ADDR(r));
611   }
612   
613   
614   for (ee = ixhtml10->conf->emoji;
615        ee;
616        ee = ee->next) {
617     if (ee->imode == NULL) {
618       DBG(r,"REQ[%X] emoji->imode is NULL",TO_ADDR(r));
619       continue;
620     }
621
622     if (ee->imode->string != NULL
623     &&  strlen(ee->imode->string) > 0
624     &&  strncasecmp(ee->imode->string, txt, strlen(ee->imode->string)) == 0) {
625
626       if (spec == NULL || spec->emoji_type == NULL) {
627         *rslt = apr_palloc(r->pool, 3);
628         (*rslt)[0] = ee->imode->hex1byte & 0xff;
629         (*rslt)[1] = ee->imode->hex2byte & 0xff;
630         (*rslt)[2] = 0;
631         
632         if(ixhtml10->conf->imode_emoji_color >= CHXJ_IMODE_EMOJI_COLOR_AUTO ){
633           if(ee->imode->color != NULL){
634             if(ixhtml10->conf->imode_emoji_color == CHXJ_IMODE_EMOJI_COLOR_AUTO ){
635               if(strcasecmp(node->parent->name, "span") == 0 ||
636                  strcasecmp(node->parent->name, "font")  == 0 ){
637                 return strlen(ee->imode->string);
638               }
639             }
640             char *tmp = apr_pstrdup(r->pool,*rslt);
641             *rslt = apr_psprintf(r->pool,
642                         "<span style=\"color:%s\">%s</span>",ee->imode->color,tmp);
643           }
644         }
645         return strlen(ee->imode->string);
646       }
647
648       return 0;
649     }
650   }
651
652   return 0;
653 }
654
655 /**
656  * It is a handler who processes the HTML tag.
657  *
658  * @param pdoc  [i/o] The pointer to the IXHTML10 structure at the output
659  *                     destination is specified.
660  * @param node   [i]   The HTML tag node is specified.
661  * @return The conversion result is returned.
662  */
663 static char *
664 s_ixhtml10_start_html_tag(void *pdoc, Node *UNUSED(node))
665 {
666   ixhtml10_t    *ixhtml10;
667   Doc           *doc;
668   request_rec   *r;
669
670
671   ixhtml10  = GET_IXHTML10(pdoc);
672   doc    = ixhtml10->doc;
673   r      = doc->r;
674   DBG(r,"REQ[%X] start %s()",TO_ADDR(r),__func__);
675
676   W_L("<?xml version=\"1.0\" encoding=\"");
677   W_V(ixhtml10->spec->output_encoding);
678   W_L("\" ?>");
679   W_NLCODE();
680   W_L("<!DOCTYPE html PUBLIC \"-//i-mode group (ja)//DTD XHTML i-XHTML(Locale/Ver.=ja/2.0) 1.0//EN\" \"i-xhtml_4ja_10.dtd\">");
681   W_NLCODE();
682
683   /*--------------------------------------------------------------------------*/
684   /* start HTML tag                                                           */
685   /*--------------------------------------------------------------------------*/
686   W_L("<html xmlns=\"http://www.w3.org/1999/xhtml\" lang=\"ja\" xml:lang=\"ja\">");
687
688   DBG(r,"REQ[%X] end %s()",TO_ADDR(r),__func__);
689
690   ixhtml10->start_html_flag = 1;
691   return ixhtml10->out;
692 }
693
694
695 /**
696  * It is a handler who processes the HTML tag.
697  *
698  * @param pdoc  [i/o] The pointer to the IXHTML10 structure at the output
699  *                     destination is specified.
700  * @param node   [i]   The HTML tag node is specified.
701  * @return The conversion result is returned.
702  */
703 static char *
704 s_ixhtml10_end_html_tag(void *pdoc, Node *UNUSED(child))
705 {
706   ixhtml10_t      *ixhtml10 = GET_IXHTML10(pdoc);
707   Doc           *doc = ixhtml10->doc;
708
709   W_L("</html>");
710
711   return ixhtml10->out;
712 }
713
714
715 /**
716  * It is a handler who processes the META tag.
717  *
718  * @param pdoc  [i/o] The pointer to the IXHTML10 structure at the output
719  *                     destination is specified.
720  * @param node   [i]   The META tag node is specified.
721  * @return The conversion result is returned.
722  */
723 static char *
724 s_ixhtml10_start_meta_tag(void *pdoc, Node *node)
725 {
726   ixhtml10_t   *ixhtml10;
727   Doc          *doc;
728   request_rec  *r;
729   Attr         *attr;
730   int          content_type_flag;
731   int          refresh_flag;
732
733   ixhtml10          = GET_IXHTML10(pdoc);
734   doc               = ixhtml10->doc;
735   r                 = doc->r;
736   refresh_flag      = 0;
737   content_type_flag = 0;
738
739   W_L("<meta");
740   /*--------------------------------------------------------------------------*/
741   /* Get Attributes                                                           */
742   /*--------------------------------------------------------------------------*/
743   for (attr = qs_get_attr(doc,node);
744        attr;
745        attr = qs_get_next_attr(doc,attr)) {
746     char *name   = qs_get_attr_name(doc,attr);
747     char *value  = qs_get_attr_value(doc,attr);
748     switch(*name) {
749     case 'h':
750     case 'H':
751       if (strcasecmp(name, "http-equiv") == 0 && value && *value) {
752         /*----------------------------------------------------------------------*/
753         /* CHTML 2.0                                                            */
754         /*----------------------------------------------------------------------*/
755         W_L(" http-equiv=\"");
756         W_V(value);
757         W_L("\"");
758         if (STRCASEEQ('c','C',"content-type",value)) {
759           content_type_flag = 1;
760         }
761         if (STRCASEEQ('r','R',"refresh",value)) {
762           refresh_flag = 1;
763         }
764       }
765       break;
766
767     case 'c':
768     case 'C':
769       if (strcasecmp(name, "content") == 0 && value && *value) {
770         /*----------------------------------------------------------------------*/
771         /* CHTML 2.0                                                            */
772         /*----------------------------------------------------------------------*/
773         if (content_type_flag)  {
774           W_L(" ");
775           W_V(name);
776           W_L("=\"");
777           W_V(chxj_header_inf_set_content_type(r, "application/xhtml+xml; charset=Shift_JIS"));
778           W_L("\"");
779         }
780         else
781         if (refresh_flag) {
782           char *buf;
783           char *sec;
784           char *url;
785
786           buf = apr_pstrdup(r->pool, value);
787
788           url = strchr(buf, ';');
789           if (url) {
790             sec = apr_pstrdup(r->pool, buf);
791             sec[url-buf] = 0;
792             url++;
793             url = chxj_encoding_parameter(r, url, 1);
794             W_L(" ");
795             W_V(name);
796             W_L("=\"");
797             W_V(sec);
798             W_L(";");
799             W_V(url);
800             W_L("\"");
801           }
802         }
803         else {
804           W_L(" ");
805           W_V(name);
806           W_L("=\"");
807           W_V(value);
808           W_L("\"");
809         }
810       }
811       break;
812     case 'n':
813     case 'N':
814       if (strcasecmp(name, "name") == 0 && value && *value) {
815         W_L(" name=\"");
816         W_V(value);
817         W_L("\"");
818       }
819       break;
820     default:
821       break;
822     }
823   }
824   W_L(" />");
825   return ixhtml10->out;
826 }
827
828
829 /**
830  * It is a handler who processes the META tag.
831  *
832  * @param pdoc  [i/o] The pointer to the IXHTML10 structure at the output
833  *                     destination is specified.
834  * @param node   [i]   The META tag node is specified.
835  * @return The conversion result is returned.
836  */
837 static char *
838 s_ixhtml10_end_meta_tag(void *pdoc, Node *UNUSED(child))
839 {
840   ixhtml10_t *ixhtml10 = GET_IXHTML10(pdoc);
841
842   return ixhtml10->out;
843 }
844
845
846 /**
847  * It is a handler who processes the HEAD tag.
848  *
849  * @param pdoc  [i/o] The pointer to the IXHTML10 structure at the output
850  *                     destination is specified.
851  * @param node   [i]   The HEAD tag node is specified.
852  * @return The conversion result is returned.
853  */
854 static char *
855 s_ixhtml10_start_head_tag(void *pdoc, Node *UNUSED(node))
856 {
857   ixhtml10_t      *ixhtml10;
858   Doc           *doc;
859   request_rec   *r;
860
861   ixhtml10 = GET_IXHTML10(pdoc);
862   doc   = ixhtml10->doc;
863   r     = doc->r;
864
865   W_L("<head>");
866   return ixhtml10->out;
867 }
868
869
870 /**
871  * It is a handler who processes the HEAD tag.
872  *
873  * @param pdoc  [i/o] The pointer to the IXHTML10 structure at the output
874  *                     destination is specified.
875  * @param node   [i]   The HEAD tag node is specified.
876  * @return The conversion result is returned.
877  */
878 static char *
879 s_ixhtml10_end_head_tag(void *pdoc, Node *UNUSED(child))
880 {
881   ixhtml10_t       *ixhtml10;
882   Doc           *doc;
883   request_rec   *r;
884
885   ixhtml10 = GET_IXHTML10(pdoc);
886   doc   = ixhtml10->doc;
887   r     = doc->r;
888
889   ixhtml10->out = chxj_buffered_write_flush(ixhtml10->out, &doc->buf);
890   ixhtml10->prev_style_data = apr_pstrdup(doc->pool, ixhtml10->out);
891   ixhtml10->out = qs_alloc_zero_byte_string(r->pool);
892
893   W_L("</head>");
894   return ixhtml10->out;
895 }
896
897
898 /**
899  * It is a handler who processes the TITLE tag.
900  *
901  * @param pdoc  [i/o] The pointer to the IXHTML10 structure at the output
902  *                     destination is specified.
903  * @param node   [i]   The TITLE tag node is specified.
904  * @return The conversion result is returned.
905  */
906 static char *
907 s_ixhtml10_start_title_tag(void *pdoc, Node *node)
908 {
909   ixhtml10_t      *ixhtml10;
910   Doc          *doc;
911   request_rec  *r;
912
913   ixhtml10 = GET_IXHTML10(pdoc);
914   doc   = ixhtml10->doc;
915   r     = doc->r;
916
917   W_L("<title>");
918
919   if (ixhtml10->conf->use_google_analytics) {
920     ixhtml10->pagetitle = "";
921     Node         *child;
922     for (child = qs_get_child_node(doc,node);
923          child;
924          child = qs_get_next_node(doc,child)) {
925       char *textval = qs_get_node_value(doc,child);
926       ixhtml10->pagetitle = apr_pstrcat(doc->r->pool, ixhtml10->pagetitle, textval, NULL);
927     }
928   }
929
930   return ixhtml10->out;
931 }
932
933
934 /**
935  * It is a handler who processes the TITLE tag.
936  *
937  * @param pdoc  [i/o] The pointer to the IXHTML10 structure at the output
938  *                     destination is specified.
939  * @param node   [i]   The TITLE tag node is specified.
940  * @return The conversion result is returned.
941  */
942 static char *
943 s_ixhtml10_end_title_tag(void *pdoc, Node *UNUSED(child))
944 {
945   ixhtml10_t      *ixhtml10;
946   Doc           *doc;
947   request_rec   *r;
948
949   ixhtml10 = GET_IXHTML10(pdoc);
950   doc   = ixhtml10->doc;
951   r     = doc->r;
952
953   W_L("</title>");
954   return ixhtml10->out;
955 }
956
957
958 /**
959  * It is a handler who processes the BASE tag.
960  *
961  * @param pdoc  [i/o] The pointer to the IXHTML10 structure at the output
962  *                     destination is specified.
963  * @param node   [i]   The BASE tag node is specified.
964  * @return The conversion result is returned.
965  */
966 static char *
967 s_ixhtml10_start_base_tag(void *pdoc, Node *node)
968 {
969   ixhtml10_t      *ixhtml10;
970   Attr          *attr;
971   Doc           *doc;
972   request_rec   *r;
973
974   ixhtml10 = GET_IXHTML10(pdoc);
975   doc   = ixhtml10->doc;
976   r     = doc->r;
977
978   W_L("<base");
979   /*--------------------------------------------------------------------------*/
980   /* Get Attributes                                                           */
981   /*--------------------------------------------------------------------------*/
982   for (attr = qs_get_attr(doc,node);
983        attr;
984        attr = qs_get_next_attr(doc,attr)) {
985     char *name  = qs_get_attr_name(doc,attr);
986     char *value = qs_get_attr_value(doc,attr);
987     if (STRCASEEQ('h','H',"href",name)) {
988       W_L(" href=\"");
989       W_V(value);
990       W_L("\"");
991     }
992   }
993   W_L(" />");
994   return ixhtml10->out;
995 }
996
997
998 /**
999  * It is a handler who processes the BASE tag.
1000  *
1001  * @param pdoc  [i/o] The pointer to the IXHTML10 structure at the output
1002  *                     destination is specified.
1003  * @param node   [i]   The BASE tag node is specified.
1004  * @return The conversion result is returned.
1005  */
1006 static char *
1007 s_ixhtml10_end_base_tag(void *pdoc, Node *UNUSED(child))
1008 {
1009   ixhtml10_t *ixhtml10 = GET_IXHTML10(pdoc);
1010   return ixhtml10->out;
1011 }
1012
1013
1014 /**
1015  * It is a handler who processes the BODY tag.
1016  *
1017  * @param pdoc  [i/o] The pointer to the IXHTML10 structure at the output
1018  *                     destination is specified.
1019  * @param node   [i]   The BODY tag node is specified.
1020  * @return The conversion result is returned.
1021  */
1022 static char *
1023 s_ixhtml10_start_body_tag(void *pdoc, Node *node)
1024 {
1025   ixhtml10_t    *ixhtml10;
1026   Doc         *doc;
1027   request_rec *r;
1028   Attr        *attr;
1029   char        *attr_bgcolor = NULL;
1030   char        *attr_text    = NULL;
1031   char        *attr_link    = NULL;
1032   char        *attr_vlink   = NULL;
1033   char        *attr_alink   = NULL;
1034   char        *attr_style   = NULL;
1035   char        *attr_background   = NULL;
1036
1037   ixhtml10 = GET_IXHTML10(pdoc);
1038   doc   = ixhtml10->doc;
1039   r     = doc->r;
1040
1041   /*--------------------------------------------------------------------------*/
1042   /* Get Attributes                                                           */
1043   /*--------------------------------------------------------------------------*/
1044   for (attr = qs_get_attr(doc,node);
1045        attr;
1046        attr = qs_get_next_attr(doc,attr)) {
1047     char *name   = qs_get_attr_name(doc,attr);
1048     char *value  = qs_get_attr_value(doc,attr);
1049     if (STRCASEEQ('b','B',"bgcolor",name) && value && *value) {
1050       /*----------------------------------------------------------------------*/
1051       /* CHTML 2.0                                                            */
1052       /*----------------------------------------------------------------------*/
1053       attr_bgcolor = value;
1054     }
1055     else if (STRCASEEQ('t','T',"text",name) && value && *value) {
1056       /*----------------------------------------------------------------------*/
1057       /* CHTML 2.0                                                            */
1058       /*----------------------------------------------------------------------*/
1059       attr_text = value;
1060     }
1061     else if (STRCASEEQ('l','L',"link",name) && value && *value) {
1062       /*----------------------------------------------------------------------*/
1063       /* CHTML 2.0                                                            */
1064       /*----------------------------------------------------------------------*/
1065       attr_link = value;
1066     }
1067     else if (STRCASEEQ('a','A',"alink",name) && value && *value) {
1068       /*----------------------------------------------------------------------*/
1069       /* CHTML 4.0                                                            */
1070       /*----------------------------------------------------------------------*/
1071       attr_alink = value;
1072     }
1073     else if (STRCASEEQ('v','V',"vlink",name) && value && *value) {
1074       /*----------------------------------------------------------------------*/
1075       /* CHTML 4.0                                                            */
1076       /*----------------------------------------------------------------------*/
1077       attr_vlink = value;
1078     }
1079     else if (STRCASEEQ('b','B',"background",name) && value && *value) {
1080       /*----------------------------------------------------------------------*/
1081       /* CHTML 6.0                                                            */
1082       /*----------------------------------------------------------------------*/
1083       attr_background = value;
1084     }
1085     else if (STRCASEEQ('s','S',"style",name) && value && *value) {
1086       attr_style = value;
1087     }
1088   }
1089
1090   if (IS_CSS_ON(ixhtml10->entryp)) {
1091     css_prop_list_t *style = s_ixhtml10_nopush_and_get_now_style(pdoc, node, attr_style);
1092     if (style) {
1093       css_property_t *color_prop      = chxj_css_get_property_value(doc, style, "color");
1094       css_property_t *bgcolor_prop    = chxj_css_get_property_value(doc, style, "background-color");
1095       css_property_t *bgimage_prop    = chxj_css_get_property_value(doc, style, "background-image");
1096       css_property_t *cur;
1097       for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
1098         if (cur->value && *cur->value) {
1099           attr_text = apr_pstrdup(doc->pool, cur->value);
1100         }
1101       }
1102       for (cur = bgcolor_prop->next; cur != bgcolor_prop; cur = cur->next) {
1103         if (cur->value && *cur->value) {
1104           attr_bgcolor = apr_pstrdup(doc->pool, cur->value);
1105         }
1106       }
1107       for (cur = bgimage_prop->next; cur != bgimage_prop; cur = cur->next) {
1108         if (cur->value && *cur->value) {
1109           char *tmp = apr_pstrdup(doc->pool, cur->value);
1110           char *tmps = strstr(tmp,"(");
1111           if(tmps){
1112             char *tmpe = strstr(tmp,")");
1113             size_t len = strlen(tmps) - strlen(tmpe) -1 ;
1114             tmps++;
1115             attr_background = apr_pstrndup(doc->pool, tmps,len);
1116           }
1117         }
1118       }
1119     }
1120     if (ixhtml10->style) {
1121       css_stylesheet_t *pseudos = chxj_find_pseudo_selectors(doc, ixhtml10->style);
1122       css_selector_t *cur_sel;
1123       for (cur_sel = pseudos->selector_head.next; cur_sel != &pseudos->selector_head; cur_sel = cur_sel->next) {
1124         if (cur_sel->name && strcasecmp(cur_sel->name, "a:link") == 0) {
1125           css_property_t *cur;
1126           for (cur = cur_sel->property_head.next; cur != &cur_sel->property_head; cur = cur->next) {
1127             if (cur->name && strcasecmp(cur->name, "color") == 0) {
1128               attr_link = apr_pstrdup(doc->pool, cur->value);
1129             }
1130           }
1131         }
1132         else if (cur_sel->name && strcasecmp(cur_sel->name, "a:visited") == 0) {
1133           css_property_t *cur;
1134           for (cur = cur_sel->property_head.next; cur != &cur_sel->property_head; cur = cur->next) {
1135             if (cur->name && strcasecmp(cur->name, "color") == 0) {
1136               attr_vlink = apr_pstrdup(doc->pool, cur->value);
1137             }
1138           }
1139         }
1140         else if (cur_sel->name && strcasecmp(cur_sel->name, "a:focus") == 0) {
1141           css_property_t *cur;
1142           for (cur = cur_sel->property_head.next; cur != &cur_sel->property_head; cur = cur->next) {
1143             if (cur->name && strcasecmp(cur->name, "color") == 0) {
1144               attr_alink = apr_pstrdup(doc->pool, cur->value);
1145             }
1146           }
1147         }
1148       }
1149     }
1150   }
1151
1152
1153   W_L("<body");
1154   if (attr_bgcolor || attr_text || attr_background) {
1155     W_L(" style=\"");
1156     if (attr_bgcolor) {
1157       attr_bgcolor = chxj_css_rgb_func_to_value(doc->pool, attr_bgcolor);
1158       W_L("background-color:");
1159       W_V(attr_bgcolor);
1160       W_L(";");
1161     }
1162     if (attr_text) {
1163       attr_text = chxj_css_rgb_func_to_value(doc->pool, attr_text);
1164       W_L("color:");
1165       W_V(attr_text);
1166       W_L(";");
1167     }
1168     if( attr_background) {
1169       W_L("background-image:url(");
1170       W_V(attr_background);
1171       W_L(");");
1172     }
1173     W_L("\"");
1174   }
1175   W_L(">");
1176   char *style_data = NULL;
1177   if (attr_link) {
1178     attr_link = chxj_css_rgb_func_to_value(doc->pool, attr_link);
1179     style_data = apr_psprintf(doc->pool, "a:link { color:%s; }", attr_link);
1180   }
1181   if (attr_vlink) {
1182     attr_vlink = chxj_css_rgb_func_to_value(doc->pool, attr_vlink);
1183     style_data = apr_pstrcat(doc->pool, (style_data) ? style_data : "",
1184                                         apr_psprintf(doc->pool, "a:visited { color:%s; }", attr_vlink), NULL);
1185   }
1186   if (attr_alink) {
1187     attr_alink = chxj_css_rgb_func_to_value(doc->pool, attr_alink);
1188     style_data = apr_pstrcat(doc->pool, (style_data) ? style_data : "",
1189                                         apr_psprintf(doc->pool, "a:focus { color:%s; }", attr_alink), NULL);
1190   }
1191   if (style_data) {
1192     ixhtml10->style_data = apr_pstrcat(doc->pool, (ixhtml10->style_data) ? ixhtml10->style_data : "",
1193                                                   style_data,
1194                                                   NULL);
1195   }
1196   return ixhtml10->out;
1197 }
1198
1199
1200 /**
1201  * It is a handler who processes the BODY tag.
1202  *
1203  * @param pdoc  [i/o] The pointer to the IXHTML10 structure at the output
1204  *                     destination is specified.
1205  * @param node   [i]   The BODY tag node is specified.
1206  * @return The conversion result is returned.
1207  */
1208 static char *
1209 s_ixhtml10_end_body_tag(void *pdoc, Node *UNUSED(child))
1210 {
1211   ixhtml10_t       *ixhtml10;
1212   Doc           *doc;
1213   request_rec   *r;
1214
1215   ixhtml10 = GET_IXHTML10(pdoc);
1216   doc   = ixhtml10->doc;
1217   r     = doc->r;
1218
1219   if (ixhtml10->conf->use_google_analytics) {
1220     char *src = chxj_google_analytics_get_image_url(r, ixhtml10->pagetitle);
1221     W_L("<img src=\"");
1222     W_V(src);
1223     W_L("\" />");
1224   }
1225  
1226
1227   W_L("</body>");
1228   if (IS_CSS_ON(ixhtml10->entryp)) {
1229     chxj_css_pop_prop_list(ixhtml10->css_prop_stack);
1230   }
1231   return ixhtml10->out;
1232 }
1233
1234
1235 /**
1236  * It is a handler who processes the A tag.
1237  *
1238  * @param pdoc  [i/o] The pointer to the IXHTML10 structure at the output
1239  *                     destination is specified.
1240  * @param node   [i]   The A tag node is specified.
1241  * @return The conversion result is returned.
1242  */
1243 static char *
1244 s_ixhtml10_start_a_tag(void *pdoc, Node *node)
1245 {
1246   ixhtml10_t    *ixhtml10;
1247   Doc         *doc;
1248   request_rec *r;
1249   Attr        *attr;
1250   char        *attr_style = NULL;
1251   char        *attr_id    = NULL;
1252   char        *attr_lcs   = NULL;
1253
1254   ixhtml10 = GET_IXHTML10(pdoc);
1255   doc   = ixhtml10->doc;
1256   r     = doc->r;
1257
1258   W_L("<a");
1259   /*--------------------------------------------------------------------------*/
1260   /* Get Attributes                                                           */
1261   /*--------------------------------------------------------------------------*/
1262   for (attr = qs_get_attr(doc,node);
1263        attr;
1264        attr = qs_get_next_attr(doc,attr)) {
1265     char *name  = qs_get_attr_name(doc,attr);
1266     char *value = qs_get_attr_value(doc,attr);
1267     if (STRCASEEQ('i','I',"id",name)){
1268       attr_id = apr_pstrdup(doc->buf.pool, value);
1269     }
1270     if (STRCASEEQ('n','N',"name",name)) {
1271       /*----------------------------------------------------------------------*/
1272       /* CHTML1.0                                                             */
1273       /*----------------------------------------------------------------------*/
1274       attr_id = apr_pstrdup(doc->buf.pool, value);
1275     }
1276     else if (STRCASEEQ('h','H',"href",name)) {
1277       /*----------------------------------------------------------------------*/
1278       /* CHTML1.0                                                             */
1279       /*----------------------------------------------------------------------*/
1280       value = chxj_encoding_parameter(r, value, 1);
1281       if (! chxj_starts_with(value, "mailto:") && ! chxj_starts_with(value, "tel:")) {
1282         value = chxj_add_cookie_parameter(r, value, ixhtml10->cookie);
1283       }
1284       W_L(" href=\"");
1285       W_V(value);
1286       W_L("\"");
1287     }
1288     else if (STRCASEEQ('a','A',"accesskey",name)) {
1289       /*----------------------------------------------------------------------*/
1290       /* CHTML1.0                                                             */
1291       /*----------------------------------------------------------------------*/
1292       W_L(" accesskey=\"");
1293       W_V(value);
1294       W_L("\"");
1295     }
1296     else if (STRCASEEQ('c','C',"cti",name)) {
1297       /*----------------------------------------------------------------------*/
1298       /* CHTML 2.0                                                            */
1299       /*----------------------------------------------------------------------*/
1300       W_L(" cti=\"");
1301       W_V(value);
1302       W_L("\"");
1303     }
1304     else if (STRCASEEQ('i','I',"ijam",name)) {
1305       /*----------------------------------------------------------------------*/
1306       /* CHTML 3.0                                                            */
1307       /*----------------------------------------------------------------------*/
1308       /* ignore */
1309     }
1310     else if (STRCASEEQ('u','U',"utn",name)) {
1311       /*----------------------------------------------------------------------*/
1312       /* CHTML 3.0                                                            */
1313       /* It is special only for CHTML.                                        */
1314       /*----------------------------------------------------------------------*/
1315       W_L(" utn=\"utn\"");
1316     }
1317     else if (STRCASEEQ('t','T',"telbook",name)) {
1318       /*----------------------------------------------------------------------*/
1319       /* CHTML 3.0                                                            */
1320       /*----------------------------------------------------------------------*/
1321       /* not support */
1322     }
1323     else if (STRCASEEQ('k','K',"kana",name)) {
1324       /*----------------------------------------------------------------------*/
1325       /* CHTML 3.0                                                            */
1326       /*----------------------------------------------------------------------*/
1327       /* not support */
1328     }
1329     else if (STRCASEEQ('e','E',"email",name)) {
1330       /*----------------------------------------------------------------------*/
1331       /* CHTML 3.0                                                            */
1332       /*----------------------------------------------------------------------*/
1333       /* not support */
1334     }
1335     else if (STRCASEEQ('i','I',"ista",name)) {
1336       /*----------------------------------------------------------------------*/
1337       /* CHTML 4.0                                                            */
1338       /*----------------------------------------------------------------------*/
1339       /* ignore */
1340     }
1341     else if (STRCASEEQ('i','I',"ilet",name)) {
1342       /*----------------------------------------------------------------------*/
1343       /* CHTML 5.0                                                            */
1344       /*----------------------------------------------------------------------*/
1345       /* ignore */
1346     }
1347     else if (STRCASEEQ('i','I',"iswf",name)) {
1348       /*----------------------------------------------------------------------*/
1349       /* CHTML 5.0                                                            */
1350       /*----------------------------------------------------------------------*/
1351       /* ignore */
1352     }
1353     else if (STRCASEEQ('i','I',"irst",name)) {
1354       /*----------------------------------------------------------------------*/
1355       /* CHTML 5.0                                                            */
1356       /*----------------------------------------------------------------------*/
1357       /* ignore */
1358     }
1359     else if (STRCASEEQ('s','S',"style",name) && value && *value) {
1360       /*----------------------------------------------------------------------*/
1361       /* CHTML 5.0                                                            */
1362       /*----------------------------------------------------------------------*/
1363       attr_style = value;
1364     }
1365     if (STRCASEEQ('l','L',"lcs",name)) {
1366       attr_lcs = "lcs";
1367     }
1368   }
1369   if(attr_id){
1370     W_L(" id=\"");
1371     W_V(attr_id);
1372     W_L("\"");
1373   }
1374   
1375   if(attr_lcs){
1376     W_L(" lcs");
1377   }
1378   
1379   W_L(">");
1380
1381   if (IS_CSS_ON(ixhtml10->entryp)) {
1382     s_ixhtml10_nopush_and_get_now_style(pdoc, node, attr_style);
1383   }
1384
1385   return ixhtml10->out;
1386 }
1387
1388
1389 /**
1390  * It is a handler who processes the A tag.
1391  *
1392  * @param pdoc  [i/o] The pointer to the IXHTML10 structure at the output
1393  *                     destination is specified.
1394  * @param node   [i]   The A tag node is specified.
1395  * @return The conversion result is returned.
1396  */
1397 static char *
1398 s_ixhtml10_end_a_tag(void *pdoc, Node *UNUSED(child))
1399 {
1400   ixhtml10_t      *ixhtml10;
1401   Doc          *doc;
1402   request_rec  *r;
1403
1404   ixhtml10 = GET_IXHTML10(pdoc);
1405   doc   = ixhtml10->doc;
1406   r     = doc->r;
1407
1408   W_L("</a>");
1409
1410   if (IS_CSS_ON(ixhtml10->entryp)) {
1411     chxj_css_pop_prop_list(ixhtml10->css_prop_stack);
1412   }
1413
1414   return ixhtml10->out;
1415 }
1416
1417
1418 /**
1419  * It is a handler who processes the BR tag.
1420  *
1421  * @param pdoc  [i/o] The pointer to the IXHTML10 structure at the output
1422  *                     destination is specified.
1423  * @param node   [i]   The BR tag node is specified.
1424  * @return The conversion result is returned.
1425  */
1426 static char *
1427 s_ixhtml10_start_br_tag(void *pdoc, Node *node)
1428 {
1429   ixhtml10_t     *ixhtml10;
1430   Doc          *doc;
1431   request_rec  *r;
1432   Attr         *attr;
1433   char         *attr_style = NULL;
1434   char         *attr_clear = NULL;
1435
1436   ixhtml10 = GET_IXHTML10(pdoc);
1437   doc   = ixhtml10->doc;
1438   r     = doc->r;
1439
1440   /*--------------------------------------------------------------------------*/
1441   /* Get Attributes                                                           */
1442   /*--------------------------------------------------------------------------*/
1443   for (attr = qs_get_attr(doc,node);
1444        attr;
1445        attr = qs_get_next_attr(doc,attr)) {
1446     char *name  = qs_get_attr_name(doc,attr);
1447     char *value = qs_get_attr_value(doc,attr);
1448     if (STRCASEEQ('c','C',"clear",name)) {
1449       if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('a','A',"all",value))) {
1450         attr_clear = value;
1451       }
1452     }
1453     else if (STRCASEEQ('s','S',"style",name)) {
1454       attr_style = value;
1455     }
1456   }
1457   if (IS_CSS_ON(ixhtml10->entryp)) {
1458     css_prop_list_t *style = s_ixhtml10_nopush_and_get_now_style(pdoc, node, attr_style);
1459     if (style) {
1460       css_property_t *clear_prop = chxj_css_get_property_value(doc, style, "clear");
1461       css_property_t *cur;
1462       for (cur = clear_prop->next; cur != clear_prop; cur = cur->next) {
1463         if (cur->value && *cur->value) {
1464           if ( STRCASEEQ('l','L',"left",  cur->value)
1465             || STRCASEEQ('r','R',"right", cur->value)
1466             || STRCASEEQ('b','B',"both"  ,cur->value)) {
1467             attr_clear = apr_pstrdup(doc->pool, cur->value);
1468           }
1469         }
1470       }
1471     }
1472   }
1473   
1474   if(attr_clear){
1475     W_L("<div");
1476     W_L(" style=\"");
1477     W_L("clear:");
1478     if (STRCASEEQ('a','A',"all",attr_clear)) {
1479       W_L("both");
1480     }
1481     else {
1482       W_V(attr_clear);
1483     }
1484     W_L(";");
1485     W_L("\"");
1486     W_L("></div>");
1487   }
1488   else{
1489     W_L("<br");
1490     W_L(" />");
1491   }
1492   return ixhtml10->out;
1493 }
1494
1495
1496 /**
1497  * It is a handler who processes the BR tag.
1498  *
1499  * @param pdoc  [i/o] The pointer to the IXHTML10 structure at the output
1500  *                     destination is specified.
1501  * @param node   [i]   The BR tag node is specified.
1502  * @return The conversion result is returned.
1503  */
1504 static char *
1505 s_ixhtml10_end_br_tag(void *pdoc, Node *UNUSED(child))
1506 {
1507   ixhtml10_t *ixhtml10 = GET_IXHTML10(pdoc);
1508   return ixhtml10->out;
1509 }
1510
1511
1512 /**
1513  * It is a handler who processes the TABLE tag.
1514  *
1515  * @param pdoc  [i/o] The pointer to the IXHTML10 structure at the output
1516  *                     destination is specified.
1517  * @param node   [i]   The TR tag node is specified.
1518  * @return The conversion result is returned.
1519  */
1520 static char *
1521 s_ixhtml10_start_table_tag(void *pdoc, Node *node)
1522 {
1523   ixhtml10_t      *ixhtml10;
1524   Doc          *doc;
1525   request_rec  *r;
1526   Attr         *attr;
1527   
1528   ixhtml10 = GET_IXHTML10(pdoc);
1529   doc   = ixhtml10->doc;
1530   r     = doc->r;
1531   
1532   char         *attr_style  = NULL;
1533   char         *attr_align  = NULL;
1534   char         *attr_width  = NULL;
1535   char         *attr_height = NULL;
1536   char         *attr_bgcolor = NULL;
1537   char         *attr_border_width  = NULL;
1538   char         *attr_border_color  = NULL;
1539   
1540   /*--------------------------------------------------------------------------*/
1541   /* Get Attributes                                                           */
1542   /*--------------------------------------------------------------------------*/
1543   for (attr = qs_get_attr(doc,node);
1544        attr;
1545        attr = qs_get_next_attr(doc,attr)) {
1546     char *name  = qs_get_attr_name(doc,attr);
1547     char *val   = qs_get_attr_value(doc,attr);
1548     if (STRCASEEQ('a','A',"align",name)) {
1549       if (val && (STRCASEEQ('l','L',"left",val) || STRCASEEQ('r','R',"right",val) || STRCASEEQ('c','C',"center",val))) {
1550         attr_align = apr_pstrdup(doc->buf.pool, val);
1551       }
1552     }
1553     else if (STRCASEEQ('h','H',"height",name) && val && *val) {
1554       attr_height = apr_pstrdup(doc->buf.pool, val);
1555     }
1556     else if (STRCASEEQ('w','W',"width",name) && val && *val) {
1557       attr_width = apr_pstrdup(doc->buf.pool, val);
1558     }
1559     else if (STRCASEEQ('s','S',"style",name) && val && *val) {
1560       attr_style = apr_pstrdup(doc->buf.pool, val);
1561     }
1562     else if (STRCASEEQ('b','B',"bgcolor",name) && val && *val) {
1563       attr_bgcolor = apr_pstrdup(doc->buf.pool, val);
1564       attr_bgcolor = chxj_css_rgb_func_to_value(doc->pool, attr_bgcolor);
1565     }
1566     else if (STRCASEEQ('b','B',"border",name) && val && *val) {
1567       attr_border_width = apr_pstrdup(doc->buf.pool, val);
1568     }
1569     else if (STRCASEEQ('b','B',"bordercolor",name) && val && *val) {
1570       attr_border_color = apr_pstrdup(doc->buf.pool, val);
1571       attr_border_color = chxj_css_rgb_func_to_value(doc->pool, attr_border_color);
1572     }
1573   }
1574   
1575   if (IS_CSS_ON(ixhtml10->entryp)) {
1576     css_prop_list_t *style = s_ixhtml10_nopush_and_get_now_style(pdoc, node, attr_style);
1577     if (style) {
1578       css_property_t *width_prop             = chxj_css_get_property_value(doc, style, "width");
1579       css_property_t *height_prop            = chxj_css_get_property_value(doc, style, "height");
1580       css_property_t *align_prop             = chxj_css_get_property_value(doc, style, "text-align");
1581       css_property_t *bgcolor_prop           = chxj_css_get_property_value(doc, style, "background-color");
1582       css_property_t *border_width_prop      = chxj_css_get_property_value(doc, style, "border-width");
1583       css_property_t *border_color_prop      = chxj_css_get_property_value(doc, style, "border-color");
1584       
1585       css_property_t *cur;
1586       for (cur = width_prop->next; cur != width_prop; cur = cur->next) {
1587         char *tmp = apr_pstrdup(doc->pool, cur->value);
1588         char *tmpp = strstr(tmp, "px");
1589         if (tmpp) {
1590           size_t len = strlen(tmp) - strlen(tmpp);
1591           attr_width = apr_pstrndup(doc->pool, tmp,len);
1592         }
1593         else{
1594           attr_width = apr_pstrdup(doc->pool, tmp);
1595         }
1596       }
1597       for (cur = height_prop->next; cur != height_prop; cur = cur->next) {
1598         char *tmp = apr_pstrdup(doc->pool, cur->value);
1599         char *tmpp = strstr(tmp, "px");
1600         if (tmpp) {
1601           size_t len = strlen(tmp) - strlen(tmpp);
1602           attr_height = apr_pstrndup(doc->pool, tmp,len);
1603         }
1604         else{
1605           attr_height = apr_pstrdup(doc->pool, tmp);
1606         }
1607       }
1608       for (cur = align_prop->next; cur != align_prop; cur = cur->next) {
1609         if (cur->value && (STRCASEEQ('l','L',"left",cur->value) || STRCASEEQ('r','R',"right",cur->value) || STRCASEEQ('c','C',"center",cur->value))) {
1610           attr_align = apr_pstrdup(doc->buf.pool, cur->value);
1611         }
1612       }
1613       for (cur = bgcolor_prop->next; cur != bgcolor_prop; cur = cur->next) {
1614         attr_bgcolor = apr_pstrdup(doc->pool, cur->value);
1615         attr_bgcolor = chxj_css_rgb_func_to_value(doc->pool, attr_bgcolor);
1616       }
1617       for (cur = border_width_prop->next; cur != border_width_prop; cur = cur->next) {
1618         char *tmp = apr_pstrdup(doc->pool, cur->value);
1619         char *tmpp = strstr(tmp, "px");
1620         if (tmpp) {
1621           size_t len = strlen(tmp) - strlen(tmpp);
1622           attr_border_width = apr_pstrndup(doc->pool, tmp,len);
1623         }
1624         else{
1625           attr_border_width = apr_pstrdup(doc->pool, tmp);
1626         }
1627       }
1628       for (cur = border_color_prop->next; cur != border_color_prop; cur = cur->next) {
1629         attr_border_color = apr_pstrdup(doc->pool, cur->value);
1630         attr_border_color = chxj_css_rgb_func_to_value(doc->pool, attr_border_color);
1631       }
1632     }
1633   }
1634
1635   W_L("<table");
1636   if (attr_align){
1637     W_L(" align=\"");
1638     W_V(attr_align);
1639     W_L("\"");
1640   }
1641   if (attr_height){
1642     W_L(" height=\"");
1643     W_V(attr_height);
1644     W_L("\"");
1645   }
1646   if (attr_width){
1647     W_L(" width=\"");
1648     W_V(attr_width);
1649     W_L("\"");
1650   }
1651   if (attr_border_width){
1652     W_L(" border=\"");
1653     W_V(attr_border_width);
1654     W_L("\"");
1655   }
1656   if (attr_border_color && *attr_border_color){
1657     W_L(" bordercolor=\"");
1658     W_V(attr_border_color);
1659     W_L("\"");
1660   }
1661   if (attr_bgcolor && *attr_bgcolor){
1662     W_L(" bgcolor=\"");
1663     W_V(attr_bgcolor);
1664     W_L("\"");
1665   }
1666   W_L(">");
1667   
1668   return ixhtml10->out;
1669 }
1670
1671
1672 /**
1673  * It is a handler who processes the TABLE tag.
1674  *
1675  * @param pdoc  [i/o] The pointer to the IXHTML10 structure at the output
1676  *                     destination is specified.
1677  * @param node   [i]   The TR tag node is specified.
1678  * @return The conversion result is returned.
1679  */
1680 static char *
1681 s_ixhtml10_end_table_tag(void *pdoc, Node *UNUSED(child))
1682 {
1683   ixhtml10_t      *ixhtml10;
1684   Doc          *doc;
1685   request_rec  *r;
1686
1687   ixhtml10 = GET_IXHTML10(pdoc);
1688   doc   = ixhtml10->doc;
1689   r     = doc->r;
1690   
1691   W_L("</table>");
1692   
1693   if (IS_CSS_ON(ixhtml10->entryp)) {
1694     chxj_css_pop_prop_list(ixhtml10->css_prop_stack);
1695   }
1696   
1697   return ixhtml10->out;
1698 }
1699
1700
1701 /**
1702  * It is a handler who processes the TR tag.
1703  *
1704  * @param pdoc  [i/o] The pointer to the IXHTML10 structure at the output
1705  *                     destination is specified.
1706  * @param node   [i]   The TR tag node is specified.
1707  * @return The conversion result is returned.
1708  */
1709 static char *
1710 s_ixhtml10_start_tr_tag(void *pdoc, Node *node)
1711 {
1712   ixhtml10_t      *ixhtml10;
1713   Doc          *doc;
1714   request_rec  *r;
1715   Attr         *attr;
1716
1717   ixhtml10 = GET_IXHTML10(pdoc);
1718   doc   = ixhtml10->doc;
1719   r     = doc->r;
1720   
1721   char         *attr_style  = NULL;
1722   char         *attr_align  = NULL;
1723   char         *attr_valign = NULL;
1724   char         *attr_bgcolor = NULL;
1725   
1726   /*--------------------------------------------------------------------------*/
1727   /* Get Attributes                                                           */
1728   /*--------------------------------------------------------------------------*/
1729   for (attr = qs_get_attr(doc,node);
1730        attr;
1731        attr = qs_get_next_attr(doc,attr)) {
1732     char *name  = qs_get_attr_name(doc,attr);
1733     char *val   = qs_get_attr_value(doc,attr);
1734     if (STRCASEEQ('a','A',"align",name)) {
1735       if (val && (STRCASEEQ('l','L',"left",val) || STRCASEEQ('r','R',"right",val) || STRCASEEQ('c','C',"center",val))) {
1736         attr_align = apr_pstrdup(doc->buf.pool, val);
1737       }
1738     }
1739     else if (STRCASEEQ('v','V',"valign",name) && val && *val) {
1740       if (val && (STRCASEEQ('t','T',"top",val) || STRCASEEQ('m','M',"middle",val) || STRCASEEQ('b','B',"bottom",val))) {
1741         attr_valign = apr_pstrdup(doc->buf.pool, val);
1742       }
1743     }
1744     else if (STRCASEEQ('s','S',"style",name) && val && *val) {
1745       attr_style = apr_pstrdup(doc->buf.pool, val);
1746     }
1747     else if (STRCASEEQ('b','B',"bgcolor",name) && val && *val) {
1748       attr_bgcolor = apr_pstrdup(doc->buf.pool, val);
1749       attr_bgcolor = chxj_css_rgb_func_to_value(doc->pool, attr_bgcolor);
1750     }
1751   }
1752   
1753   if (IS_CSS_ON(ixhtml10->entryp)) {
1754     css_prop_list_t *style = s_ixhtml10_nopush_and_get_now_style(pdoc, node, attr_style);
1755     if (style) {
1756       css_property_t *align_prop             = chxj_css_get_property_value(doc, style, "text-align");
1757       css_property_t *valign_prop            = chxj_css_get_property_value(doc, style, "vertical-align");
1758       css_property_t *bgcolor_prop           = chxj_css_get_property_value(doc, style, "background-color");
1759       
1760       css_property_t *cur;
1761       for (cur = align_prop->next; cur != align_prop; cur = cur->next) {
1762         if (cur->value && (STRCASEEQ('l','L',"left",cur->value) || STRCASEEQ('r','R',"right",cur->value) || STRCASEEQ('c','C',"center",cur->value))) {
1763           attr_align = apr_pstrdup(doc->buf.pool, cur->value);
1764         }
1765       }
1766       for (cur = valign_prop->next; cur != valign_prop; cur = cur->next) {
1767         if (cur->value && (STRCASEEQ('t','T',"top",cur->value) || STRCASEEQ('m','M',"middle",cur->value) || STRCASEEQ('b','B',"bottom",cur->value))) {
1768           attr_valign = apr_pstrdup(doc->buf.pool, cur->value);
1769         }
1770       }
1771       for (cur = bgcolor_prop->next; cur != bgcolor_prop; cur = cur->next) {
1772         attr_bgcolor = apr_pstrdup(doc->pool, cur->value);
1773         attr_bgcolor = chxj_css_rgb_func_to_value(doc->pool, attr_bgcolor);
1774       }
1775     }
1776   }
1777
1778   W_L("<tr");
1779   if (attr_align){
1780     W_L(" align=\"");
1781     W_V(attr_align);
1782     W_L("\"");
1783   }
1784   if (attr_valign){
1785     W_L(" valign=\"");
1786     W_V(attr_valign);
1787     W_L("\"");
1788   }
1789   if (attr_bgcolor && *attr_bgcolor){
1790     W_L(" bgcolor=\"");
1791     W_V(attr_bgcolor);
1792     W_L("\"");
1793   }
1794   W_L(">");
1795   return ixhtml10->out;
1796 }
1797
1798
1799 /**
1800  * It is a handler who processes the TR tag.
1801  *
1802  * @param pdoc  [i/o] The pointer to the IXHTML10 structure at the output
1803  *                     destination is specified.
1804  * @param node   [i]   The TR tag node is specified.
1805  * @return The conversion result is returned.
1806  */
1807 static char *
1808 s_ixhtml10_end_tr_tag(void *pdoc, Node *UNUSED(child))
1809 {
1810   ixhtml10_t      *ixhtml10;
1811   Doc          *doc;
1812   request_rec  *r;
1813
1814   ixhtml10 = GET_IXHTML10(pdoc);
1815   doc   = ixhtml10->doc;
1816   r     = doc->r;
1817   
1818   W_L("</tr>");
1819   return ixhtml10->out;
1820 }
1821
1822 /**
1823  * It is a handler who processes the TABLE tag.
1824  *
1825  * @param pdoc  [i/o] The pointer to the IXHTML10 structure at the output
1826  *                     destination is specified.
1827  * @param node   [i]   The TR tag node is specified.
1828  * @return The conversion result is returned.
1829  */
1830 static char *
1831 s_ixhtml10_start_td_or_th_tag(void *pdoc, Node *node,char *tagName)
1832 {
1833   ixhtml10_t      *ixhtml10;
1834   Doc          *doc;
1835   request_rec  *r;
1836   Attr         *attr;
1837
1838   ixhtml10 = GET_IXHTML10(pdoc);
1839   doc   = ixhtml10->doc;
1840   r     = doc->r;
1841   
1842   char         *attr_style  = NULL;
1843   char         *attr_align  = NULL;
1844   char         *attr_valign = NULL;
1845   char         *attr_bgcolor = NULL;
1846   char         *attr_colspan = NULL;
1847   char         *attr_rowspan = NULL;
1848   char         *attr_width   = NULL;
1849   char         *attr_height  = NULL;
1850   
1851   /*--------------------------------------------------------------------------*/
1852   /* Get Attributes                                                           */
1853   /*--------------------------------------------------------------------------*/
1854   for (attr = qs_get_attr(doc,node);
1855        attr;
1856        attr = qs_get_next_attr(doc,attr)) {
1857     char *name  = qs_get_attr_name(doc,attr);
1858     char *val   = qs_get_attr_value(doc,attr);
1859     if (STRCASEEQ('a','A',"align",name)) {
1860       if (val && (STRCASEEQ('l','L',"left",val) || STRCASEEQ('r','R',"right",val) || STRCASEEQ('c','C',"center",val))) {
1861         attr_align = apr_pstrdup(doc->buf.pool, val);
1862       }
1863     }
1864     else if (STRCASEEQ('v','V',"valign",name) && val && *val) {
1865       if (val && (STRCASEEQ('t','T',"top",val) || STRCASEEQ('m','M',"middle",val) || STRCASEEQ('b','B',"bottom",val))) {
1866         attr_valign = apr_pstrdup(doc->buf.pool, val);
1867       }
1868     }
1869     else if (STRCASEEQ('s','S',"style",name) && val && *val) {
1870       attr_style = apr_pstrdup(doc->buf.pool, val);
1871     }
1872     else if (STRCASEEQ('b','B',"bgcolor",name) && val && *val) {
1873       attr_bgcolor = apr_pstrdup(doc->buf.pool, val);
1874       attr_bgcolor = chxj_css_rgb_func_to_value(doc->pool, attr_bgcolor);
1875     }
1876     else if (STRCASEEQ('c','C',"colspan",name) && val && *val) {
1877       attr_colspan = apr_pstrdup(doc->buf.pool, val);
1878     }
1879     else if (STRCASEEQ('r','R',"rowspan",name) && val && *val) {
1880       attr_rowspan = apr_pstrdup(doc->buf.pool, val);
1881     }
1882     else if (STRCASEEQ('w','W',"width",name) && val && *val) {
1883       attr_width = apr_pstrdup(doc->buf.pool, val);
1884     }
1885     else if (STRCASEEQ('h','H',"height",name) && val && *val) {
1886       attr_height = apr_pstrdup(doc->buf.pool, val);
1887     }
1888   }
1889   
1890   if (IS_CSS_ON(ixhtml10->entryp)) {
1891     css_prop_list_t *style = s_ixhtml10_nopush_and_get_now_style(pdoc, node, attr_style);
1892     if (style) {
1893       css_property_t *align_prop             = chxj_css_get_property_value(doc, style, "text-align");
1894       css_property_t *valign_prop            = chxj_css_get_property_value(doc, style, "vertical-align");
1895       css_property_t *bgcolor_prop           = chxj_css_get_property_value(doc, style, "background-color");
1896       css_property_t *width_prop             = chxj_css_get_property_value(doc, style, "width");
1897       css_property_t *height_prop            = chxj_css_get_property_value(doc, style, "height");
1898       
1899       css_property_t *cur;
1900       for (cur = align_prop->next; cur != align_prop; cur = cur->next) {
1901         if (cur->value && (STRCASEEQ('l','L',"left",cur->value) || STRCASEEQ('r','R',"right",cur->value) || STRCASEEQ('c','C',"center",cur->value))) {
1902           attr_align = apr_pstrdup(doc->buf.pool, cur->value);
1903         }
1904       }
1905       for (cur = valign_prop->next; cur != valign_prop; cur = cur->next) {
1906         if (cur->value && (STRCASEEQ('t','T',"top",cur->value) || STRCASEEQ('m','M',"middle",cur->value) || STRCASEEQ('b','B',"bottom",cur->value))) {
1907           attr_valign = apr_pstrdup(doc->buf.pool, cur->value);
1908         }
1909       }
1910       for (cur = bgcolor_prop->next; cur != bgcolor_prop; cur = cur->next) {
1911         attr_bgcolor = apr_pstrdup(doc->pool, cur->value);
1912         attr_bgcolor = chxj_css_rgb_func_to_value(doc->pool, attr_bgcolor);
1913       }
1914       for (cur = width_prop->next; cur != width_prop; cur = cur->next) {
1915         char *tmp = apr_pstrdup(doc->pool, cur->value);
1916         char *tmpp = strstr(tmp, "px");
1917         if (tmpp) {
1918           size_t len = strlen(tmp) - strlen(tmpp);
1919           attr_width = apr_pstrndup(doc->pool, tmp,len);
1920         }
1921         else {
1922           tmpp = strstr(tmp, "%");
1923           if (tmpp) {
1924             attr_width = apr_pstrdup(doc->pool, tmp);
1925           }
1926         }
1927       }
1928       for (cur = height_prop->next; cur != height_prop; cur = cur->next) {
1929         char *tmp = apr_pstrdup(doc->pool, cur->value);
1930         char *tmpp = strstr(tmp, "px");
1931         if (tmpp) {
1932           size_t len = strlen(tmp) - strlen(tmpp);
1933           attr_height = apr_pstrndup(doc->pool, tmp,len);
1934         }
1935         else {
1936           tmpp = strstr(tmp, "%");
1937           if (tmpp) {
1938             attr_height = apr_pstrdup(doc->pool, tmp);
1939           }
1940         }
1941       }
1942     }
1943   }
1944
1945   W_L("<");
1946   W_V(tagName);
1947   if (attr_align){
1948     W_L(" align=\"");
1949     W_V(attr_align);
1950     W_L("\"");
1951   }
1952   if (attr_valign){
1953     W_L(" valign=\"");
1954     W_V(attr_valign);
1955     W_L("\"");
1956   }
1957   if (attr_colspan){
1958     W_L(" colspan=\"");
1959     W_V(attr_colspan);
1960     W_L("\"");
1961   }
1962   if (attr_rowspan){
1963     W_L(" rowspan=\"");
1964     W_V(attr_rowspan);
1965     W_L("\"");
1966   }
1967   if (attr_bgcolor && *attr_bgcolor){
1968     W_L(" bgcolor=\"");
1969     W_V(attr_bgcolor);
1970     W_L("\"");
1971   }
1972   if (attr_width){
1973     W_L(" width=\"");
1974     W_V(attr_width);
1975     W_L("\"");
1976   }
1977   if (attr_height){
1978     W_L(" height=\"");
1979     W_V(attr_height);
1980     W_L("\"");
1981   }
1982   W_L(">");
1983   return ixhtml10->out;
1984 }
1985
1986
1987 /**
1988  * It is a handler who processes the TABLE tag.
1989  *
1990  * @param pdoc  [i/o] The pointer to the IXHTML10 structure at the output
1991  *                     destination is specified.
1992  * @param node   [i]   The TR tag node is specified.
1993  * @return The conversion result is returned.
1994  */
1995 static char *
1996 s_ixhtml10_end_td_or_th_tag(void *pdoc, Node *UNUSED(child),char *tagName)
1997 {
1998   ixhtml10_t      *ixhtml10;
1999   Doc          *doc;
2000   request_rec  *r;
2001
2002   ixhtml10 = GET_IXHTML10(pdoc);
2003   doc   = ixhtml10->doc;
2004   r     = doc->r;
2005   
2006   W_L("</");
2007   W_V(tagName);
2008   W_L(">");
2009   return ixhtml10->out;
2010 }
2011
2012 /**
2013  * It is a handler who processes the TABLE tag.
2014  *
2015  * @param pdoc  [i/o] The pointer to the IXHTML10 structure at the output
2016  *                     destination is specified.
2017  * @param node   [i]   The TR tag node is specified.
2018  * @return The conversion result is returned.
2019  */
2020 static char *
2021 s_ixhtml10_start_td_tag(void *pdoc, Node *node)
2022 {
2023   return s_ixhtml10_start_td_or_th_tag(pdoc,node,"td");
2024 }
2025 /**
2026  * It is a handler who processes the TABLE tag.
2027  *
2028  * @param pdoc  [i/o] The pointer to the IXHTML10 structure at the output
2029  *                     destination is specified.
2030  * @param node   [i]   The TR tag node is specified.
2031  * @return The conversion result is returned.
2032  */
2033 static char *
2034 s_ixhtml10_end_td_tag(void *pdoc, Node *node)
2035 {
2036   return s_ixhtml10_end_td_or_th_tag(pdoc,node,"td");
2037 }
2038
2039 /**
2040  * It is a handler who processes the TABLE tag.
2041  *
2042  * @param pdoc  [i/o] The pointer to the IXHTML10 structure at the output
2043  *                     destination is specified.
2044  * @param node   [i]   The TR tag node is specified.
2045  * @return The conversion result is returned.
2046  */
2047 static char *
2048 s_ixhtml10_start_th_tag(void *pdoc, Node *node)
2049 {
2050   return s_ixhtml10_start_td_or_th_tag(pdoc,node,"th");
2051 }
2052 /**
2053  * It is a handler who processes the TABLE tag.
2054  *
2055  * @param pdoc  [i/o] The pointer to the IXHTML10 structure at the output
2056  *                     destination is specified.
2057  * @param node   [i]   The TR tag node is specified.
2058  * @return The conversion result is returned.
2059  */
2060 static char *
2061 s_ixhtml10_end_th_tag(void *pdoc, Node *node)
2062 {
2063   return s_ixhtml10_end_td_or_th_tag(pdoc,node,"th");
2064 }
2065
2066
2067
2068 /**
2069  * It is a handler who processes the FONT tag.
2070  *
2071  * @param pdoc  [i/o] The pointer to the IXHTML10 structure at the output
2072  *                     destination is specified.
2073  * @param node   [i]   The FONT tag node is specified.
2074  * @return The conversion result is returned.
2075  */
2076 static char *
2077 s_ixhtml10_start_font_tag(void *pdoc, Node *node)
2078 {
2079   ixhtml10_t      *ixhtml10;
2080   Doc           *doc;
2081   request_rec   *r;
2082   Attr          *attr;
2083   char          *attr_color = NULL;
2084   char          *attr_size  = NULL;
2085   char          *attr_style = NULL;
2086
2087   ixhtml10 = GET_IXHTML10(pdoc);
2088   doc   = ixhtml10->doc;
2089   r     = doc->r;
2090
2091   /*--------------------------------------------------------------------------*/
2092   /* Get Attributes                                                           */
2093   /*--------------------------------------------------------------------------*/
2094   for (attr = qs_get_attr(doc,node);
2095        attr;
2096        attr = qs_get_next_attr(doc,attr)) {
2097     char *name  = qs_get_attr_name(doc,attr);
2098     char *value = qs_get_attr_value(doc,attr);
2099     if (STRCASEEQ('c','C',"color",name) && value && *value) {
2100       attr_color = apr_pstrdup(doc->buf.pool, value);
2101     }
2102     else if (STRCASEEQ('s','S',"size",name) && value && *value) {
2103       /*----------------------------------------------------------------------*/
2104       /* CHTML 5.0                                                            */
2105       /*----------------------------------------------------------------------*/
2106       switch (*value) {
2107       case '1':
2108         attr_size = "xx-small";
2109         break;
2110       case '2':
2111         attr_size = "x-small";
2112         break;
2113       case '3':
2114         attr_size = "small";
2115         break;
2116       case '4':
2117         attr_size = "medium";
2118         break;
2119       case '5':
2120         attr_size = "large";
2121         break;
2122       case '6':
2123         attr_size = "x-large";
2124         break;
2125       case '7':
2126         attr_size = "xx-large";
2127         break;
2128       case '+':
2129       case '-':
2130         if (chxj_chk_numeric(&value[1]) == 0) {
2131           attr_size = apr_pstrdup(doc->pool, value);
2132         }
2133         break;
2134       default:
2135         break;
2136       }
2137     }
2138     else if (STRCASEEQ('s','S',"style",name) && value && *value) {
2139       attr_style = apr_pstrdup(doc->buf.pool, value);
2140     }
2141   }
2142   if (IS_CSS_ON(ixhtml10->entryp)) {
2143     css_prop_list_t *style = s_ixhtml10_nopush_and_get_now_style(pdoc, node, attr_style);
2144     if (style) {
2145       css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
2146       css_property_t *size_prop  = chxj_css_get_property_value(doc, style, "font-size");
2147       css_property_t *cur;
2148       for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
2149         if (cur->value && *cur->value) {
2150           attr_color = apr_pstrdup(doc->pool, cur->value);
2151         }
2152       }
2153       for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
2154         if (cur->value && *cur->value) {
2155           attr_size = apr_pstrdup(doc->pool, cur->value);
2156           if ( STRCASEEQ('x','X',"xx-small",attr_size)
2157             || STRCASEEQ('x','X',"x-small", attr_size)
2158             || STRCASEEQ('s','S',"small",   attr_size)
2159             || STRCASEEQ('m','M',"medium",  attr_size)
2160             || STRCASEEQ('l','L',"large",   attr_size)
2161             || STRCASEEQ('x','X',"x-large", attr_size)
2162             || STRCASEEQ('x','X',"xx-large",attr_size)) {
2163             attr_size = apr_pstrdup(doc->pool, cur->value);
2164           }
2165         }
2166       }
2167     }
2168   }
2169   W_L("<span");
2170   if (attr_color || attr_size) {
2171     W_L(" style=\"");
2172     if (attr_color) {
2173       attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
2174       W_L("color:");
2175       W_V(attr_color);
2176       W_L(";");
2177     }
2178     if (attr_size) {
2179       switch(*attr_size) {
2180       case '-':
2181         if (*(attr_size + 1) == '1') {
2182           attr_size = "small";
2183           break;
2184         }
2185         if (*(attr_size + 1) == '2') {
2186           attr_size = "x-small";
2187           break;
2188         }
2189         if (*(attr_size + 1) == '3') {
2190           attr_size = "xx-small";
2191           break;
2192         }
2193         break;
2194       case '+':
2195         if (*(attr_size + 1) == '1') {
2196           attr_size = "large";
2197           break;
2198         }
2199         if (*(attr_size + 1) == '2') {
2200           attr_size = "x-large";
2201           break;
2202         }
2203         if (*(attr_size + 1) == '3') {
2204           attr_size = "xx-large";
2205           break;
2206         }
2207         break;
2208       default:
2209         break;
2210       }
2211       W_L("font-size:");
2212       W_V(attr_size);
2213       W_L(";");
2214     }
2215     W_L("\"");
2216   }
2217   W_L(">");
2218   return ixhtml10->out;
2219 }
2220
2221
2222 /**
2223  * It is a handler who processes the FONT tag.
2224  *
2225  * @param pdoc  [i/o] The pointer to the IXHTML10 structure at the output
2226  *                     destination is specified.
2227  * @param node   [i]   The FONT tag node is specified.
2228  * @return The conversion result is returned.
2229  */
2230 static char *
2231 s_ixhtml10_end_font_tag(void *pdoc, Node *UNUSED(node))
2232 {
2233   ixhtml10_t      *ixhtml10;
2234   request_rec  *r;
2235   Doc          *doc;
2236
2237   ixhtml10 = GET_IXHTML10(pdoc);
2238   doc   = ixhtml10->doc;
2239   r     = ixhtml10->doc->r;
2240
2241   W_L("</span>");
2242   if (IS_CSS_ON(ixhtml10->entryp)) {
2243     chxj_css_pop_prop_list(ixhtml10->css_prop_stack);
2244   }
2245
2246   return ixhtml10->out;
2247 }
2248
2249
2250 /**
2251  * It is a handler who processes the FORM tag.
2252  *
2253  * @param pdoc  [i/o] The pointer to the IXHTML10 structure at the output
2254  *                     destination is specified.
2255  * @param node   [i]   The FORM tag node is specified.
2256  * @return The conversion result is returned.
2257  */
2258 static char *
2259 s_ixhtml10_start_form_tag(void *pdoc, Node *node)
2260 {
2261   ixhtml10_t  *ixhtml10;
2262   Doc         *doc;
2263   request_rec *r;
2264   Attr        *attr;
2265   char        *attr_action = NULL;
2266   char        *attr_method = NULL;
2267   char        *attr_style  = NULL;
2268   char        *attr_color  = NULL;
2269   char        *attr_align  = NULL;
2270   char        *attr_name   = NULL;
2271   char        *new_hidden_tag = NULL;
2272   char        *css_clear  = NULL;
2273
2274   ixhtml10 = GET_IXHTML10(pdoc);
2275   doc      = ixhtml10->doc;
2276   r        = doc->r;
2277
2278   /*--------------------------------------------------------------------------*/
2279   /* Get Attributes                                                           */
2280   /*--------------------------------------------------------------------------*/
2281   for (attr = qs_get_attr(doc,node);
2282        attr;
2283        attr = qs_get_next_attr(doc,attr)) {
2284     char *name  = qs_get_attr_name(doc,attr);
2285     char *value = qs_get_attr_value(doc,attr);
2286     switch(*name) {
2287     case 'a':
2288     case 'A':
2289       if (strcasecmp(name, "action") == 0) {
2290         /*--------------------------------------------------------------------*/
2291         /* CHTML 1.0                                                          */
2292         /*--------------------------------------------------------------------*/
2293         attr_action = value;
2294       }
2295       break;
2296
2297     case 'm':
2298     case 'M':
2299       if (strcasecmp(name, "method") == 0) {
2300         /*--------------------------------------------------------------------*/
2301         /* CHTML 1.0                                                          */
2302         /*--------------------------------------------------------------------*/
2303         attr_method = value;
2304       }
2305       break;
2306
2307     case 'n':
2308     case 'N':
2309       if (strcasecmp(name, "name") == 0) {
2310         /*--------------------------------------------------------------------*/
2311         /* CHTML 1.0                                                          */
2312         /*--------------------------------------------------------------------*/
2313         attr_name = value;
2314       }
2315       break;
2316
2317     case 's':
2318     case 'S':
2319       if (strcasecmp(name, "style") == 0) {
2320         attr_style = value;
2321       }
2322       break;
2323
2324     default:
2325       break;
2326     }
2327   }
2328   if (IS_CSS_ON(ixhtml10->entryp)) {
2329     css_prop_list_t *style = s_ixhtml10_nopush_and_get_now_style(pdoc, node, attr_style);
2330     if (style) {
2331       css_property_t *text_align_prop = chxj_css_get_property_value(doc, style, "text-align");
2332       css_property_t *color_prop      = chxj_css_get_property_value(doc, style, "color");
2333       css_property_t *clear_prop      = chxj_css_get_property_value(doc, style, "clear");
2334       css_property_t *cur;
2335       for (cur = text_align_prop->next; cur != text_align_prop; cur = cur->next) {
2336         if (STRCASEEQ('l','L',"left", cur->value)) {
2337           attr_align = apr_pstrdup(doc->pool, "left");
2338         }
2339         else if (STRCASEEQ('c','C',"center",cur->value)) {
2340           attr_align = apr_pstrdup(doc->pool, "center");
2341         }
2342         else if (STRCASEEQ('r','R',"right",cur->value)) {
2343           attr_align = apr_pstrdup(doc->pool, "right");
2344         }
2345       }
2346       for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
2347         attr_color = apr_pstrdup(doc->pool, cur->value);
2348       }
2349       for (cur = clear_prop->next; cur != clear_prop; cur = cur->next) {
2350         css_clear = apr_pstrdup(doc->pool, cur->value);
2351       }
2352     }
2353   }
2354
2355   int post_flag = (attr_method && strcasecmp(attr_method, "post") == 0) ? 1 : 0;
2356
2357   W_L("<form");
2358   if (attr_action) {
2359     attr_action = chxj_encoding_parameter(r, attr_action, 1);
2360     attr_action = chxj_add_cookie_parameter(r, attr_action, ixhtml10->cookie);
2361     char *q;
2362     char *new_query_string = NULL;
2363     q = strchr(attr_action, '?');
2364     if (q) {
2365       new_hidden_tag = chxj_form_action_to_hidden_tag(r, doc->pool, attr_action, 1, post_flag, &new_query_string, CHXJ_TRUE, CHXJ_FALSE, ixhtml10->entryp);
2366       if (new_hidden_tag || new_query_string) {
2367         *q = 0;
2368       }
2369     }
2370     W_L(" action=\"");
2371     W_V(attr_action);
2372     if (new_query_string) {
2373       W_L("?");
2374       W_V(new_query_string);
2375     }
2376     W_L("\"");
2377   }
2378   if (attr_method) {
2379     W_L(" method=\"");
2380     W_V(attr_method);
2381     W_L("\"");
2382   }
2383   if (attr_name) {
2384     W_L(" name=\"");
2385     W_V(attr_name);
2386     W_L("\"");
2387   }
2388   
2389   if (css_clear) {
2390     W_L(" style=\"");
2391     W_L("clear:");
2392     W_V(css_clear);
2393     W_L("\"");
2394   }
2395   
2396   W_L(">");
2397
2398   ixhtml10_flags_t *flg = (ixhtml10_flags_t *)apr_palloc(doc->pool, sizeof(ixhtml10_flags_t));
2399   memset(flg, 0, sizeof(*flg));
2400   if (attr_color || attr_align) {
2401     W_L("<div style=\"");
2402     if (attr_color) {
2403       attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
2404       W_L("color:");
2405       W_V(attr_color);
2406       W_L(";");
2407     }
2408     if (attr_align) {
2409       W_L("text-align:");
2410       W_V(attr_align);
2411       W_L(";");
2412     }
2413     
2414     
2415     flg->with_div_flag = 1;
2416     W_L("\">");
2417   }
2418   node->userData = flg;
2419   if (new_hidden_tag) {
2420     W_V(new_hidden_tag);
2421   }
2422   return ixhtml10->out;
2423 }
2424
2425
2426 /**
2427  * It is a handler who processes the FORM tag.
2428  *
2429  * @param pdoc  [i/o] The pointer to the IXHTML10 structure at the output
2430  *                     destination is specified.
2431  * @param node   [i]   The FORM tag node is specified.
2432  * @return The conversion result is returned.
2433  */
2434 static char *
2435 s_ixhtml10_end_form_tag(void *pdoc, Node *node)
2436 {
2437   ixhtml10_t *ixhtml10 = GET_IXHTML10(pdoc);
2438   Doc      *doc    = ixhtml10->doc;
2439
2440   ixhtml10_flags_t *flg = (ixhtml10_flags_t *)node->userData;
2441   if (flg && flg->with_div_flag) {
2442     W_L("</div>");
2443   }
2444   W_L("</form>");
2445   if (IS_CSS_ON(ixhtml10->entryp)) {
2446     chxj_css_pop_prop_list(ixhtml10->css_prop_stack);
2447   }
2448
2449   return ixhtml10->out;
2450 }
2451
2452
2453 /**
2454  * It is a handler who processes the INPUT tag.
2455  *
2456  * @param pdoc  [i/o] The pointer to the IXHTML10 structure at the output
2457  *                     destination is specified.
2458  * @param node   [i]   The INPUT tag node is specified.
2459  * @return The conversion result is returned.
2460  */
2461 static char *
2462 s_ixhtml10_start_input_tag(void *pdoc, Node *node)
2463 {
2464   ixhtml10_t     *ixhtml10;
2465   Doc         *doc;
2466   request_rec *r;
2467   Attr        *attr;
2468   char        *attr_accesskey  = NULL;
2469   char        *attr_max_length = NULL;
2470   char        *attr_type       = NULL;
2471   char        *attr_name       = NULL;
2472   char        *attr_value      = NULL;
2473   char        *attr_istyle     = NULL;
2474   char        *attr_size       = NULL;
2475   char        *attr_checked    = NULL;
2476   char        *attr_style      = NULL;
2477
2478   ixhtml10 = GET_IXHTML10(pdoc);
2479   doc     = ixhtml10->doc;
2480   r       = doc->r;
2481
2482   /*--------------------------------------------------------------------------*/
2483   /* Get Attributes                                                           */
2484   /*--------------------------------------------------------------------------*/
2485   for (attr = qs_get_attr(doc,node);
2486        attr;
2487        attr = qs_get_next_attr(doc,attr)) {
2488     char *name  = qs_get_attr_name(doc,attr);
2489     char *value = qs_get_attr_value(doc,attr);
2490     if (STRCASEEQ('t','T',"type",name) && value && *value) {
2491       char *tmp_type = qs_trim_string(doc->buf.pool, value);
2492       if (tmp_type && (STRCASEEQ('t','T',"text",    tmp_type) ||
2493                        STRCASEEQ('p','P',"password",tmp_type) ||
2494                        STRCASEEQ('c','C',"checkbox",tmp_type) ||
2495                        STRCASEEQ('r','R',"radio",   tmp_type) ||
2496                        STRCASEEQ('h','H',"hidden",  tmp_type) ||
2497                        STRCASEEQ('s','S',"submit",  tmp_type) ||
2498                        STRCASEEQ('r','R',"reset",   tmp_type))) {
2499         attr_type = tmp_type;
2500       }
2501     }
2502     else if (STRCASEEQ('n','N',"name",name) && value && *value) {
2503       attr_name = value;
2504     }
2505     else if (STRCASEEQ('v','V',"value",name) && value && *value) {
2506       attr_value = value;
2507     }
2508     else if (STRCASEEQ('i','I',"istyle",name) && value && *value) {
2509       attr_istyle = value;
2510     }
2511     else if (STRCASEEQ('m','M',"maxlength",name) && value && *value) {
2512       attr_max_length = value;
2513     }
2514     else if (STRCASEEQ('c','C',"checked", name)) {
2515       attr_checked = value;
2516     }
2517     else if (STRCASEEQ('a','A',"accesskey", name) && value && *value) {
2518       attr_accesskey = value;
2519     }
2520     else if (STRCASEEQ('s','S',"size", name) && value && *value) {
2521       attr_size = value;
2522     }
2523     else if (STRCASEEQ('s','S',"style", name) && value && *value) {
2524       attr_style = value;
2525     }
2526   }
2527
2528   if (IS_CSS_ON(ixhtml10->entryp)) {
2529     css_prop_list_t *style = s_ixhtml10_nopush_and_get_now_style(pdoc, node, attr_style);
2530     if (style) {
2531       css_property_t *wap_input_format = chxj_css_get_property_value(doc, style, "-wap-input-format");
2532       css_property_t *cur;
2533       for (cur = wap_input_format->next; cur != wap_input_format; cur = cur->next) {
2534         if (strcasestr(cur->value, "<ja:n>")) {
2535           attr_istyle = "4";
2536         }
2537         else if (strcasestr(cur->value, "<ja:en>")) {
2538           attr_istyle = "3";
2539         }
2540         else if (strcasestr(cur->value, "<ja:hk>")) {
2541           attr_istyle = "2";
2542         }
2543         else if (strcasestr(cur->value, "<ja:h>")) {
2544           attr_istyle = "1";
2545         }
2546       }
2547     }
2548   }
2549
2550   W_L("<input");
2551   if (attr_type) {
2552     W_L(" type=\"");
2553     W_V(attr_type);
2554     W_L("\"");
2555   }
2556   if (attr_size) {
2557     W_L(" size=\"");
2558     W_V(attr_size);
2559     W_L("\"");
2560   }
2561   if (attr_name) {
2562     W_L(" name=\"");
2563     W_V(attr_name);
2564     W_L("\"");
2565   }
2566   if (attr_value) {
2567     if (attr_type){
2568       if (STRCASEEQ('s','S',"submit",attr_type) || STRCASEEQ('r','R',"reset",attr_type)) {
2569         apr_size_t value_len = strlen(attr_value);
2570         attr_value = chxj_conv_z2h(r, attr_value, &value_len, ixhtml10->entryp);
2571       }
2572     }
2573
2574     W_L(" value=\"");
2575     W_V(chxj_add_slash_to_doublequote(doc->pool, attr_value));
2576     W_L("\"");
2577   }
2578   if (attr_accesskey) {
2579     W_L(" accesskey=\"");
2580     W_V(attr_accesskey);
2581     W_L("\"");
2582   }
2583   if (attr_istyle && (*attr_istyle == '1' || *attr_istyle == '2' || *attr_istyle == '3' || *attr_istyle == '4')) {
2584     /*------------------------------------------------------------------------*/
2585     /* CHTML 2.0                                                              */
2586     /*------------------------------------------------------------------------*/
2587     if (attr_type && STRCASEEQ('p','P',"password", attr_type) && ! ixhtml10->entryp->pc_flag ) {
2588       W_L(" style=\"-wap-input-format:&quot;*&lt;ja:n&gt;&quot;;\"");
2589     }
2590     else {
2591       char *vv = s_ixhtml10_istyle_to_wap_input_format(doc->buf.pool,attr_istyle);
2592       W_L(" style=\"");
2593       W_L("-wap-input-format:");
2594       W_V(vv);
2595       W_L(";");
2596       W_L("\"");
2597     }
2598   }
2599   else if (attr_type && STRCASEEQ('p','P',"password",attr_type)) {
2600     W_L(" style=\"-wap-input-format:&quot;*&lt;ja:n&gt;&quot;;\"");
2601   }
2602   /*--------------------------------------------------------------------------*/
2603   /* The figure is default for the password.                                  */
2604   /*--------------------------------------------------------------------------*/
2605   if (attr_max_length && *attr_max_length) {
2606     if (chxj_chk_numeric(attr_max_length) == 0) {
2607       W_L(" maxlength=\"");
2608       W_V(attr_max_length);
2609       W_L("\"");
2610     }
2611   }
2612   if (attr_checked) {
2613     W_L(" checked=\"checked\"");
2614   }
2615   W_L(" />");
2616 #if 0
2617   ixhtml10_t       *ixhtml10;
2618   Doc           *doc;
2619   request_rec   *r;
2620   char          *max_length;
2621   char          *type;
2622   char          *name;
2623   char          *value;
2624   char          *istyle;
2625   char          *size;
2626   char          *checked;
2627   char          *accesskey;
2628
2629   ixhtml10       = GET_IXHTML10(pdoc);
2630   doc         = ixhtml10->doc;
2631   r           = doc->r;
2632   max_length  = NULL;
2633   type        = NULL;
2634   name        = NULL;
2635   value       = NULL;
2636   istyle      = NULL;
2637   size        = NULL;
2638   checked     = NULL;
2639   accesskey   = NULL;
2640
2641   W_L("<input");
2642   /*--------------------------------------------------------------------------*/
2643   /* Get Attributes                                                           */
2644   /*--------------------------------------------------------------------------*/
2645   type       = qs_get_type_attr(doc, node, doc->buf.pool);
2646   name       = qs_get_name_attr(doc, node, doc->buf.pool);
2647   value      = qs_get_value_attr(doc,node, doc->buf.pool);
2648   istyle     = qs_get_istyle_attr(doc,node,doc->buf.pool);
2649   max_length = qs_get_maxlength_attr(doc,node,doc->buf.pool);
2650   checked    = qs_get_checked_attr(doc,node,doc->buf.pool);
2651   accesskey  = qs_get_accesskey_attr(doc, node, doc->buf.pool);
2652   size       = qs_get_size_attr(doc, node, doc->buf.pool);
2653
2654   if (type) {
2655     if (type && (STRCASEEQ('t','T',"text",    type) ||
2656                  STRCASEEQ('p','P',"password",type) ||
2657                  STRCASEEQ('c','C',"checkbox",type) ||
2658                  STRCASEEQ('r','R',"radio",   type) ||
2659                  STRCASEEQ('h','H',"hidden",  type) ||
2660                  STRCASEEQ('s','S',"submit",  type) ||
2661                  STRCASEEQ('r','R',"reset",   type))) {
2662       W_L(" type=\"");
2663       W_V(type);
2664       W_L("\"");
2665     }
2666   }
2667   if (size && *size) {
2668     W_L(" size=\"");
2669     W_V(size);
2670     W_L("\"");
2671   }
2672   if (name && *name) {
2673     W_L(" name=\"");
2674     W_V(name);
2675     W_L("\"");
2676   }
2677   if (value && *value) {
2678     W_L(" value=\"");
2679     W_V(chxj_add_slash_to_doublequote(doc->pool, value));
2680     W_L("\"");
2681   }
2682   if (accesskey && *accesskey) {
2683     W_L(" accesskey=\"");
2684     W_V(accesskey);
2685     W_L("\"");
2686   }
2687   if (istyle && (*istyle == '1' || *istyle == '2' || *istyle == '3' || *istyle == '4')) {
2688     /*------------------------------------------------------------------------*/
2689     /* CHTML 2.0                                                              */
2690     /*------------------------------------------------------------------------*/
2691     if (type && STRCASEEQ('p','P',"password", type) && ! ixhtml10->entryp->pc_flag ) {
2692       W_L(" style=\"-wap-input-format: &quot;*&lt;ja:n&gt;&quot;;\"");
2693     }
2694     else {
2695       char *vv = s_ixhtml10_istyle_to_wap_input_format(doc->buf.pool,istyle);
2696       W_L(" style=\"");
2697       W_L("-wap-input-format: ");
2698       W_V(vv);
2699       W_L(";");
2700       W_L("\"");
2701     }
2702   }
2703   else if (type && STRCASEEQ('p','P',"password",type)) {
2704     W_L(" style=\"-wap-input-format: &quot;*&lt;ja:n&gt;&quot;;\"");
2705   }
2706   /*--------------------------------------------------------------------------*/
2707   /* The figure is default for the password.                                  */
2708   /*--------------------------------------------------------------------------*/
2709   if (max_length && *max_length) {
2710     if (chxj_chk_numeric(max_length) == 0) {
2711       W_L(" maxlength=\"");
2712       W_V(max_length);
2713       W_L("\"");
2714     }
2715   }
2716
2717   if (checked) {
2718     W_L(" checked=\"checked\"");
2719   }
2720   W_L(" />");
2721 #endif
2722   return ixhtml10->out;
2723 }
2724
2725
2726 /**
2727  * It is a handler who processes the INPUT tag.
2728  *
2729  * @param pdoc  [i/o] The pointer to the IXHTML10 structure at the output
2730  *                     destination is specified.
2731  * @param node   [i]   The INPUT tag node is specified.
2732  * @return The conversion result is returned.
2733  */
2734 static char *
2735 s_ixhtml10_end_input_tag(void *pdoc, Node *UNUSED(child))
2736 {
2737   ixhtml10_t *ixhtml10 = GET_IXHTML10(pdoc);
2738   return ixhtml10->out;
2739 }
2740
2741
2742 /**
2743  * It is a handler who processes the CENTER tag.
2744  *
2745  * @param pdoc  [i/o] The pointer to the IXHTML10 structure at the output
2746  *                     destination is specified.
2747  * @param node   [i]   The CENTER tag node is specified.
2748  * @return The conversion result is returned.
2749  */
2750 static char *
2751 s_ixhtml10_start_center_tag(void *pdoc, Node *node)
2752 {
2753   ixhtml10_t *ixhtml10;
2754   Doc       *doc;
2755   Attr      *attr;
2756   char      *attr_style = NULL;
2757   char      *attr_color = NULL;
2758   char      *attr_size  = NULL;
2759
2760   ixhtml10 = GET_IXHTML10(pdoc);
2761   doc    = ixhtml10->doc;
2762
2763   for (attr = qs_get_attr(doc,node);
2764        attr;
2765        attr = qs_get_next_attr(doc,attr)) {
2766     char *name  = qs_get_attr_name(doc,attr);
2767     char *value = qs_get_attr_value(doc,attr);
2768     if (STRCASEEQ('s','S',"style",name) && value && *value) {
2769       attr_style = value;
2770     }
2771   }
2772   if (IS_CSS_ON(ixhtml10->entryp)) {
2773     css_prop_list_t *style = s_ixhtml10_nopush_and_get_now_style(pdoc, node, attr_style);
2774     if (style) {
2775       css_property_t *color_prop      = chxj_css_get_property_value(doc, style, "color");
2776       css_property_t *size_prop       = chxj_css_get_property_value(doc, style, "font-size");
2777       css_property_t *cur;
2778       for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
2779         if (cur->value && *cur->value) {
2780           attr_color = apr_pstrdup(doc->pool, cur->value);
2781         }
2782       }
2783       for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
2784         if (cur->value && *cur->value) {
2785           attr_size = apr_pstrdup(doc->pool, cur->value);
2786         }
2787       }
2788     }
2789   }
2790
2791   W_L("<div");
2792   W_L(" style=\"");
2793   W_L("text-align:center;");
2794   if (attr_size) {
2795     W_L("font-size:");
2796     W_V(attr_size);
2797     W_L(";");
2798   }
2799   if (attr_color) {
2800     attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
2801     W_L("color:");
2802     W_V(attr_color);
2803     W_L(";");
2804   }
2805   W_L("\"");
2806   W_L(">");
2807
2808   return ixhtml10->out;
2809 }
2810
2811
2812 /**
2813  * It is a handler who processes the CENTER tag.
2814  *
2815  * @param pdoc  [i/o] The pointer to the IXHTML10 structure at the output
2816  *                     destination is specified.
2817  * @param node   [i]   The CENTER tag node is specified.
2818  * @return The conversion result is returned.
2819  */
2820 static char *
2821 s_ixhtml10_end_center_tag(void *pdoc, Node *UNUSED(node))
2822 {
2823   ixhtml10_t    *ixhtml10;
2824   Doc         *doc;
2825   request_rec *r;
2826
2827   ixhtml10 = GET_IXHTML10(pdoc);
2828   doc    = ixhtml10->doc;
2829   r      = doc->r;
2830
2831   W_L("</div>");
2832   if (IS_CSS_ON(ixhtml10->entryp)) {
2833     chxj_css_pop_prop_list(ixhtml10->css_prop_stack);
2834   }
2835   return ixhtml10->out;
2836 }
2837
2838
2839 /**
2840  * It is a handler who processes the li tag.
2841  *
2842  * @param pdoc  [i/o] The pointer to the IXHTML10 structure at the output
2843  *                     destination is specified.
2844  * @param node   [i]   The li tag node is specified.
2845  * @return The conversion result is returned.
2846  */
2847 static char *
2848 s_ixhtml10_start_li_tag(void *pdoc, Node *node)
2849 {
2850   ixhtml10_t    *ixhtml10;
2851   Doc         *doc;
2852   request_rec *r;
2853   Attr        *attr;
2854   char        *attr_type  = NULL;
2855   char        *attr_value = NULL;
2856   char        *attr_style = NULL;
2857
2858   ixhtml10 = GET_IXHTML10(pdoc);
2859   doc   = ixhtml10->doc;
2860   r     = doc->r;
2861
2862   for (attr = qs_get_attr(doc,node);
2863        attr;
2864        attr = qs_get_next_attr(doc,attr)) {
2865     char *name  = qs_get_attr_name(doc,attr);
2866     char *value = qs_get_attr_value(doc,attr);
2867     if (STRCASEEQ('t','T',"type",name)) {
2868       if (value && (*value == '1' || *value == 'a' || *value == 'A' || STRCASEEQ('d','D',"disc",value) || STRCASEEQ('s','S',"square",value) || STRCASEEQ('c','C',"circle",value))) {
2869         if (*value == '1') {
2870           attr_type = apr_pstrdup(doc->pool, "decimal");
2871         }
2872         else if (*value == 'a') {
2873           attr_type = apr_pstrdup(doc->pool, "lower-alpha");
2874         }
2875         else if (*value == 'A') {
2876           attr_type = apr_pstrdup(doc->pool, "upper-alpha");
2877         }
2878         else {
2879           attr_type = value;
2880         }
2881       }
2882     }
2883     else if (STRCASEEQ('v','V',"value", name) && value && *value) {
2884       attr_value = value;
2885     }
2886     else if (STRCASEEQ('s','S',"style", name) && value && *value) {
2887       attr_style = value;
2888     }
2889   }
2890   if (IS_CSS_ON(ixhtml10->entryp)) {
2891     css_prop_list_t *style = s_ixhtml10_nopush_and_get_now_style(pdoc, node, attr_style);
2892     if (style) {
2893       css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "list-style-type");
2894       css_property_t *cur;
2895       for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
2896         if (STRCASEEQ('d','D',"decimal", cur->value)) {
2897           attr_type = apr_pstrdup(doc->pool, "decimal");
2898         }
2899         else if (STRCASEEQ('u','U',"upper-alpha", cur->value)) {
2900           attr_type = apr_pstrdup(doc->pool, "upper-alpha");
2901         }
2902         else if (STRCASEEQ('l','L',"lower-alpha", cur->value)) {
2903           attr_type = apr_pstrdup(doc->pool, "lower-alpha");
2904         }
2905         else if (STRCASEEQ('d','D',"disc", cur->value)) {
2906           attr_type = apr_pstrdup(doc->pool, "disc");
2907         }
2908         else if (STRCASEEQ('s','S',"square", cur->value)) {
2909           attr_type = apr_pstrdup(doc->pool, "square");
2910         }
2911         else if (STRCASEEQ('c','C',"circle", cur->value)) {
2912           attr_type = apr_pstrdup(doc->pool, "circle");
2913         }
2914       }
2915     }
2916   }
2917
2918
2919   W_L("<li");
2920   if (attr_type) {
2921     W_L(" style=\"");
2922     W_L("list-style-type:");
2923     W_V(attr_type);
2924     W_L(";");
2925     W_L("\"");
2926   }
2927   if (attr_value) {
2928     W_L(" value=\"");
2929     W_V(attr_value);
2930     W_L("\"");
2931   }
2932   W_L(">");
2933   return ixhtml10->out;
2934 }
2935
2936
2937 /**
2938  * It is a handler who processes the li tag.
2939  *
2940  * @param pdoc  [i/o] The pointer to the IXHTML10 structure at the output
2941  *                     destination is specified.
2942  * @param node   [i]   The li tag node is specified.
2943  * @return The conversion result is returned.
2944  */
2945 static char *
2946 s_ixhtml10_end_li_tag(void *pdoc, Node *UNUSED(child))
2947 {
2948   ixhtml10_t     *ixhtml10;
2949   Doc         *doc;
2950   request_rec *r;
2951
2952   ixhtml10 = GET_IXHTML10(pdoc);
2953   doc   = ixhtml10->doc;
2954   r     = doc->r;
2955
2956   if (IS_CSS_ON(ixhtml10->entryp)) {
2957     chxj_css_pop_prop_list(ixhtml10->css_prop_stack);
2958   }
2959   W_L("</li>");
2960   return ixhtml10->out;
2961 }
2962
2963
2964 /**
2965  * It is a handler who processes the OL tag.
2966  *
2967  * @param pdoc  [i/o] The pointer to the IXHTML10 structure at the output
2968  *                     destination is specified.
2969  * @param node   [i]   The OL tag node is specified.
2970  * @return The conversion result is returned.
2971  */
2972 static char *
2973 s_ixhtml10_start_ol_tag(void *pdoc, Node *node)
2974 {
2975   ixhtml10_t    *ixhtml10;
2976   Doc         *doc;
2977   request_rec *r;
2978   Attr        *attr;
2979   char        *attr_style = NULL;
2980   char        *attr_start = NULL;
2981   char        *attr_type  = NULL;
2982   char        *css_clear  = NULL;
2983
2984   ixhtml10 = GET_IXHTML10(pdoc);
2985   doc   = ixhtml10->doc;
2986   r     = doc->r;
2987
2988   /*--------------------------------------------------------------------------*/
2989   /* Get Attributes                                                           */
2990   /*--------------------------------------------------------------------------*/
2991   for (attr = qs_get_attr(doc,node);
2992        attr;
2993        attr = qs_get_next_attr(doc,attr)) {
2994     char *name = qs_get_attr_name(doc,attr);
2995     char *value = qs_get_attr_value(doc,attr);
2996     if (STRCASEEQ('t','T',"type",name) && value) {
2997       if (*value == '1') {
2998         attr_type = apr_pstrdup(doc->pool, "decimal");
2999       }
3000       else if (*value == 'a') {
3001         attr_type = apr_pstrdup(doc->pool, "lower-alpha");
3002       }
3003       else if (*value == 'A') {
3004         attr_type = apr_pstrdup(doc->pool, "upper-alpha");
3005       }
3006     }
3007     else if (STRCASEEQ('s','S',"start",name) && value && *value) {
3008       attr_start = value;
3009     }
3010     else if (STRCASEEQ('s','S',"style", name) && value && *value) {
3011       attr_style = value;
3012     }
3013   }
3014   if (IS_CSS_ON(ixhtml10->entryp)) {
3015     css_prop_list_t *style = s_ixhtml10_nopush_and_get_now_style(pdoc, node, attr_style);
3016     if (style) {
3017       css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "list-style-type");
3018       css_property_t *clear_prop           = chxj_css_get_property_value(doc, style, "clear");
3019       css_property_t *cur;
3020       for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
3021         if (STRCASEEQ('d','D',"decimal", cur->value)) {
3022           attr_type = apr_pstrdup(doc->pool, "decimal");
3023         }
3024         else if (STRCASEEQ('u','U',"upper-alpha", cur->value)) {
3025           attr_type = apr_pstrdup(doc->pool, "upper-alpha");
3026         }
3027         else if (STRCASEEQ('l','L',"lower-alpha", cur->value)) {
3028           attr_type = apr_pstrdup(doc->pool, "lower-alpha");
3029         }
3030       }
3031       for (cur = clear_prop->next; cur != clear_prop; cur = cur->next) {
3032         css_clear = apr_pstrdup(doc->pool, cur->value);
3033       }
3034     }
3035   }
3036   W_L("<ol");
3037   if (attr_type || css_clear) {
3038     W_L(" style=\"");
3039     if (attr_type) {
3040       W_L("list-style-type:");
3041       W_V(attr_type);
3042       W_L(";");
3043     }
3044     if (css_clear) {
3045       W_L("clear:");
3046       W_V(css_clear);
3047       W_L(";");
3048     }
3049     W_L("\"");
3050   }
3051   if (attr_start) {
3052     W_L(" start=\"");
3053     W_V(attr_start);
3054     W_L("\"");
3055   }
3056   W_L(">");
3057
3058   return ixhtml10->out;
3059 }
3060
3061
3062 /**
3063  * It is a handler who processes the OL tag.
3064  *
3065  * @param pdoc  [i/o] The pointer to the IXHTML10 structure at the output
3066  *                     destination is specified.
3067  * @param node   [i]   The OL tag node is specified.
3068  * @return The conversion result is returned.
3069  */
3070 static char *
3071 s_ixhtml10_end_ol_tag(void *pdoc, Node *UNUSED(child))
3072 {
3073   ixhtml10_t     *ixhtml10;
3074   Doc         *doc;
3075   request_rec *r;
3076
3077   ixhtml10 = GET_IXHTML10(pdoc);
3078   doc   = ixhtml10->doc;
3079   r     = doc->r;
3080
3081   W_L("</ol>");
3082   if (IS_CSS_ON(ixhtml10->entryp)) {
3083     chxj_css_pop_prop_list(ixhtml10->css_prop_stack);
3084   }
3085   return ixhtml10->out;
3086 }
3087
3088
3089 /**
3090  * It is a handler who processes the P tag.
3091  *
3092  * @param pdoc  [i/o] The pointer to the IXHTML10 structure at the output
3093  *                     destination is specified.
3094  * @param node   [i]   The P tag node is specified.
3095  * @return The conversion result is returned.
3096  */
3097 static char *
3098 s_ixhtml10_start_p_tag(void *pdoc, Node *node)
3099 {
3100   ixhtml10_t    *ixhtml10;
3101   Doc         *doc;
3102   request_rec *r;
3103   Attr        *attr;
3104   char        *attr_align = NULL;
3105   char        *attr_style = NULL;
3106   char        *attr_color = NULL;
3107   char        *attr_blink = NULL;
3108   char        *css_clear  = NULL;
3109
3110   ixhtml10 = GET_IXHTML10(pdoc);
3111   doc   = ixhtml10->doc;
3112   r     = doc->r;
3113
3114   for (attr = qs_get_attr(doc,node);
3115        attr;
3116        attr = qs_get_next_attr(doc,attr)) {
3117     char *nm  = qs_get_attr_name(doc,attr);
3118     char *val = qs_get_attr_value(doc,attr);
3119     if (STRCASEEQ('a','A',"align", nm)) {
3120       /*----------------------------------------------------------------------*/
3121       /* CHTML 1.0 (W3C version 3.2)                                          */
3122       /*----------------------------------------------------------------------*/
3123       if (val && (STRCASEEQ('l','L',"left",val) || STRCASEEQ('r','R',"right",val) || STRCASEEQ('c','C',"center",val))) {
3124         attr_align = apr_pstrdup(doc->buf.pool, val);
3125         break;
3126       }
3127     }
3128     else if (STRCASEEQ('s','S',"style", nm) && val && *val) {
3129       attr_style = apr_pstrdup(doc->buf.pool, val);
3130     }
3131   }
3132   if (IS_CSS_ON(ixhtml10->entryp)) {
3133     css_prop_list_t *style = s_ixhtml10_nopush_and_get_now_style(pdoc, node, attr_style);
3134     if (style) {
3135       css_property_t *text_align_prop = chxj_css_get_property_value(doc, style, "text-align");
3136       css_property_t *color_prop      = chxj_css_get_property_value(doc, style, "color");
3137       css_property_t *text_deco_prop  = chxj_css_get_property_value(doc, style, "text-decoration");
3138       css_property_t *clear_prop      = chxj_css_get_property_value(doc, style, "clear");
3139       
3140       css_property_t *cur;
3141       for (cur = text_align_prop->next; cur != text_align_prop; cur = cur->next) {
3142         if (STRCASEEQ('l','L',"left",cur->value)) {
3143           attr_align = apr_pstrdup(doc->pool, "left");
3144         }
3145         else if (STRCASEEQ('c','C',"center",cur->value)) {
3146           attr_align = apr_pstrdup(doc->pool, "center");
3147         }
3148         else if (STRCASEEQ('r','R',"right",cur->value)) {
3149           attr_align = apr_pstrdup(doc->pool, "right");
3150         }
3151       }
3152       for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
3153         if (cur->value && *cur->value) {
3154           attr_color = apr_pstrdup(doc->pool, cur->value);
3155         }
3156       }
3157       for (cur = text_deco_prop->next; cur != text_deco_prop; cur = cur->next) {
3158         if (cur->value && *cur->value && STRCASEEQ('b','B',"blink",cur->value)) {
3159           attr_blink = apr_pstrdup(doc->pool, cur->value);
3160         }
3161       }
3162       for (cur = clear_prop->next; cur != clear_prop; cur = cur->next) {
3163         css_clear = apr_pstrdup(doc->pool, cur->value);
3164       }
3165     }
3166   }
3167   W_L("<p");
3168   if ((attr_align && *attr_align) || (attr_color && *attr_color) || (attr_blink && *attr_blink) || css_clear) {
3169     W_L(" style=\"");
3170     if (attr_align) {
3171       W_L("text-align:");
3172       W_V(attr_align);
3173       W_L(";");
3174     }
3175     if (attr_color) {
3176       attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
3177       W_L("color:");
3178       W_V(attr_color);
3179       W_L(";");
3180     }
3181     if (attr_blink) {
3182       W_L("text-decoration:");
3183       W_V(attr_blink);
3184       W_L(";");
3185     }
3186     if (css_clear){
3187       W_L("clear:");
3188       W_V(css_clear);
3189       W_L(";");
3190     }
3191     W_L("\"");
3192   }
3193   W_L(">");
3194   return ixhtml10->out;
3195 }
3196
3197
3198 /**
3199  * It is a handler who processes the P tag.
3200  *
3201  * @param pdoc  [i/o] The pointer to the IXHTML10 structure at the output
3202  *                     destination is specified.
3203  * @param node   [i]   The P tag node is specified.
3204  * @return The conversion result is returned.
3205  */
3206 static char *
3207 s_ixhtml10_end_p_tag(void *pdoc, Node *UNUSED(child))
3208 {
3209   ixhtml10_t  *ixhtml10 = GET_IXHTML10(pdoc);
3210   Doc       *doc    = ixhtml10->doc;
3211
3212   W_L("</p>");
3213   if (IS_CSS_ON(ixhtml10->entryp)) {
3214     chxj_css_pop_prop_list(ixhtml10->css_prop_stack);
3215   }
3216   return ixhtml10->out;
3217 }
3218
3219
3220 /**
3221  * It is a handler who processes the PRE tag.
3222  *
3223  * @param pdoc  [i/o] The pointer to the IXHTML10 structure at the output
3224  *                     destination is specified.
3225  * @param node   [i]   The PRE tag node is specified.
3226  * @return The conversion result is returned.
3227  */
3228 static char *
3229 s_ixhtml10_start_pre_tag(void *pdoc, Node *node)
3230 {
3231   ixhtml10_t  *ixhtml10 = GET_IXHTML10(pdoc);
3232   Doc       *doc   = ixhtml10->doc;
3233   Attr      *attr;
3234   char      *attr_style = NULL;
3235   char      *css_clear  = NULL;
3236
3237   for (attr = qs_get_attr(doc,node);
3238        attr;
3239        attr = qs_get_next_attr(doc,attr)) {
3240     char *nm  = qs_get_attr_name(doc,attr);
3241     char *val = qs_get_attr_value(doc,attr);
3242     if (val && STRCASEEQ('s','S',"style", nm)) {
3243       attr_style = val;
3244     }
3245   }
3246
3247   if (IS_CSS_ON(ixhtml10->entryp)) {
3248     css_prop_list_t *style = s_ixhtml10_nopush_and_get_now_style(pdoc, node, attr_style);
3249     if (style) {
3250       css_property_t *clear_prop           = chxj_css_get_property_value(doc, style, "clear");
3251       
3252       css_property_t *cur;
3253       for (cur = clear_prop->next; cur != clear_prop; cur = cur->next) {
3254         css_clear = apr_pstrdup(doc->pool, cur->value);
3255       }
3256     }
3257   }
3258
3259   ixhtml10->pre_flag++;
3260   W_L("<pre");
3261   if (css_clear) {
3262     W_L(" style=\"");
3263     W_L("clear:");
3264     W_V(css_clear);
3265     W_L(";");
3266     W_L("\"");
3267   }
3268   W_L(">");
3269   return ixhtml10->out;
3270 }
3271
3272
3273 /**
3274  * It is a handler who processes the PRE tag.
3275  *
3276  * @param pdoc  [i/o] The pointer to the IXHTML10 structure at the output
3277  *                     destination is specified.
3278  * @param node   [i]   The PRE tag node is specified.
3279  * @return The conversion result is returned.
3280  */
3281 static char *
3282 s_ixhtml10_end_pre_tag(void *pdoc, Node *UNUSED(child))
3283 {
3284   ixhtml10_t *ixhtml10 = GET_IXHTML10(pdoc);
3285   Doc     *doc   = ixhtml10->doc;
3286
3287   W_L("</pre>");
3288   ixhtml10->pre_flag--;
3289   if (IS_CSS_ON(ixhtml10->entryp)) {
3290     chxj_css_pop_prop_list(ixhtml10->css_prop_stack);
3291   }
3292
3293   return ixhtml10->out;
3294 }
3295
3296
3297 /**
3298  * It is a handler who processes the UL tag.
3299  *
3300  * @param pdoc  [i/o] The pointer to the IXHTML10 structure at the output
3301  *                     destination is specified.
3302  * @param node   [i]   The UL tag node is specified.
3303  * @return The conversion result is returned.
3304  */
3305 static char *
3306 s_ixhtml10_start_ul_tag(void *pdoc, Node *node)
3307 {
3308   ixhtml10_t *ixhtml10 = GET_IXHTML10(pdoc);
3309   Doc      *doc    = ixhtml10->doc;
3310   Attr     *attr;
3311   char     *attr_type = NULL;
3312   char     *attr_style = NULL;
3313   char     *css_clear  = NULL;
3314   
3315   /*--------------------------------------------------------------------------*/
3316   /* Get Attributes                                                           */
3317   /*--------------------------------------------------------------------------*/
3318   for (attr = qs_get_attr(doc,node);
3319        attr;
3320        attr = qs_get_next_attr(doc,attr)) {
3321     char *name   = qs_get_attr_name(doc,attr);
3322     char *value  = qs_get_attr_value(doc,attr);
3323     if (STRCASEEQ('t','T',"type",name)) {
3324       if (value && (STRCASEEQ('d','D',"disc",value) || STRCASEEQ('c','C',"circle",value) || STRCASEEQ('s','S',"square",value))) {
3325         attr_type = value;
3326       }
3327     }
3328     else if (value && *value && STRCASEEQ('s','S',"style", name)) {
3329       attr_style = value;
3330     }
3331   }
3332   if (IS_CSS_ON(ixhtml10->entryp)) {
3333     css_prop_list_t *style = s_ixhtml10_nopush_and_get_now_style(pdoc, node, attr_style);
3334     if (style) {
3335       css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "list-style-type");
3336       css_property_t *clear_prop      = chxj_css_get_property_value(doc, style, "clear");
3337       css_property_t *cur;
3338       for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
3339         if (STRCASEEQ('d','D',"disc",cur->value)) {
3340           attr_type = apr_pstrdup(doc->pool, "disc");
3341         }
3342         else if (STRCASEEQ('c','C',"circle",cur->value)) {
3343           attr_type = apr_pstrdup(doc->pool, "circle");
3344         }
3345         else if (STRCASEEQ('s','S',"square",cur->value)) {
3346           attr_type = apr_pstrdup(doc->pool, "square");
3347         }
3348       }
3349       for (cur = clear_prop->next; cur != clear_prop; cur = cur->next) {
3350         css_clear = apr_pstrdup(doc->pool, cur->value);
3351       }
3352     }
3353   }
3354   W_L("<ul");
3355   if (attr_type || css_clear) {
3356     W_L(" style=\"");
3357     if (attr_type) {
3358       W_L("list-style-type:");
3359       W_V(attr_type);
3360       W_L(";");
3361     }
3362     if (css_clear) {
3363       W_L("clear:");
3364       W_V(css_clear);
3365       W_L(";");
3366     }
3367     W_L("\"");
3368   }
3369   W_L(">");
3370   return ixhtml10->out;
3371 }
3372
3373
3374 /**
3375  * It is a handler who processes the UL tag.
3376  *
3377  * @param pdoc  [i/o] The pointer to the IXHTML10 structure at the output
3378  *                     destination is specified.
3379  * @param node   [i]   The UL tag node is specified.
3380  * @return The conversion result is returned.
3381  */
3382 static char *
3383 s_ixhtml10_end_ul_tag(void *pdoc, Node *UNUSED(child))
3384 {
3385   ixhtml10_t *ixhtml10 = GET_IXHTML10(pdoc);
3386   Doc     *doc   = ixhtml10->doc;
3387
3388   W_L("</ul>");
3389   if (IS_CSS_ON(ixhtml10->entryp)) {
3390     chxj_css_pop_prop_list(ixhtml10->css_prop_stack);
3391   }
3392   return ixhtml10->out;
3393 }
3394
3395
3396 /**
3397  * It is a handler who processes the HR tag.
3398  *
3399  * @param pdoc  [i/o] The pointer to the IXHTML10 structure at the output
3400  *                     destination is specified.
3401  * @param node   [i]   The HR tag node is specified.
3402  * @return The conversion result is returned.
3403  */
3404 static char *
3405 s_ixhtml10_start_hr_tag(void *pdoc, Node *node)
3406 {
3407   Attr        *attr;
3408   ixhtml10_t     *ixhtml10;
3409   Doc         *doc;
3410   request_rec *r;
3411   char        *attr_align   = NULL;
3412   char        *attr_size    = NULL;
3413   char        *attr_width   = NULL;
3414   char        *attr_noshade = NULL;
3415   char        *attr_style   = NULL;
3416   char        *attr_color   = NULL;
3417   char        *attr_bgcolor = NULL;
3418   char        *css_clear    = NULL;
3419
3420   ixhtml10   = GET_IXHTML10(pdoc);
3421   doc     = ixhtml10->doc;
3422   r       = doc->r;
3423
3424   for (attr = qs_get_attr(doc,node);
3425        attr;
3426        attr = qs_get_next_attr(doc,attr)) {
3427     char *name  = qs_get_attr_name (doc,attr);
3428     char *value = qs_get_attr_value(doc,attr);
3429     switch(*name) {
3430     case 'a':
3431     case 'A':
3432       if (strcasecmp(name, "align") == 0) {
3433         /*--------------------------------------------------------------------*/
3434         /* CHTML 1.0                                                          */
3435         /*--------------------------------------------------------------------*/
3436         if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
3437           attr_align = value;
3438         }
3439       }
3440       break;
3441
3442     case 's':
3443     case 'S':
3444       if (strcasecmp(name, "size") == 0) {
3445         /*--------------------------------------------------------------------*/
3446         /* CHTML 1.0                                                          */
3447         /*--------------------------------------------------------------------*/
3448         if (value && *value) {
3449           attr_size = value;
3450         }
3451       }
3452       else if (strcasecmp(name, "style") == 0) {
3453         if (value && *value) {
3454           attr_style = value;
3455         }
3456       }
3457       break;
3458
3459     case 'w':
3460     case 'W':
3461       if (strcasecmp(name, "width") == 0) {
3462         /*--------------------------------------------------------------------*/
3463         /* CHTML 1.0                                                          */
3464         /*--------------------------------------------------------------------*/
3465         if (value && *value) {
3466           attr_width = value;
3467         }
3468       }
3469       break;
3470
3471     case 'n':
3472     case 'N':
3473       if (strcasecmp(name, "noshade") == 0) {
3474         /*--------------------------------------------------------------------*/
3475         /* CHTML 1.0                                                          */
3476         /*--------------------------------------------------------------------*/
3477         attr_noshade = apr_pstrdup(doc->pool, "noshade");
3478       }
3479       break;
3480
3481     case 'c':
3482     case 'C':
3483       if (strcasecmp(name, "color") == 0 && value && *value) {
3484         /*--------------------------------------------------------------------*/
3485         /* CHTML 4.0                                                          */
3486         /*--------------------------------------------------------------------*/
3487         attr_color   = value;
3488         attr_bgcolor = value;
3489       }
3490       break;
3491
3492     default:
3493       break;
3494     }
3495   }
3496   if (IS_CSS_ON(ixhtml10->entryp)) {
3497     css_prop_list_t *style = s_ixhtml10_nopush_and_get_now_style(pdoc, node, attr_style);
3498     if (style) {
3499       css_property_t *border_style_prop = chxj_css_get_property_value(doc, style, "border-style");
3500       css_property_t *height_prop       = chxj_css_get_property_value(doc, style, "height");
3501       css_property_t *width_prop        = chxj_css_get_property_value(doc, style, "width");
3502       css_property_t *color_prop        = chxj_css_get_property_value(doc, style, "border-color");
3503       css_property_t *bgcolor_prop      = chxj_css_get_property_value(doc, style, "background-color");
3504       css_property_t *float_prop        = chxj_css_get_property_value(doc, style, "float");
3505       css_property_t *clear_prop        = chxj_css_get_property_value(doc, style, "clear");
3506       css_property_t *cur;
3507       for (cur = border_style_prop->next; cur != border_style_prop; cur = cur->next) {
3508         if (STRCASEEQ('s','S',"solid",cur->value)) {
3509           attr_noshade = "noshade";
3510         }
3511       }
3512       for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
3513         attr_color = apr_pstrdup(doc->pool, cur->value);
3514       }
3515       for (cur = bgcolor_prop->next; cur != bgcolor_prop; cur = cur->next) {
3516         attr_bgcolor = apr_pstrdup(doc->pool, cur->value);
3517       }
3518       for (cur = height_prop->next; cur != height_prop; cur = cur->next) {
3519         attr_size = apr_pstrdup(doc->pool, cur->value);
3520       }
3521       for (cur = width_prop->next; cur != width_prop; cur = cur->next) {
3522         char *tmp = apr_pstrdup(doc->pool, cur->value);
3523         char *tmpp = strstr(tmp, "px");
3524         if (tmpp) {
3525           attr_width = apr_pstrdup(doc->pool, tmp);
3526         }
3527         else {
3528           tmpp = strstr(tmp, "%");
3529           if (tmpp) {
3530             attr_width = apr_pstrdup(doc->pool, tmp);
3531           }
3532         }
3533       }
3534       if(!attr_align){
3535         for (cur = float_prop->next; cur != float_prop; cur = cur->next) {
3536           char *tmp = apr_pstrdup(doc->pool, cur->value);
3537           if(tmp){
3538             attr_align = apr_pstrdup(doc->pool,tmp);
3539           }
3540         }
3541       }
3542       for (cur = clear_prop->next; cur != clear_prop; cur = cur->next) {
3543         css_clear = apr_pstrdup(doc->pool, cur->value);
3544       }
3545     }
3546   }
3547   W_L("<hr");
3548   if (attr_align || attr_size || attr_width || attr_noshade || attr_color || attr_bgcolor || css_clear) {
3549     W_L(" style=\"");
3550     if (attr_align) {
3551       W_L("float:");
3552       if (STRCASEEQ('c','C',"center",attr_align)) {
3553         W_L("none");
3554       }
3555       else {
3556         W_V(attr_align);
3557       }
3558       W_L(";");
3559     }
3560     if (attr_size) {
3561       W_L("height:");
3562       W_V(attr_size);
3563       if (chxj_chk_numeric(attr_size) == 0) {
3564         W_L("px");
3565       }
3566       W_L(";");
3567     }
3568     if (attr_width) {
3569       W_L("width:");
3570       W_V(attr_width);
3571       if (!strstr(attr_width, "px") && !strstr(attr_width, "%")) {
3572         W_L("px");
3573       }
3574       W_L(";");
3575     }
3576     if (attr_noshade) {
3577       W_L("border-style:solid;");
3578     }
3579     if (attr_color) {
3580       W_L("border-color:");
3581       W_V(attr_color);
3582       W_L(";");
3583     }
3584     if (attr_bgcolor) {
3585       W_L("background-color:");
3586       W_V(attr_bgcolor);
3587       W_L(";");
3588     }
3589     if (css_clear){
3590       W_L("clear:");
3591       W_V(css_clear);
3592       W_L(";");
3593     }
3594     W_L("\"");
3595   }
3596   W_L(" />");
3597
3598   return ixhtml10->out;
3599 }
3600
3601
3602 /**
3603  * It is a handler who processes the HR tag.
3604  *
3605  * @param ixhtml10  [i/o] The pointer to the IXHTML10 structure at the output
3606  *                     destination is specified.
3607  * @param node   [i]   The HR tag node is specified.
3608  * @return The conversion result is returned.
3609  */
3610 static char *
3611 s_ixhtml10_end_hr_tag(void *pdoc, Node *UNUSED(child))
3612 {
3613   ixhtml10_t *ixhtml10 = GET_IXHTML10(pdoc);
3614   return ixhtml10->out;
3615 }
3616
3617
3618 /**
3619  * It is a handler who processes the IMG tag.
3620  *
3621  * @param pdoc  [i/o] The pointer to the IXHTML10 structure at the output
3622  *                     destination is specified.
3623  * @param node   [i]   The IMG tag node is specified.
3624  * @return The conversion result is returned.
3625  */
3626 static char *
3627 s_ixhtml10_start_img_tag(void *pdoc, Node *node)
3628 {
3629   ixhtml10_t    *ixhtml10 = GET_IXHTML10(pdoc);
3630   Doc         *doc   = ixhtml10->doc;
3631   request_rec *r     = doc->r;
3632   Attr        *attr;
3633   char        *attr_src    = NULL;
3634   char        *attr_height = NULL;
3635   char        *attr_width  = NULL;
3636   char        *attr_align  = NULL;
3637   char        *attr_alt    = NULL;
3638   char        *attr_style  = NULL;
3639   char        *attr_hspace = NULL;
3640   char        *attr_vspace = NULL;
3641   
3642   char        *css_float          = NULL;
3643   char        *css_margin_left    = NULL;
3644   char        *css_margin_right   = NULL;
3645   char        *css_margin_top     = NULL;
3646   char        *css_margin_bottom  = NULL;
3647   char        *css_display        = NULL;
3648   char        *css_valign         = NULL;
3649   
3650 #ifndef IMG_NOT_CONVERT_FILENAME
3651   device_table  *spec = ixhtml10->spec;
3652 #endif
3653
3654   /*--------------------------------------------------------------------------*/
3655   /* Get Attributes                                                           */
3656   /*--------------------------------------------------------------------------*/
3657   for (attr = qs_get_attr(doc,node);
3658        attr;
3659        attr = qs_get_next_attr(doc,attr)) {
3660     char *name  = qs_get_attr_name(doc,attr);
3661     char *value = qs_get_attr_value(doc,attr);
3662     if (STRCASEEQ('s','S',"src",name)) {
3663       /*----------------------------------------------------------------------*/
3664       /* CHTML 1.0                                                            */
3665       /*----------------------------------------------------------------------*/
3666 #ifdef IMG_NOT_CONVERT_FILENAME
3667       value = chxj_encoding_parameter(r, value, 1);
3668       value = chxj_add_cookie_parameter(r, value, ixhtml10->cookie);
3669       value = chxj_add_cookie_no_update_parameter(r, value, 1);
3670       value = chxj_img_rewrite_parameter(r,ixhtml10->conf,value);
3671       attr_src = value;
3672 #else
3673       value = chxj_img_conv(r, spec, value);
3674       value = chxj_encoding_parameter(r, value, 1);
3675       value = chxj_add_cookie_parameter(r, value, ixhtml10->cookie);
3676       value = chxj_add_cookie_no_update_parameter(r, value, 1);
3677       value = chxj_img_rewrite_parameter(r,ixhtml10->conf,value);
3678       attr_src = value;
3679 #endif
3680     }
3681     else if (STRCASEEQ('a','A',"align",name)) {
3682       /*----------------------------------------------------------------------*/
3683       /* CHTML 1.0                                                            */
3684       /*----------------------------------------------------------------------*/
3685       if (value) {
3686         if (STRCASEEQ('t','T',"top",   value) ||
3687             STRCASEEQ('m','M',"middle",value) ||
3688             STRCASEEQ('b','B',"bottom",value) ||
3689             STRCASEEQ('l','L',"left",  value) ||
3690             STRCASEEQ('r','R',"right", value)) {
3691           attr_align = value;
3692         }
3693         else if (STRCASEEQ('c','C',"center",value)) {
3694           attr_align = apr_pstrdup(doc->pool, "middle");
3695         }
3696       }
3697     }
3698     else if (STRCASEEQ('w','W',"width",name) && value && *value) {
3699       /*----------------------------------------------------------------------*/
3700       /* CHTML 1.0                                                            */
3701       /*----------------------------------------------------------------------*/
3702       attr_width = value;
3703     }
3704     else if (STRCASEEQ('h','H',"height",name) && value && *value) {
3705       /*----------------------------------------------------------------------*/
3706       /* CHTML 1.0                                                            */
3707       /*----------------------------------------------------------------------*/
3708       attr_height = value;
3709     }
3710     else if (STRCASEEQ('h','H',"hspace",name) && value && *value) {
3711       /*----------------------------------------------------------------------*/
3712       /* CHTML 1.0                                                            */
3713       /*----------------------------------------------------------------------*/
3714       attr_hspace = value;
3715     }
3716     else if (STRCASEEQ('v','V',"vspace",name) && value && *value) {
3717       /*----------------------------------------------------------------------*/
3718       /* CHTML 1.0                                                            */
3719       /*----------------------------------------------------------------------*/
3720       attr_vspace = value;
3721     }
3722     else if (STRCASEEQ('a','A',"alt",name) && value && *value) {
3723       /*----------------------------------------------------------------------*/
3724       /* CHTML 1.0                                                            */
3725       /*----------------------------------------------------------------------*/
3726       attr_alt = value;
3727     }
3728     else if (STRCASEEQ('s','S',"style",name) && value && *value) {
3729       /*----------------------------------------------------------------------*/
3730       /* CHTML 1.0                                                            */
3731       /*----------------------------------------------------------------------*/
3732       attr_style = value;
3733     }
3734   }
3735
3736   if (IS_CSS_ON(ixhtml10->entryp)) {
3737     css_prop_list_t *style = s_ixhtml10_nopush_and_get_now_style(pdoc, node, attr_style);
3738     if (style) {
3739       css_property_t *height_prop = chxj_css_get_property_value(doc, style, "height");
3740       css_property_t *width_prop  = chxj_css_get_property_value(doc, style, "width");
3741       css_property_t *valign_prop = chxj_css_get_property_value(doc, style, "vertical-align");
3742       css_property_t *margin_left_prop   = chxj_css_get_property_value(doc, style, "margin-left");
3743       css_property_t *margin_right_prop  = chxj_css_get_property_value(doc, style, "margin-right");
3744       css_property_t *margin_top_prop    = chxj_css_get_property_value(doc, style, "margin-top");
3745       css_property_t *margin_bottom_prop = chxj_css_get_property_value(doc, style, "margin-bottom");
3746       
3747       
3748       css_property_t *cur;
3749       for (cur = height_prop->next; cur != height_prop; cur = cur->next) {
3750         attr_height = apr_pstrdup(doc->pool, cur->value);
3751       }
3752       for (cur = width_prop->next; cur != width_prop; cur = cur->next) {
3753         attr_width = apr_pstrdup(doc->pool, cur->value);
3754       }
3755       for (cur = valign_prop->next; cur != valign_prop; cur = cur->next) {
3756         css_valign = apr_pstrdup(doc->pool, cur->value);
3757       }
3758       
3759       if (! attr_hspace) {
3760         for (cur = margin_left_prop->next; cur != margin_left_prop; cur = cur->next) {
3761           css_margin_left   = apr_pstrdup(doc->pool, cur->value);
3762         }
3763         for (cur = margin_right_prop->next; cur != margin_right_prop; cur = cur->next) {
3764           css_margin_right  = apr_pstrdup(doc->pool, cur->value);
3765         }
3766       }
3767       
3768       if (! attr_vspace) {
3769         for (cur = margin_top_prop->next; cur != margin_top_prop; cur = cur->next) {
3770           css_margin_top = apr_pstrdup(doc->pool, cur->value);
3771         }
3772         for (cur = margin_bottom_prop->next; cur != margin_bottom_prop; cur = cur->next) {
3773           css_margin_bottom = apr_pstrdup(doc->pool, cur->value);
3774         }
3775       }
3776       
3777       css_property_t *float_prop = chxj_css_get_property_value(doc, style, "float");
3778       for (cur = float_prop->next; cur != float_prop; cur = cur->next) {
3779         css_float = apr_pstrdup(doc->pool, cur->value);
3780       }
3781       css_property_t *display_prop       = chxj_css_get_property_value(doc, style, "display");
3782       for (cur = display_prop->next; cur != display_prop; cur = cur->next) {
3783         char *tmp = apr_pstrdup(doc->pool, cur->value);
3784         char *tmpp = strstr(tmp, "none");
3785         if(tmpp){
3786           css_display = apr_pstrdup(doc->pool, tmp);
3787         }
3788       }
3789     }
3790   }
3791   
3792   if(!css_display){
3793
3794   W_L("<img");
3795   if (attr_src) {
3796     W_L(" src=\"");
3797     W_V(attr_src);
3798     DBG(r,"REQ[%X] mode is %d -> %s",TO_ADDR(r),ixhtml10->conf->image_rewrite_mode, attr_src);
3799     W_L("\"");
3800   }
3801   if (attr_align || attr_hspace || attr_vspace || css_float || css_margin_left || css_margin_right || css_margin_top || css_margin_bottom || css_valign ) {
3802     W_L(" style=\"");
3803     if (attr_align) {
3804       if (STRCASEEQ('t','T',"top", attr_align)) {
3805         css_valign = NULL;
3806         W_L("vertical-align:top;");
3807       }
3808       else if (STRCASEEQ('m','M',"middle", attr_align) || STRCASEEQ('c','C',"center",attr_align)) {
3809         css_valign = NULL;
3810         W_L("vertical-align:middle;");
3811       }
3812       else if (STRCASEEQ('b','B',"bottom", attr_align)) {
3813         css_valign = NULL;
3814         W_L("vertical-align:bottom;");
3815       }
3816       else if (STRCASEEQ('l','L',"left", attr_align)) {
3817         css_float = NULL;
3818         W_L("float:left;");
3819       }
3820       else if (STRCASEEQ('r','R',"right", attr_align)) {
3821         css_float = NULL;
3822         W_L("float:right;");
3823       }
3824    }
3825    
3826    
3827     if(css_float){
3828       W_L("float:");
3829       W_V(css_float);
3830       W_L(";");
3831     }
3832     if(css_valign){
3833       W_L("vertical-align:");
3834       W_V(css_valign);
3835       W_L(";");
3836     }
3837     
3838     if (attr_hspace) {
3839       W_L("margin-left:");
3840       W_V(attr_hspace);
3841       W_L(";");
3842       W_L("margin-right:");
3843       W_V(attr_hspace);
3844       W_L(";");
3845     }
3846     else{
3847       if(css_margin_left){
3848         W_L("margin-left:");
3849         W_V(css_margin_left);
3850         W_L(";");
3851       }
3852       if(css_margin_right){
3853         W_L("margin-right:");
3854         W_V(css_margin_right);
3855         W_L(";");
3856       }
3857     }
3858     if (attr_vspace) {
3859       W_L("margin-top:");
3860       W_V(attr_vspace);
3861       W_L(";");
3862       W_L("margin-bottom:");
3863       W_V(attr_vspace);
3864       W_L(";");
3865     }
3866     else{
3867       if(css_margin_top){
3868         W_L("margin-top:");
3869         W_V(css_margin_top);
3870         W_L(";");
3871       }
3872       if(css_margin_bottom){
3873         W_L("margin-bottom:");
3874         W_V(css_margin_bottom);
3875         W_L(";");
3876       }
3877     }
3878     W_L("\"");
3879   }
3880   if (attr_width) {
3881     W_L(" width=\"");
3882     W_V(attr_width);
3883     W_L("\"");
3884   }
3885   if (attr_height) {
3886     W_L(" height=\"");
3887     W_V(attr_height);
3888     W_L("\"");
3889   }
3890   if (attr_alt) {
3891     W_L(" alt=\"");
3892     W_V(attr_alt);
3893     W_L("\"");
3894   }
3895   else {
3896     W_L(" alt=\"\"");
3897   }
3898   W_L(" />");
3899   }
3900   return ixhtml10->out;
3901 }
3902
3903
3904 /**
3905  * It is a handler who processes the IMG tag.
3906  *
3907  * @param pdoc  [i/o] The pointer to the IXHTML10 structure at the output
3908  *                     destination is specified.
3909  * @param node   [i]   The IMG tag node is specified.
3910  * @return The conversion result is returned.
3911  */
3912 static char *
3913 s_ixhtml10_end_img_tag(void *pdoc, Node *UNUSED(child))
3914 {
3915   ixhtml10_t *ixhtml10 = GET_IXHTML10(pdoc);
3916   return ixhtml10->out;
3917 }
3918
3919
3920 /**
3921  * It is a handler who processes the SELECT tag.
3922  *
3923  * @param pdoc  [i/o] The pointer to the IXHTML10 structure at the output
3924  *                     destination is specified.
3925  * @param node   [i]   The SELECT tag node is specified.
3926  * @return The conversion result is returned.
3927  */
3928 static char *
3929 s_ixhtml10_start_select_tag(void *pdoc, Node *node)
3930 {
3931   ixhtml10_t *ixhtml10    = GET_IXHTML10(pdoc);
3932   Doc     *doc      = ixhtml10->doc;
3933   Attr    *attr;
3934   char    *size     = NULL;
3935   char    *name     = NULL;
3936   char    *multiple = NULL;
3937   char    *attr_style = NULL;
3938
3939   for (attr = qs_get_attr(doc,node);
3940        attr;
3941        attr = qs_get_next_attr(doc,attr)) {
3942     char *nm  = qs_get_attr_name(doc,attr);
3943     char *val = qs_get_attr_value(doc,attr);
3944     if (STRCASEEQ('s','S',"size",nm)) {
3945       /*----------------------------------------------------------------------*/
3946       /* CHTML 1.0 version 2.0                                                */
3947       /*----------------------------------------------------------------------*/
3948       size = apr_pstrdup(doc->buf.pool, val);
3949     }
3950     else if (STRCASEEQ('s','S',"style",nm) && val && *val) {
3951       /*----------------------------------------------------------------------*/
3952       /* CHTML 1.0 version 2.0                                                */
3953       /*----------------------------------------------------------------------*/
3954       attr_style = apr_pstrdup(doc->buf.pool, val);
3955     }
3956     else if (STRCASEEQ('n','N',"name",nm)) {
3957       /*----------------------------------------------------------------------*/
3958       /* CHTML 1.0 version 2.0                                                */
3959       /*----------------------------------------------------------------------*/
3960       name = apr_pstrdup(doc->buf.pool, val);
3961     }
3962     else if (STRCASEEQ('m','M',"multiple", nm)) {
3963       /*----------------------------------------------------------------------*/
3964       /* CHTML 1.0 version 2.0                                                */
3965       /*----------------------------------------------------------------------*/
3966       multiple = apr_pstrdup(doc->buf.pool, val);
3967     }
3968   }
3969   W_L("<select");
3970   if (size && *size) {
3971     W_L(" size=\"");
3972     W_V(size);
3973     W_L("\"");
3974   }
3975   if (name && *name) {
3976     W_L(" name=\"");
3977     W_V(name);
3978     W_L("\"");
3979   }
3980   if (multiple) {
3981     W_L(" multiple=\"multiple\"");
3982   }
3983   W_L(">");
3984
3985   if (IS_CSS_ON(ixhtml10->entryp)) {
3986     s_ixhtml10_nopush_and_get_now_style(pdoc, node, attr_style);
3987   }
3988
3989   return ixhtml10->out;
3990 }
3991
3992
3993 /**
3994  * It is a handler who processes the SELECT tag.
3995  *
3996  * @param pdoc  [i/o] The pointer to the IXHTML10 structure at the output
3997  *                     destination is specified.
3998  * @param node   [i]   The SELECT tag node is specified.
3999  * @return The conversion result is returned.
4000  */
4001 static char *
4002 s_ixhtml10_end_select_tag(void *pdoc, Node *UNUSED(child))
4003 {
4004   ixhtml10_t *ixhtml10 = GET_IXHTML10(pdoc);
4005   Doc     *doc   = ixhtml10->doc;
4006
4007   W_L("</select>");
4008   if (IS_CSS_ON(ixhtml10->entryp)) {
4009     chxj_css_pop_prop_list(ixhtml10->css_prop_stack);
4010   }
4011
4012   return ixhtml10->out;
4013 }
4014
4015 /**
4016  * It is a handler who processes the OPTION tag.
4017  *
4018  * @param pdoc  [i/o] The pointer to the IXHTML10 structure at the output
4019  *                     destination is specified.
4020  * @param node   [i]   The OPTION tag node is specified.
4021  * @return The conversion result is returned.
4022  */
4023 static char *
4024 s_ixhtml10_start_option_tag(void *pdoc, Node *node)
4025 {
4026   ixhtml10_t *ixhtml10 = GET_IXHTML10(pdoc);
4027   Doc     *doc   = ixhtml10->doc;
4028   Attr    *attr;
4029
4030   char *selected   = NULL;
4031   char *value      = NULL;
4032   char *attr_style = NULL;
4033
4034   for (attr = qs_get_attr(doc,node);
4035        attr;
4036        attr = qs_get_next_attr(doc,attr)) {
4037     char *nm  = qs_get_attr_name(doc,attr);
4038     char *val = qs_get_attr_value(doc,attr);
4039     if (STRCASEEQ('s','S',"selected",nm)) {
4040       /*----------------------------------------------------------------------*/
4041       /* CHTML 1.0 version 2.0                                                */
4042       /*----------------------------------------------------------------------*/
4043       selected = apr_pstrdup(doc->buf.pool, val);
4044     }
4045     else if (STRCASEEQ('s','S',"style",nm) && val && *val) {
4046       /*----------------------------------------------------------------------*/
4047       /* CHTML 1.0 version 2.0                                                */
4048       /*----------------------------------------------------------------------*/
4049       attr_style = apr_pstrdup(doc->buf.pool, val);
4050     }
4051     else if (STRCASEEQ('v','V',"value",nm)) {
4052       /*----------------------------------------------------------------------*/
4053       /* CHTML 1.0 version 2.0                                                */
4054       /*----------------------------------------------------------------------*/
4055       value = apr_pstrdup(doc->buf.pool, val);
4056     }
4057   }
4058   W_L("<option");
4059   if (value && *value) {
4060     W_L(" value=\"");
4061     W_V(value);
4062     W_L("\"");
4063   }
4064   if (selected) {
4065     W_L(" selected=\"selected\"");
4066   }
4067   W_L(">");
4068
4069   if (IS_CSS_ON(ixhtml10->entryp)) {
4070     s_ixhtml10_nopush_and_get_now_style(pdoc, node, attr_style);
4071   }
4072
4073   return ixhtml10->out;
4074 }
4075
4076
4077 /**
4078  * It is a handler who processes the OPTION tag.
4079  *
4080  * @param pdoc  [i/o] The pointer to the IXHTML10 structure at the output
4081  *                     destination is specified.
4082  * @param node   [i]   The OPTION tag node is specified.
4083  * @return The conversion result is returned.
4084  */
4085 static char *
4086 s_ixhtml10_end_option_tag(void *pdoc, Node *UNUSED(child))
4087 {
4088   ixhtml10_t *ixhtml10 = GET_IXHTML10(pdoc);
4089   Doc      *doc = ixhtml10->doc;
4090
4091   W_L("</option>");
4092   if (IS_CSS_ON(ixhtml10->entryp)) {
4093     chxj_css_pop_prop_list(ixhtml10->css_prop_stack);
4094   }
4095
4096   return ixhtml10->out;
4097 }
4098
4099
4100 /**
4101  * It is a handler who processes the DIV tag.
4102  *
4103  * @param pdoc  [i/o] The pointer to the IXHTML10 structure at the output
4104  *                     destination is specified.
4105  * @param node   [i]   The DIV tag node is specified.
4106  * @return The conversion result is returned.
4107  */
4108 static char *
4109 s_ixhtml10_start_div_tag(void *pdoc, Node *node)
4110 {
4111   ixhtml10_t  *ixhtml10;
4112   Doc         *doc;
4113   request_rec *r;
4114   Attr        *attr;
4115   char        *attr_style             = NULL;
4116   char        *attr_align             = NULL;
4117   char        *attr_display           = NULL;
4118   char        *attr_decoration        = NULL;
4119   char        *attr_wap_marquee_style = NULL;
4120   char        *attr_wap_marquee_dir   = NULL;
4121   char        *attr_wap_marquee_loop  = NULL;
4122   char        *attr_color             = NULL;
4123   char        *attr_bgcolor           = NULL;
4124   char        *attr_font_size         = NULL;
4125   char        *css_clear              = NULL;
4126
4127   ixhtml10 = GET_IXHTML10(pdoc);
4128   doc   = ixhtml10->doc;
4129   r     = doc->r;
4130
4131   for (attr = qs_get_attr(doc,node);
4132        attr;
4133        attr = qs_get_next_attr(doc,attr)) {
4134     char *nm  = qs_get_attr_name(doc,attr);
4135     char *val = qs_get_attr_value(doc,attr);
4136     if (STRCASEEQ('a','A',"align",nm)) {
4137       /*----------------------------------------------------------------------*/
4138       /* CHTML 1.0 (W3C version 3.2)                                          */
4139       /*----------------------------------------------------------------------*/
4140       if (val && (STRCASEEQ('l','L',"left",val) || STRCASEEQ('r','R',"right",val) || STRCASEEQ('c','C',"center",val))) {
4141         attr_align = apr_pstrdup(doc->buf.pool, val);
4142       }
4143     }
4144     else if (STRCASEEQ('s','S',"style",nm) && val && *val) {
4145       attr_style = apr_pstrdup(doc->buf.pool, val);
4146     }
4147   }
4148
4149   if (IS_CSS_ON(ixhtml10->entryp)) {
4150     css_prop_list_t *style = s_ixhtml10_nopush_and_get_now_style(pdoc, node, attr_style);
4151     if (style) {
4152       css_property_t *display_prop           = chxj_css_get_property_value(doc, style, "display");
4153       css_property_t *text_decoration_prop   = chxj_css_get_property_value(doc, style, "text-decoration");
4154       css_property_t *color_prop             = chxj_css_get_property_value(doc, style, "color");
4155       css_property_t *text_align_prop        = chxj_css_get_property_value(doc, style, "text-align");
4156       css_property_t *font_size_prop         = chxj_css_get_property_value(doc, style, "font-size");
4157       css_property_t *background_color_prop  = chxj_css_get_property_value(doc, style, "background-color");
4158       css_property_t *background_prop        = chxj_css_get_property_value(doc, style, "background");
4159       css_property_t *clear_prop             = chxj_css_get_property_value(doc, style, "clear");
4160
4161       css_property_t *cur;
4162       for (cur = display_prop->next; cur != display_prop; cur = cur->next) {
4163         if (strcasecmp("-wap-marquee", cur->value) == 0) {
4164           attr_display = apr_pstrdup(doc->pool, cur->value);
4165         }
4166       }
4167       for (cur = background_color_prop->next; cur != background_color_prop; cur = cur->next) {
4168         attr_bgcolor = apr_pstrdup(doc->pool, cur->value);
4169         attr_bgcolor = chxj_css_rgb_func_to_value(doc->pool, attr_bgcolor);
4170       }
4171       for (cur = background_prop->next; cur != background_prop; cur = cur->next) {
4172         char *ss = strchr(cur->value, '#');
4173         if (ss) {
4174           attr_bgcolor = apr_pstrdup(doc->pool, cur->value);
4175           attr_bgcolor = chxj_css_rgb_func_to_value(doc->pool, attr_bgcolor);
4176         }
4177       }
4178       for (cur = text_decoration_prop->next; cur != text_decoration_prop; cur = cur->next) {
4179         if (STRCASEEQ('b','B',"blink", cur->value)) {
4180           attr_decoration = apr_pstrdup(doc->pool, cur->value);
4181         }
4182       }
4183       for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
4184         attr_color = apr_pstrdup(doc->pool, cur->value);
4185       }
4186       for (cur = text_align_prop->next; cur != text_align_prop; cur = cur->next) {
4187         attr_align = apr_pstrdup(doc->pool, cur->value);
4188       }
4189       for (cur = font_size_prop->next; cur != font_size_prop; cur = cur->next) {
4190         if (   STRCASEEQ('x','X',"xx-small",cur->value)
4191             || STRCASEEQ('x','X',"x-small",cur->value)
4192             || STRCASEEQ('s','S',"small",cur->value)
4193             || STRCASEEQ('m','M',"medium",cur->value)
4194             || STRCASEEQ('l','L',"large",cur->value)
4195             || STRCASEEQ('x','X',"x-large",cur->value)
4196             || STRCASEEQ('x','X',"xx-large",cur->value)) {
4197           attr_font_size = apr_pstrdup(doc->pool, cur->value);
4198         }
4199       }
4200       if (attr_display) {
4201         css_property_t *wap_marquee_style_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-style");
4202         css_property_t *wap_marquee_dir_prop   = chxj_css_get_property_value(doc, style, "-wap-marquee-dir");
4203         css_property_t *wap_marquee_loop_prop  = chxj_css_get_property_value(doc, style, "-wap-marquee-loop");
4204         for (cur = wap_marquee_style_prop->next; cur != wap_marquee_style_prop; cur = cur->next) {
4205           if (STRCASEEQ('s','S',"scroll", cur->value) || STRCASEEQ('s','S',"slide",cur->value) || STRCASEEQ('a','A',"alternate",cur->value)) {
4206             attr_wap_marquee_style = apr_pstrdup(doc->pool, cur->value);
4207           }
4208         }
4209         for (cur = wap_marquee_dir_prop->next; cur != wap_marquee_dir_prop; cur = cur->next) {
4210           if (STRCASEEQ('l','L',"ltr",cur->value)) {
4211             attr_wap_marquee_dir = apr_pstrdup(doc->pool, cur->value);
4212           }
4213           else if (STRCASEEQ('r','R',"rtl",cur->value)) {
4214             attr_wap_marquee_dir = apr_pstrdup(doc->pool, cur->value);
4215           }
4216         }
4217         for (cur = wap_marquee_loop_prop->next; cur != wap_marquee_loop_prop; cur = cur->next) {
4218           if(strcmp(cur->value,"0") == 0 || strcmp(cur->value,"-1") == 0){
4219             attr_wap_marquee_loop = "infinite";
4220           }
4221           else{
4222             attr_wap_marquee_loop = apr_pstrdup(doc->pool, cur->value);
4223           }
4224         }
4225       }
4226       for (cur = clear_prop->next; cur != clear_prop; cur = cur->next) {
4227         css_clear = apr_pstrdup(doc->pool, cur->value);
4228       }
4229     }
4230   }
4231   W_L("<div");
4232   if (attr_align
4233       || attr_display
4234       || attr_decoration
4235       || attr_wap_marquee_style
4236       || attr_wap_marquee_dir
4237       || attr_wap_marquee_loop
4238       || attr_color
4239       || attr_bgcolor
4240       || attr_font_size
4241       || css_clear ) {
4242     W_L(" style=\"");
4243     if (attr_align) {
4244       W_L("text-align:");
4245       W_V(attr_align);
4246       W_L(";");
4247     }
4248     if (attr_display) {
4249       W_L("display:");
4250       W_V(attr_display);
4251       W_L(";");
4252     }
4253     if (attr_decoration) {
4254       W_L("text-decoration:");
4255       W_V(attr_decoration);
4256       W_L(";");
4257     }
4258     if (attr_wap_marquee_style) {
4259       W_L("-wap-marquee-style:");
4260       W_V(attr_wap_marquee_style);
4261       W_L(";");
4262     }
4263     if (attr_wap_marquee_dir) {
4264       W_L("-wap-marquee-dir:");
4265       W_V(attr_wap_marquee_dir);
4266       W_L(";");
4267     }
4268     if (attr_wap_marquee_loop) {
4269       W_L("-wap-marquee-loop:");
4270       W_V(attr_wap_marquee_loop);
4271       W_L(";");
4272     }
4273     if (attr_color) {
4274       W_L("color:");
4275       W_V(attr_color);
4276       W_L(";");
4277     }
4278     if (attr_bgcolor) {
4279       W_L("background-color:");
4280       W_V(attr_bgcolor);
4281       W_L(";");
4282     }
4283     if (attr_font_size) {
4284       W_L("font-size:");
4285       W_V(attr_font_size);
4286       W_L(";");
4287     }
4288     if (css_clear){
4289       W_L("clear:");
4290       W_V(css_clear);
4291       W_L(";");
4292     }
4293     W_L("\"");
4294   }
4295   W_L(">");
4296   return ixhtml10->out;
4297 }
4298
4299
4300 /**
4301  * It is a handler who processes the DIV tag.
4302  *
4303  * @param pdoc  [i/o] The pointer to the IXHTML10 structure at the output
4304  *                     destination is specified.
4305  * @param node   [i]   The DIV tag node is specified.
4306  * @return The conversion result is returned.
4307  */
4308 static char *
4309 s_ixhtml10_end_div_tag(void *pdoc, Node *UNUSED(child))
4310 {
4311   ixhtml10_t      *ixhtml10;
4312   Doc          *doc;
4313   request_rec  *r;
4314
4315   ixhtml10 = GET_IXHTML10(pdoc);
4316   doc   = ixhtml10->doc;
4317   r     = doc->r;
4318
4319   W_L("</div>");
4320   if (IS_CSS_ON(ixhtml10->entryp)) {
4321     chxj_css_pop_prop_list(ixhtml10->css_prop_stack);
4322   }
4323   return ixhtml10->out;
4324 }
4325
4326
4327 static char *
4328 s_ixhtml10_istyle_to_wap_input_format(apr_pool_t *p, const char *s)
4329 {
4330   if (s) {
4331     switch (s[0]) {
4332     case '1': return apr_psprintf(p, "&quot;*&lt;ja:h&gt;&quot;");
4333     case '2': return apr_psprintf(p, "&quot;*&lt;ja:hk&gt;&quot;");
4334     case '3': return apr_psprintf(p, "&quot;*&lt;ja:en&gt;&quot;");
4335     case '4': return apr_psprintf(p, "&quot;*&lt;ja:n&gt;&quot;");
4336     default:
4337       return apr_pstrdup(p, "");
4338     }
4339   }
4340
4341   return apr_pstrdup(p,"");
4342 }
4343
4344
4345 static char *
4346 s_ixhtml10_chxjif_tag(void *pdoc, Node *node)
4347 {
4348   ixhtml10_t *ixhtml10;
4349   Doc     *doc;
4350   Node    *child;
4351   request_rec *r;
4352
4353   ixhtml10 = GET_IXHTML10(pdoc);
4354   doc   = ixhtml10->doc;
4355   r     = doc->r;
4356
4357   for (child = qs_get_child_node(doc, node);
4358        child;
4359        child = qs_get_next_node(doc, child)) {
4360     W_V(child->otext);
4361     s_ixhtml10_chxjif_tag(ixhtml10, child);
4362   }
4363   return NULL;
4364 }
4365
4366
4367 /**
4368  * It is a handler who processes the TEXTARE tag.
4369  *
4370  * @param pdoc  [i/o] The pointer to the IXHTML10 structure at the output
4371  *                     destination is specified.
4372  * @param node   [i]   The TEXTAREA tag node is specified.
4373  * @return The conversion result is returned.
4374  */
4375 static char *
4376 s_ixhtml10_start_textarea_tag(void *pdoc, Node *node)
4377 {
4378   ixhtml10_t      *ixhtml10;
4379   Doc           *doc;
4380   request_rec   *r;
4381   Attr          *attr;
4382   char          *attr_accesskey = NULL;
4383   char          *attr_name      = NULL;
4384   char          *attr_rows      = NULL;
4385   char          *attr_cols      = NULL;
4386   char          *attr_istyle    = NULL;
4387   char          *attr_style     = NULL;
4388
4389
4390   ixhtml10 = GET_IXHTML10(pdoc);
4391   doc   = ixhtml10->doc;
4392   r     = doc->r;
4393
4394   ixhtml10->textarea_flag++;
4395   for (attr = qs_get_attr(doc,node);
4396        attr;
4397        attr = qs_get_next_attr(doc,attr)) {
4398     char *name  = qs_get_attr_name(doc,attr);
4399     char *value = qs_get_attr_value(doc,attr);
4400     if (STRCASEEQ('a','A',"accesskey",name) && value && *value != 0) {
4401       attr_accesskey = value;
4402     }
4403     else if (STRCASEEQ('i','I',"istyle", name) && value && (*value == '1' || *value == '2' || *value == '3' || *value == '4')) {
4404       attr_istyle = value;
4405     }
4406     else if (STRCASEEQ('n','N',"name", name) && value && *value) {
4407       attr_name = value;
4408     }
4409     else if (STRCASEEQ('r','R',"rows", name) && value && *value) {
4410       attr_rows = value;
4411     }
4412     else if (STRCASEEQ('c','C',"cols", name) && value && *value) {
4413       attr_cols = value;
4414     }
4415     else if (STRCASEEQ('s','S',"style", name) && value && *value) {
4416       attr_style = value;
4417     }
4418   }
4419   if (IS_CSS_ON(ixhtml10->entryp)) {
4420     css_prop_list_t *style = s_ixhtml10_nopush_and_get_now_style(pdoc, node, attr_style);
4421     if (style) {
4422       css_property_t *wap_input_format = chxj_css_get_property_value(doc, style, "-wap-input-format");
4423       css_property_t *cur;
4424       for (cur = wap_input_format->next; cur != wap_input_format; cur = cur->next) {
4425         if (strcasestr(cur->value, "<ja:n>")) {
4426           attr_istyle = "4";
4427         }
4428         else if (strcasestr(cur->value, "<ja:en>")) {
4429           attr_istyle = "3";
4430         }
4431         else if (strcasestr(cur->value, "<ja:hk>")) {
4432           attr_istyle = "2";
4433         }
4434         else if (strcasestr(cur->value, "<ja:h>")) {
4435           attr_istyle = "1";
4436         }
4437       }
4438     }
4439   }
4440   W_L("<textarea");
4441   if (attr_accesskey) {
4442     W_L(" accesskey=\"");
4443     W_V(attr_accesskey);
4444     W_L("\"");
4445   }
4446   if (attr_name) {
4447     W_L(" name=\"");
4448     W_V(attr_name);
4449     W_L("\"");
4450   }
4451   if (attr_rows) {
4452     W_L(" rows=\"");
4453     W_V(attr_rows);
4454     W_L("\"");
4455   }
4456   if (attr_cols) {
4457     W_L(" cols=\"");
4458     W_V(attr_cols);
4459     W_L("\"");
4460   }
4461   if (attr_istyle) {
4462     char *vv = s_ixhtml10_istyle_to_wap_input_format(doc->buf.pool,attr_istyle);
4463     W_L(" style=\"");
4464     W_L("-wap-input-format:");
4465     W_V(vv);
4466     W_L(";");
4467     W_L("\"");
4468   }
4469   W_L(">");
4470   return ixhtml10->out;
4471 }
4472
4473
4474 /**
4475  * It is a handler who processes the TEXTAREA tag.
4476  *
4477  * @param pdoc  [i/o] The pointer to the IXHTML10 structure at the output
4478  *                     destination is specified.
4479  * @param node   [i]   The TEXTAREA tag node is specified.
4480  * @return The conversion result is returned.
4481  */
4482 static char *
4483 s_ixhtml10_end_textarea_tag(void *pdoc, Node *UNUSED(child))
4484 {
4485   ixhtml10_t       *ixhtml10;
4486   Doc           *doc;
4487   request_rec   *r;
4488
4489   ixhtml10 = GET_IXHTML10(pdoc);
4490   doc   = ixhtml10->doc;
4491   r     = doc->r;
4492
4493   W_L("</textarea>");
4494   ixhtml10->textarea_flag--;
4495
4496   return ixhtml10->out;
4497 }
4498
4499
4500 /**
4501  * It is a handler who processes the B tag.
4502  *
4503  * @param pdoc  [i/o] The pointer to the IXHTML10 structure at the output
4504  *                     destination is specified.
4505  * @param node   [i]   The B tag node is specified.
4506  * @return The conversion result is returned.
4507  */
4508 static char*
4509 s_ixhtml10_start_b_tag(void* pdoc, Node* UNUSED(node))
4510 {
4511   ixhtml10_t*      ixhtml10;
4512   Doc*          doc;
4513   request_rec*  r;
4514
4515   ixhtml10 = GET_IXHTML10(pdoc);
4516   doc   = ixhtml10->doc;
4517   r     = doc->r;
4518
4519   return ixhtml10->out;
4520 }
4521
4522
4523 /**
4524  * It is a handler who processes the B tag.
4525  *
4526  * @param pdoc  [i/o] The pointer to the IXHTML10 structure at the output
4527  *                     destination is specified.
4528  * @param node   [i]   The B tag node is specified.
4529  * @return The conversion result is returned.
4530  */
4531 static char*
4532 s_ixhtml10_end_b_tag(void* pdoc, Node* UNUSED(child))
4533 {
4534   ixhtml10_t       *ixhtml10 = GET_IXHTML10(pdoc);
4535 /*
4536   Doc              *doc   = ixhtml10->doc;
4537 */
4538
4539   return ixhtml10->out;
4540 }
4541
4542 static char*
4543 s_ixhtml10_text_tag(void* pdoc, Node* child)
4544 {
4545   ixhtml10_t*     ixhtml10;
4546   Doc*         doc;
4547   char*        textval;
4548   char*        tmp;
4549   char*        tdst;
4550   char         one_byte[2];
4551   int          ii;
4552   int          tdst_len;
4553   request_rec* r;
4554   apr_size_t  z2h_input_len;
4555
4556   ixhtml10 = GET_IXHTML10(pdoc);
4557   doc   = ixhtml10->doc;
4558   r     = doc->r;
4559
4560   textval = qs_get_node_value(doc,child);
4561   if (strlen(textval) == 0) {
4562     return ixhtml10->out;
4563   }
4564
4565   tmp = apr_palloc(r->pool, qs_get_node_size(doc,child)+1);
4566   memset(tmp, 0, qs_get_node_size(doc,child)+1);
4567
4568   tdst     = qs_alloc_zero_byte_string(doc->buf.pool);
4569   memset(one_byte, 0, sizeof(one_byte));
4570   tdst_len = 0;
4571
4572   for (ii=0; ii<qs_get_node_size(doc,child); ii++) {
4573     char* out;
4574     int rtn = s_ixhtml10_search_emoji(ixhtml10, &textval[ii], &out,child);
4575     if (rtn) {
4576       tdst = qs_out_apr_pstrcat(r, tdst, out, &tdst_len);
4577       ii+=(rtn - 1);
4578       continue;
4579     }
4580
4581     if (is_sjis_kanji(textval[ii])) {
4582       one_byte[0] = textval[ii+0];
4583       tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
4584       one_byte[0] = textval[ii+1];
4585       tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
4586       ii++;
4587     }
4588     else
4589     if (ixhtml10->pre_flag) {
4590       one_byte[0] = textval[ii+0];
4591       tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
4592     }
4593     else
4594     if (ixhtml10->textarea_flag) {
4595       one_byte[0] = textval[ii+0];
4596       tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
4597     }
4598     else {
4599       if (textval[ii] != '\r' && textval[ii] != '\n') {
4600         one_byte[0] = textval[ii+0];
4601         tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
4602       }
4603     }
4604   }
4605   z2h_input_len = strlen(tdst);
4606   tdst = chxj_conv_z2h(r, tdst, &z2h_input_len, ixhtml10->entryp);
4607
4608   W_V(tdst);
4609   return ixhtml10->out;
4610 }
4611
4612
4613 /**
4614  * It is a handler who processes the BLOCKQUOTE tag.
4615  *
4616  * @param pdoc  [i/o] The pointer to the IXHTML10 structure at the output
4617  *                     destination is specified.
4618  * @param node   [i]   The BLOCKQUOTE tag node is specified.
4619  * @return The conversion result is returned.
4620  */
4621 static char *
4622 s_ixhtml10_start_blockquote_tag(void *pdoc, Node *node)
4623 {
4624   ixhtml10_t *ixhtml10;
4625   Doc      *doc;
4626   Attr     *attr;
4627   char     *attr_style = NULL;
4628   char     *attr_color = NULL;
4629   char     *attr_size  = NULL;
4630   char     *css_clear  = NULL;
4631
4632   ixhtml10  = GET_IXHTML10(pdoc);
4633   doc     = ixhtml10->doc;
4634   for (attr = qs_get_attr(doc,node);
4635        attr;
4636        attr = qs_get_next_attr(doc,attr)) {
4637     char *nm  = qs_get_attr_name(doc,attr);
4638     char *val = qs_get_attr_value(doc,attr);
4639     if (val && STRCASEEQ('s','S',"style", nm)) {
4640       attr_style = val;
4641     }
4642   }
4643   if (IS_CSS_ON(ixhtml10->entryp)) {
4644     css_prop_list_t *style = s_ixhtml10_nopush_and_get_now_style(pdoc, node, attr_style);
4645     if (style) {
4646       css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
4647       css_property_t *font_size_prop = chxj_css_get_property_value(doc, style, "font-size");
4648       css_property_t *clear_prop           = chxj_css_get_property_value(doc, style, "clear");
4649       
4650       css_property_t *cur;
4651       for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
4652         if (cur->value && *cur->value) {
4653           attr_color = apr_pstrdup(doc->pool, cur->value);
4654         }
4655       }
4656       for (cur = font_size_prop->next; cur != font_size_prop; cur = cur->next) {
4657         if (cur->value && *cur->value) {
4658           if (STRCASEEQ('x','X',"xx-small",cur->value)) {
4659             attr_size = apr_pstrdup(doc->pool, cur->value);
4660           }
4661           else if (STRCASEEQ('x','X',"x-small",cur->value)) {
4662             attr_size = apr_pstrdup(doc->pool, cur->value);
4663           }
4664           else if (STRCASEEQ('s','S',"small",cur->value)) {
4665             attr_size = apr_pstrdup(doc->pool, cur->value);
4666           }
4667           else if (STRCASEEQ('m','M',"medium",cur->value)) {
4668             attr_size = apr_pstrdup(doc->pool, cur->value);
4669           }
4670           else if (STRCASEEQ('l','L',"large",cur->value)) {
4671             attr_size = apr_pstrdup(doc->pool, cur->value);
4672           }
4673           else if (STRCASEEQ('x','X',"x-large",cur->value)) {
4674             attr_size = apr_pstrdup(doc->pool, cur->value);
4675           }
4676           else if (STRCASEEQ('x','X',"xx-large",cur->value)) {
4677             attr_size = apr_pstrdup(doc->pool, cur->value);
4678           }
4679         }
4680       }
4681       for (cur = clear_prop->next; cur != clear_prop; cur = cur->next) {
4682         css_clear = apr_pstrdup(doc->pool, cur->value);
4683       }
4684     }
4685   }
4686   W_L("<blockquote");
4687   if (attr_color || attr_size || css_clear) {
4688     W_L(" style=\"");
4689     if (attr_color) {
4690       attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
4691       W_L("color:");
4692       W_V(attr_color);
4693       W_L(";");
4694     }
4695     if (attr_size) {
4696       W_L("font-size:");
4697       W_V(attr_size);
4698       W_L(";");
4699     }
4700     if (css_clear) {
4701       W_L("clear:");
4702       W_V(css_clear);
4703       W_L(";");
4704     }
4705     W_L("\"");
4706   }
4707   W_L(">");
4708   return ixhtml10->out;
4709 }
4710
4711
4712 /**
4713  * It is a handler who processes the BLOCKQUOTE tag.
4714  *
4715  * @param pdoc  [i/o] The pointer to the IXHTML10 structure at the output
4716  *                     destination is specified.
4717  * @param node   [i]   The BLOCKQUOTE tag node is specified.
4718  * @return The conversion result is returned.
4719  */
4720 static char *
4721 s_ixhtml10_end_blockquote_tag(void *pdoc, Node *UNUSED(child))
4722 {
4723   ixhtml10_t *ixhtml10 = GET_IXHTML10(pdoc);
4724   Doc     *doc   = ixhtml10->doc;
4725   W_L("</blockquote>");
4726   if (IS_CSS_ON(ixhtml10->entryp)) {
4727     chxj_css_pop_prop_list(ixhtml10->css_prop_stack);
4728   }
4729   return ixhtml10->out;
4730 }
4731
4732
4733 /**
4734  * It is a handler who processes the DIR tag.
4735  *
4736  * @param pdoc  [i/o] The pointer to the IXHTML10 structure at the output
4737  *                     destination is specified.
4738  * @param node   [i]   The DIR tag node is specified.
4739  * @return The conversion result is returned.
4740  */
4741 static char *
4742 s_ixhtml10_start_dir_tag(void *pdoc, Node *node)
4743 {
4744   ixhtml10_t *ixhtml10      = GET_IXHTML10(pdoc);
4745   Doc       *doc        = ixhtml10->doc;
4746   Attr      *attr;
4747   char      *attr_style = NULL;
4748   char      *attr_color = NULL;
4749   char      *attr_type  = NULL;
4750   char      *attr_size  = NULL;
4751   for (attr = qs_get_attr(doc,node);
4752        attr;
4753        attr = qs_get_next_attr(doc,attr)) {
4754     char *name   = qs_get_attr_name(doc,attr);
4755     char *value  = qs_get_attr_value(doc,attr);
4756     if (STRCASEEQ('t','T',"type",name)) {
4757       if (value && (STRCASEEQ('d','D',"disc",value) || STRCASEEQ('c','C',"circle",value) || STRCASEEQ('s','S',"square",value))) {
4758         attr_type = value;
4759       }
4760     }
4761     else if (STRCASEEQ('s','S',"style", name) && value && *value) {
4762       attr_style = value;
4763     }
4764   }
4765   if (IS_CSS_ON(ixhtml10->entryp)) {
4766     css_prop_list_t *style = s_ixhtml10_nopush_and_get_now_style(pdoc, node, attr_style);
4767     if (style) {
4768       css_property_t *color_prop           = chxj_css_get_property_value(doc, style, "color");
4769       css_property_t *size_prop            = chxj_css_get_property_value(doc, style, "font-size");
4770       css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "list-style-type");
4771       css_property_t *cur;
4772       for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
4773         if (cur->value && *cur->value) {
4774           attr_color = apr_pstrdup(doc->pool, cur->value);
4775         }
4776       }
4777       for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
4778         if (cur->value && *cur->value) {
4779           attr_type = apr_pstrdup(doc->pool, cur->value);
4780         }
4781       }
4782       for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
4783         if (cur->value && *cur->value) {
4784           if (STRCASEEQ('x','X',"xx-small",cur->value)) {
4785             attr_size = apr_pstrdup(doc->pool, cur->value);
4786           }
4787           else if (STRCASEEQ('x','X',"x-small",cur->value)) {
4788             attr_size = apr_pstrdup(doc->pool, cur->value);
4789           }
4790           else if (STRCASEEQ('s','S',"small",cur->value)) {
4791             attr_size = apr_pstrdup(doc->pool, cur->value);
4792           }
4793           else if (STRCASEEQ('m','M',"medium",cur->value)) {
4794             attr_size = apr_pstrdup(doc->pool, cur->value);
4795           }
4796           else if (STRCASEEQ('l','L',"large",cur->value)) {
4797             attr_size = apr_pstrdup(doc->pool, cur->value);
4798           }
4799           else if (STRCASEEQ('x','X',"x-large",cur->value)) {
4800             attr_size = apr_pstrdup(doc->pool, cur->value);
4801           }
4802           else if (STRCASEEQ('x','X',"xx-large",cur->value)) {
4803             attr_size = apr_pstrdup(doc->pool, cur->value);
4804           }
4805         }
4806       }
4807     }
4808   }
4809   W_L("<ul");
4810   if (attr_type || attr_color || attr_size) {
4811     W_L(" style=\"");
4812     if (attr_type) {
4813       W_L("list-style-type:");
4814       W_V(attr_type);
4815       W_L(";");
4816     }
4817     if (attr_color) {
4818       attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
4819       W_L("color:");
4820       W_V(attr_color);
4821       W_L(";");
4822     }
4823     if (attr_size) {
4824       W_L("font-size:");
4825       W_V(attr_size);
4826       W_L(";");
4827     }
4828     W_L("\"");
4829   }
4830   W_L(">");
4831   return ixhtml10->out;
4832 }
4833
4834
4835 /**
4836  * It is a handler who processes the DIR tag.
4837  *
4838  * @param pdoc  [i/o] The pointer to the IXHTML10 structure at the output
4839  *                     destination is specified.
4840  * @param node   [i]   The DIR tag node is specified.
4841  * @return The conversion result is returned.
4842  */
4843 static char *
4844 s_ixhtml10_end_dir_tag(void *pdoc, Node *UNUSED(child))
4845 {
4846   ixhtml10_t *ixhtml10 = GET_IXHTML10(pdoc);
4847   Doc *doc = ixhtml10->doc;
4848   W_L("</ul>");
4849   if (IS_CSS_ON(ixhtml10->entryp)) {
4850     chxj_css_pop_prop_list(ixhtml10->css_prop_stack);
4851   }
4852   return ixhtml10->out;
4853 }
4854
4855
4856 /**
4857  * It is a handler who processes the DL tag.
4858  *
4859  * @param pdoc  [i/o] The pointer to the IXHTML10 structure at the output
4860  *                     destination is specified.
4861  * @param node   [i]   The DL tag node is specified.
4862  * @return The conversion result is returned.
4863  */
4864 static char *
4865 s_ixhtml10_start_dl_tag(void *pdoc, Node *node)
4866 {
4867   ixhtml10_t *ixhtml10      = GET_IXHTML10(pdoc);
4868   Doc       *doc        = ixhtml10->doc;
4869   Attr      *attr;
4870   char      *attr_style = NULL;
4871   char      *attr_color = NULL;
4872   char      *attr_size  = NULL;
4873   char      *css_clear  = NULL;
4874   
4875   for (attr = qs_get_attr(doc,node);
4876        attr;
4877        attr = qs_get_next_attr(doc,attr)) {
4878     char *name   = qs_get_attr_name(doc,attr);
4879     char *value  = qs_get_attr_value(doc,attr);
4880     if (STRCASEEQ('s','S',"style", name) && value && *value) {
4881       attr_style = value;
4882     }
4883   }
4884   if (IS_CSS_ON(ixhtml10->entryp)) {
4885     css_prop_list_t *style = s_ixhtml10_nopush_and_get_now_style(pdoc, node, attr_style);
4886     if (style) {
4887       css_property_t *color_prop           = chxj_css_get_property_value(doc, style, "color");
4888       css_property_t *size_prop            = chxj_css_get_property_value(doc, style, "font-size");
4889       css_property_t *clear_prop           = chxj_css_get_property_value(doc, style, "clear");
4890       
4891       css_property_t *cur;
4892       for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
4893         if (cur->value && *cur->value) {
4894           attr_color = apr_pstrdup(doc->pool, cur->value);
4895         }
4896       }
4897       for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
4898         if (cur->value && *cur->value) {
4899           if (STRCASEEQ('x','X',"xx-small",cur->value)) {
4900             attr_size = apr_pstrdup(doc->pool, cur->value);
4901           }
4902           else if (STRCASEEQ('x','X',"x-small",cur->value)) {
4903             attr_size = apr_pstrdup(doc->pool, cur->value);
4904           }
4905           else if (STRCASEEQ('s','S',"small",cur->value)) {
4906             attr_size = apr_pstrdup(doc->pool, cur->value);
4907           }
4908           else if (STRCASEEQ('m','M',"medium",cur->value)) {
4909             attr_size = apr_pstrdup(doc->pool, cur->value);
4910           }
4911           else if (STRCASEEQ('l','L',"large",cur->value)) {
4912             attr_size = apr_pstrdup(doc->pool, cur->value);
4913           }
4914           else if (STRCASEEQ('x','X',"x-large",cur->value)) {
4915             attr_size = apr_pstrdup(doc->pool, cur->value);
4916           }
4917           else if (STRCASEEQ('x','X',"xx-large",cur->value)) {
4918             attr_size = apr_pstrdup(doc->pool, cur->value);
4919           }
4920         }
4921       }
4922       for (cur = clear_prop->next; cur != clear_prop; cur = cur->next) {
4923         css_clear = apr_pstrdup(doc->pool, cur->value);
4924       }
4925     }
4926   }
4927   W_L("<dl");
4928   if (attr_color || attr_size || css_clear) {
4929     W_L(" style=\"");
4930     if (attr_color) {
4931       attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
4932       W_L("color:");
4933       W_V(attr_color);
4934       W_L(";");
4935     }
4936     if (attr_size) {
4937       W_L("font-size:");
4938       W_V(attr_size);
4939       W_L(";");
4940     }
4941     if (css_clear) {
4942       W_L("clear:");
4943       W_V(css_clear);
4944       W_L(";");
4945     }
4946     W_L("\"");
4947   }
4948   W_L(">");
4949   return ixhtml10->out;
4950 }
4951
4952
4953 /**
4954  * It is a handler who processes the DL tag.
4955  *
4956  * @param pdoc  [i/o] The pointer to the IXHTML10 structure at the output
4957  *                     destination is specified.
4958  * @param node   [i]   The DL tag node is specified.
4959  * @return The conversion result is returned.
4960  */
4961 static char *
4962 s_ixhtml10_end_dl_tag(void *pdoc, Node *UNUSED(child))
4963 {
4964   ixhtml10_t *ixhtml10 = GET_IXHTML10(pdoc);
4965   Doc *doc = ixhtml10->doc;
4966   W_L("</dl>");
4967   if (IS_CSS_ON(ixhtml10->entryp)) {
4968     chxj_css_pop_prop_list(ixhtml10->css_prop_stack);
4969   }
4970   return ixhtml10->out;
4971 }
4972
4973
4974 /**
4975  * It is a handler who processes the DT tag.
4976  *
4977  * @param pdoc  [i/o] The pointer to the IXHTML10 structure at the output
4978  *                     destination is specified.
4979  * @param node   [i]   The DT tag node is specified.
4980  * @return The conversion result is returned.
4981  */
4982 static char *
4983 s_ixhtml10_start_dt_tag(void *pdoc, Node *node)
4984 {
4985   ixhtml10_t *ixhtml10      = GET_IXHTML10(pdoc);
4986   Doc       *doc        = ixhtml10->doc;
4987   Attr      *attr;
4988   char      *attr_style = NULL;
4989   char      *attr_color = NULL;
4990   char      *attr_size  = NULL;
4991   for (attr = qs_get_attr(doc,node);
4992        attr;
4993        attr = qs_get_next_attr(doc,attr)) {
4994     char *name   = qs_get_attr_name(doc,attr);
4995     char *value  = qs_get_attr_value(doc,attr);
4996     if (STRCASEEQ('s','S',"style", name) && value && *value) {
4997       attr_style = value;
4998     }
4999   }
5000   if (IS_CSS_ON(ixhtml10->entryp)) {
5001     css_prop_list_t *style = s_ixhtml10_nopush_and_get_now_style(pdoc, node, attr_style);
5002     if (style) {
5003       css_property_t *color_prop           = chxj_css_get_property_value(doc, style, "color");
5004       css_property_t *size_prop            = chxj_css_get_property_value(doc, style, "font-size");
5005       css_property_t *cur;
5006       for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
5007         if (cur->value && *cur->value) {
5008           attr_color = apr_pstrdup(doc->pool, cur->value);
5009         }
5010       }
5011       for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
5012         if (cur->value && *cur->value) {
5013           if (STRCASEEQ('x','X',"xx-small",cur->value)) {
5014             attr_size = apr_pstrdup(doc->pool, cur->value);
5015           }
5016           else if (STRCASEEQ('x','X',"x-small",cur->value)) {
5017             attr_size = apr_pstrdup(doc->pool, cur->value);
5018           }
5019           else if (STRCASEEQ('s','S',"small",cur->value)) {
5020             attr_size = apr_pstrdup(doc->pool, cur->value);
5021           }
5022           else if (STRCASEEQ('m','M',"medium",cur->value)) {
5023             attr_size = apr_pstrdup(doc->pool, cur->value);
5024           }
5025           else if (STRCASEEQ('l','L',"large",cur->value)) {
5026             attr_size = apr_pstrdup(doc->pool, cur->value);
5027           }
5028           else if (STRCASEEQ('x','X',"x-large",cur->value)) {
5029             attr_size = apr_pstrdup(doc->pool, cur->value);
5030           }
5031           else if (STRCASEEQ('x','X',"xx-large",cur->value)) {
5032             attr_size = apr_pstrdup(doc->pool, cur->value);
5033           }
5034         }
5035       }
5036     }
5037   }
5038   W_L("<dt");
5039   if (attr_color || attr_size) {
5040     W_L(" style=\"");
5041     if (attr_color) {
5042       attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
5043       W_L("color:");
5044       W_V(attr_color);
5045       W_L(";");
5046     }
5047     if (attr_size) {
5048       W_L("font-size:");
5049       W_V(attr_size);
5050       W_L(";");
5051     }
5052     W_L("\"");
5053   }
5054   W_L(">");
5055   return ixhtml10->out;
5056 }
5057
5058
5059 /**
5060  * It is a handler who processes the DT tag.
5061  *
5062  * @param pdoc  [i/o] The pointer to the IXHTML10 structure at the output
5063  *                     destination is specified.
5064  * @param node   [i]   The DT tag node is specified.
5065  * @return The conversion result is returned.
5066  */
5067 static char *
5068 s_ixhtml10_end_dt_tag(void *pdoc, Node *UNUSED(child))
5069 {
5070   ixhtml10_t *ixhtml10 = GET_IXHTML10(pdoc);
5071   Doc      *doc    = ixhtml10->doc;
5072   W_L("</dt>");
5073   if (IS_CSS_ON(ixhtml10->entryp)) {
5074     chxj_css_pop_prop_list(ixhtml10->css_prop_stack);
5075   }
5076   return ixhtml10->out;
5077 }
5078
5079
5080 /**
5081  * It is a handler who processes the DD tag.
5082  *
5083  * @param pdoc  [i/o] The pointer to the IXHTML10 structure at the output
5084  *                     destination is specified.
5085  * @param node   [i]   The DD tag node is specified.
5086  * @return The conversion result is returned.
5087  */
5088 static char *
5089 s_ixhtml10_start_dd_tag(void *pdoc, Node *node)
5090 {
5091   ixhtml10_t *ixhtml10      = GET_IXHTML10(pdoc);
5092   Doc       *doc        = ixhtml10->doc;
5093   Attr      *attr;
5094   char      *attr_style = NULL;
5095   char      *attr_color = NULL;
5096   char      *attr_size  = NULL;
5097   for (attr = qs_get_attr(doc,node);
5098        attr;
5099        attr = qs_get_next_attr(doc,attr)) {
5100     char *name   = qs_get_attr_name(doc,attr);
5101     char *value  = qs_get_attr_value(doc,attr);
5102     if (STRCASEEQ('s','S',"style", name) && value && *value) {
5103       attr_style = value;
5104     }
5105   }
5106   if (IS_CSS_ON(ixhtml10->entryp)) {
5107     css_prop_list_t *style = s_ixhtml10_nopush_and_get_now_style(pdoc, node, attr_style);
5108     if (style) {
5109       css_property_t *color_prop           = chxj_css_get_property_value(doc, style, "color");
5110       css_property_t *size_prop            = chxj_css_get_property_value(doc, style, "font-size");
5111       css_property_t *cur;
5112       for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
5113         if (cur->value && *cur->value) {
5114           attr_color = apr_pstrdup(doc->pool, cur->value);
5115         }
5116       }
5117       for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
5118         if (cur->value && *cur->value) {
5119           if (STRCASEEQ('x','X',"xx-small",cur->value)) {
5120             attr_size = apr_pstrdup(doc->pool, cur->value);
5121           }
5122           else if (STRCASEEQ('x','X',"x-small",cur->value)) {
5123             attr_size = apr_pstrdup(doc->pool, cur->value);
5124           }
5125           else if (STRCASEEQ('s','S',"small",cur->value)) {
5126             attr_size = apr_pstrdup(doc->pool, cur->value);
5127           }
5128           else if (STRCASEEQ('m','M',"medium",cur->value)) {
5129             attr_size = apr_pstrdup(doc->pool, cur->value);
5130           }
5131           else if (STRCASEEQ('l','L',"large",cur->value)) {
5132             attr_size = apr_pstrdup(doc->pool, cur->value);
5133           }
5134           else if (STRCASEEQ('x','X',"x-large",cur->value)) {
5135             attr_size = apr_pstrdup(doc->pool, cur->value);
5136           }
5137           else if (STRCASEEQ('x','X',"xx-large",cur->value)) {
5138             attr_size = apr_pstrdup(doc->pool, cur->value);
5139           }
5140         }
5141       }
5142     }
5143   }
5144   W_L("<dd");
5145   if (attr_color || attr_size) {
5146     W_L(" style=\"");
5147     if (attr_color) {
5148       attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
5149       W_L("color:");
5150       W_V(attr_color);
5151       W_L(";");
5152     }
5153     if (attr_size) {
5154       W_L("font-size:");
5155       W_V(attr_size);
5156       W_L(";");
5157     }
5158     W_L("\"");
5159   }
5160   W_L(">");
5161   return ixhtml10->out;
5162 }
5163
5164
5165 /**
5166  * It is a handler who processes the DD tag.
5167  *
5168  * @param pdoc  [i/o] The pointer to the IXHTML10 structure at the output
5169  *                     destination is specified.
5170  * @param node   [i]   The DD tag node is specified.
5171  * @return The conversion result is returned.
5172  */
5173 static char *
5174 s_ixhtml10_end_dd_tag(void *pdoc, Node *UNUSED(child))
5175 {
5176   ixhtml10_t *ixhtml10 = GET_IXHTML10(pdoc);
5177   Doc      *doc = ixhtml10->doc;
5178   W_L("</dd>");
5179   if (IS_CSS_ON(ixhtml10->entryp)) {
5180     chxj_css_pop_prop_list(ixhtml10->css_prop_stack);
5181   }
5182   return ixhtml10->out;
5183 }
5184
5185
5186 /**
5187  * It is a handler who processes the H1 tag.
5188  *
5189  * @param pdoc  [i/o] The pointer to the IXHTML10 structure at the output
5190  *                     destination is specified.
5191  * @param node   [i]   The H1 tag node is specified.
5192  * @return The conversion result is returned.
5193  */
5194 static char *
5195 s_ixhtml10_start_h1_tag(void *pdoc, Node *node)
5196 {
5197   ixhtml10_t    *ixhtml10;
5198   Doc         *doc;
5199   request_rec *r;
5200   Attr        *attr;
5201   char        *attr_style = NULL;
5202   char        *attr_align = NULL;
5203   char        *css_clear  = NULL;
5204
5205   ixhtml10 = GET_IXHTML10(pdoc);
5206   doc    = ixhtml10->doc;
5207   r      = doc->r;
5208
5209   for (attr = qs_get_attr(doc,node);
5210        attr;
5211        attr = qs_get_next_attr(doc,attr)) {
5212     char *name  = qs_get_attr_name(doc,attr);
5213     char *value = qs_get_attr_value(doc,attr);
5214     if (STRCASEEQ('a','A',"align", name)) {
5215       if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
5216         attr_align = value;
5217       }
5218     }
5219     else if (STRCASEEQ('s','S',"style",name) && value && *value) {
5220       attr_style = value;
5221     }
5222   }
5223   if (IS_CSS_ON(ixhtml10->entryp)) {
5224     css_prop_list_t *style = s_ixhtml10_nopush_and_get_now_style(pdoc, node, attr_style);
5225     if (style) {
5226       css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
5227       css_property_t *clear_prop = chxj_css_get_property_value(doc, style, "clear");
5228       
5229       css_property_t *cur;
5230       for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
5231         if (STRCASEEQ('l','L',"left", cur->value)) {
5232           attr_align = apr_pstrdup(doc->pool, "left");
5233         }
5234         else if (STRCASEEQ('c','C',"center",cur->value)) {
5235           attr_align = apr_pstrdup(doc->pool, "center");
5236         }
5237         else if (STRCASEEQ('r','R',"right",cur->value)) {
5238           attr_align = apr_pstrdup(doc->pool, "right");
5239         }
5240       }
5241       
5242       for (cur = clear_prop->next; cur != clear_prop; cur = cur->next) {
5243         if (STRCASEEQ('b','B',"both", cur->value)) {
5244           css_clear = apr_pstrdup(doc->pool, "both");
5245         }
5246         else if (STRCASEEQ('r','R',"right", cur->value)) {
5247           css_clear = apr_pstrdup(doc->pool, "right");
5248         }
5249         else if (STRCASEEQ('l','L',"left", cur->value)) {
5250           css_clear = apr_pstrdup(doc->pool, "left");
5251         }
5252       }
5253     }
5254   }
5255   W_L("<h1");
5256   if (attr_align || css_clear ) {
5257     W_L(" style=\"");
5258     if(attr_align){
5259       W_L("text-align:");
5260       W_V(attr_align);
5261       W_L(";");
5262     }
5263     if(css_clear){
5264       W_L("clear:");
5265       W_V(css_clear);
5266       W_L(";");
5267     }
5268     W_L("\"");
5269   }
5270   W_L(">");
5271
5272   return ixhtml10->out;
5273 }
5274
5275
5276 /**
5277  * It is a handler who processes the H1 tag.
5278  *
5279  * @param pdoc  [i/o] The pointer to the IXHTML10 structure at the output
5280  *                     destination is specified.
5281  * @param node   [i]   The H1 tag node is specified.
5282  * @return The conversion result is returned.
5283  */
5284 static char *
5285 s_ixhtml10_end_h1_tag(void *pdoc, Node *UNUSED(child))
5286 {
5287   ixhtml10_t*    ixhtml10;
5288   Doc*          doc;
5289   request_rec*  r;
5290
5291   ixhtml10 = GET_IXHTML10(pdoc);
5292   doc     = ixhtml10->doc;
5293   r       = doc->r;
5294
5295   W_L("</h1>");
5296   if (IS_CSS_ON(ixhtml10->entryp)) {
5297     chxj_css_pop_prop_list(ixhtml10->css_prop_stack);
5298   }
5299
5300   return ixhtml10->out;
5301 }
5302
5303
5304 /**
5305  * It is a handler who processes the H2 tag.
5306  *
5307  * @param pdoc  [i/o] The pointer to the IXHTML10 structure at the output
5308  *                     destination is specified.
5309  * @param node   [i]   The H1 tag node is specified.
5310  * @return The conversion result is returned.
5311  */
5312 static char *
5313 s_ixhtml10_start_h2_tag(void *pdoc, Node *node)
5314 {
5315   ixhtml10_t    *ixhtml10;
5316   Doc         *doc;
5317   request_rec *r;
5318   Attr        *attr;
5319   char        *attr_style = NULL;
5320   char        *attr_align = NULL;
5321   char        *css_clear  = NULL;
5322
5323   ixhtml10   = GET_IXHTML10(pdoc);
5324   doc     = ixhtml10->doc;
5325   r       = doc->r;
5326
5327   for (attr = qs_get_attr(doc,node);
5328        attr;
5329        attr = qs_get_next_attr(doc,attr)) {
5330     char *name  = qs_get_attr_name(doc,attr);
5331     char *value = qs_get_attr_value(doc,attr);
5332     if (STRCASEEQ('a','A',"align", name)) {
5333       if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
5334         attr_align = value;
5335       }
5336     }
5337     else if (STRCASEEQ('s','S',"style",name) && value && *value) {
5338       attr_style = value;
5339     }
5340   }
5341   if (IS_CSS_ON(ixhtml10->entryp)) {
5342     css_prop_list_t *style = s_ixhtml10_nopush_and_get_now_style(pdoc, node, attr_style);
5343     if (style) {
5344       css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
5345       css_property_t *clear_prop = chxj_css_get_property_value(doc, style, "clear");
5346       css_property_t *cur;
5347       for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
5348         if (STRCASEEQ('l','L',"left", cur->value)) {
5349           attr_align = apr_pstrdup(doc->pool, "left");
5350         }
5351         else if (STRCASEEQ('c','C',"center",cur->value)) {
5352           attr_align = apr_pstrdup(doc->pool, "center");
5353         }
5354         else if (STRCASEEQ('r','R',"right",cur->value)) {
5355           attr_align = apr_pstrdup(doc->pool, "right");
5356         }
5357       }
5358       for (cur = clear_prop->next; cur != clear_prop; cur = cur->next) {
5359         if (STRCASEEQ('b','B',"both", cur->value)) {
5360           css_clear = apr_pstrdup(doc->pool, "both");
5361         }
5362         else if (STRCASEEQ('r','R',"right", cur->value)) {
5363           css_clear = apr_pstrdup(doc->pool, "right");
5364         }
5365         else if (STRCASEEQ('l','L',"left", cur->value)) {
5366           css_clear = apr_pstrdup(doc->pool, "left");
5367         }
5368       }
5369     }
5370   }
5371   W_L("<h2");
5372   if (attr_align || css_clear ) {
5373     W_L(" style=\"");
5374     if(attr_align){
5375       W_L("text-align:");
5376       W_V(attr_align);
5377       W_L(";");
5378     }
5379     if(css_clear){
5380       W_L("clear:");
5381       W_V(css_clear);
5382       W_L(";");
5383     }
5384     W_L("\"");
5385   }
5386   W_L(">");
5387
5388   return ixhtml10->out;
5389 }
5390
5391
5392 /**
5393  * It is a handler who processes the H2 tag.
5394  *
5395  * @param pdoc  [i/o] The pointer to the IXHTML10 structure at the output
5396  *                     destination is specified.
5397  * @param node   [i]   The H1 tag node is specified.
5398  * @return The conversion result is returned.
5399  */
5400 static char *
5401 s_ixhtml10_end_h2_tag(void *pdoc, Node *UNUSED(child))
5402 {
5403   ixhtml10_t*    ixhtml10;
5404   Doc*          doc;
5405   request_rec*  r;
5406
5407   ixhtml10 = GET_IXHTML10(pdoc);
5408   doc     = ixhtml10->doc;
5409   r       = doc->r;
5410
5411   W_L("</h2>");
5412   if (IS_CSS_ON(ixhtml10->entryp)) {
5413     chxj_css_pop_prop_list(ixhtml10->css_prop_stack);
5414   }
5415   return ixhtml10->out;
5416 }
5417
5418
5419 /**
5420  * It is a handler who processes the H3 tag.
5421  *
5422  * @param pdoc  [i/o] The pointer to the IXHTML10 structure at the output
5423  *                     destination is specified.
5424  * @param node   [i]   The H1 tag node is specified.
5425  * @return The conversion result is returned.
5426  */
5427 static char *
5428 s_ixhtml10_start_h3_tag(void *pdoc, Node *node)
5429 {
5430   ixhtml10_t  *ixhtml10;
5431   Doc         *doc;
5432   request_rec *r;
5433   Attr        *attr;
5434   char        *attr_style = NULL;
5435   char        *attr_align = NULL;
5436   char        *css_clear  = NULL;
5437
5438   ixhtml10   = GET_IXHTML10(pdoc);
5439   doc     = ixhtml10->doc;
5440   r       = doc->r;
5441
5442   for (attr = qs_get_attr(doc,node);
5443        attr;
5444        attr = qs_get_next_attr(doc,attr)) {
5445     char *name  = qs_get_attr_name(doc,attr);
5446     char *value = qs_get_attr_value(doc,attr);
5447     if (STRCASEEQ('a','A',"align", name)) {
5448       if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
5449         attr_align = value;
5450       }
5451     }
5452     else if (STRCASEEQ('s','S',"style",name) && value && *value) {
5453       attr_style = value;
5454     }
5455   }
5456   if (IS_CSS_ON(ixhtml10->entryp)) {
5457     css_prop_list_t *style = s_ixhtml10_nopush_and_get_now_style(pdoc, node, attr_style);
5458     if (style) {
5459       css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
5460       css_property_t *clear_prop = chxj_css_get_property_value(doc, style, "clear");
5461       css_property_t *cur;
5462       for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
5463         if (STRCASEEQ('l','L',"left", cur->value)) {
5464           attr_align = apr_pstrdup(doc->pool, "left");
5465         }
5466         else if (STRCASEEQ('c','C',"center",cur->value)) {
5467           attr_align = apr_pstrdup(doc->pool, "center");
5468         }
5469         else if (STRCASEEQ('r','R',"right",cur->value)) {
5470           attr_align = apr_pstrdup(doc->pool, "right");
5471         }
5472       }
5473       for (cur = clear_prop->next; cur != clear_prop; cur = cur->next) {
5474         if (STRCASEEQ('b','B',"both", cur->value)) {
5475           css_clear = apr_pstrdup(doc->pool, "both");
5476         }
5477         else if (STRCASEEQ('r','R',"right", cur->value)) {
5478           css_clear = apr_pstrdup(doc->pool, "right");
5479         }
5480         else if (STRCASEEQ('l','L',"left", cur->value)) {
5481           css_clear = apr_pstrdup(doc->pool, "left");
5482         }
5483       }
5484     }
5485   }
5486   W_L("<h3");
5487   if (attr_align || css_clear ) {
5488     W_L(" style=\"");
5489     if(attr_align){
5490       W_L("text-align:");
5491       W_V(attr_align);
5492       W_L(";");
5493     }
5494     if(css_clear){
5495       W_L("clear:");
5496       W_V(css_clear);
5497       W_L(";");
5498     }
5499     W_L("\"");
5500   }
5501   W_L(">");
5502
5503   return ixhtml10->out;
5504 }
5505
5506
5507 /**
5508  * It is a handler who processes the H3 tag.
5509  *
5510  * @param pdoc  [i/o] The pointer to the IXHTML10 structure at the output
5511  *                     destination is specified.
5512  * @param node   [i]   The H1 tag node is specified.
5513  * @return The conversion result is returned.
5514  */
5515 static char *
5516 s_ixhtml10_end_h3_tag(void *pdoc, Node *UNUSED(child))
5517 {
5518   ixhtml10_t*    ixhtml10;
5519   Doc*          doc;
5520   request_rec*  r;
5521
5522   ixhtml10 = GET_IXHTML10(pdoc);
5523   doc     = ixhtml10->doc;
5524   r       = doc->r;
5525
5526   W_L("</h3>");
5527   if (IS_CSS_ON(ixhtml10->entryp)) {
5528     chxj_css_pop_prop_list(ixhtml10->css_prop_stack);
5529   }
5530   return ixhtml10->out;
5531 }
5532
5533
5534 /**
5535  * It is a handler who processes the H4 tag.
5536  *
5537  * @param pdoc  [i/o] The pointer to the IXHTML10 structure at the output
5538  *                     destination is specified.
5539  * @param node   [i]   The H1 tag node is specified.
5540  * @return The conversion result is returned.
5541  */
5542 static char *
5543 s_ixhtml10_start_h4_tag(void *pdoc, Node *node)
5544 {
5545   ixhtml10_t    *ixhtml10;
5546   Doc         *doc;
5547   request_rec *r;
5548   Attr        *attr;
5549   char        *attr_style = NULL;
5550   char        *attr_align = NULL;
5551   char        *css_clear  = NULL;
5552
5553   ixhtml10   = GET_IXHTML10(pdoc);
5554   doc     = ixhtml10->doc;
5555   r       = doc->r;
5556
5557   for (attr = qs_get_attr(doc,node);
5558        attr;
5559        attr = qs_get_next_attr(doc,attr)) {
5560     char *name  = qs_get_attr_name(doc,attr);
5561     char *value = qs_get_attr_value(doc,attr);
5562     if (STRCASEEQ('a','A',"align", name)) {
5563       if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
5564         attr_align = value;
5565       }
5566     }
5567     else if (STRCASEEQ('s','S',"style",name) && value && *value) {
5568       attr_style = value;
5569     }
5570   }
5571   if (IS_CSS_ON(ixhtml10->entryp)) {
5572     css_prop_list_t *style = s_ixhtml10_nopush_and_get_now_style(pdoc, node, attr_style);
5573     if (style) {
5574       css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
5575       css_property_t *clear_prop = chxj_css_get_property_value(doc, style, "clear");
5576       css_property_t *cur;
5577       for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
5578         if (STRCASEEQ('l','L',"left", cur->value)) {
5579           attr_align = apr_pstrdup(doc->pool, "left");
5580         }
5581         else if (STRCASEEQ('c','C',"center",cur->value)) {
5582           attr_align = apr_pstrdup(doc->pool, "center");
5583         }
5584         else if (STRCASEEQ('r','R',"right",cur->value)) {
5585           attr_align = apr_pstrdup(doc->pool, "right");
5586         }
5587       }
5588       for (cur = clear_prop->next; cur != clear_prop; cur = cur->next) {
5589         if (STRCASEEQ('b','B',"both", cur->value)) {
5590           css_clear = apr_pstrdup(doc->pool, "both");
5591         }
5592         else if (STRCASEEQ('r','R',"right", cur->value)) {
5593           css_clear = apr_pstrdup(doc->pool, "right");
5594         }
5595         else if (STRCASEEQ('l','L',"left", cur->value)) {
5596           css_clear = apr_pstrdup(doc->pool, "left");
5597         }
5598       }
5599     }
5600   }
5601   W_L("<h4");
5602   if (attr_align || css_clear ) {
5603     W_L(" style=\"");
5604     if(attr_align){
5605       W_L("text-align:");
5606       W_V(attr_align);
5607       W_L(";");
5608     }
5609     if(css_clear){
5610       W_L("clear:");
5611       W_V(css_clear);
5612       W_L(";");
5613     }
5614     W_L("\"");
5615   }
5616   W_L(">");
5617
5618   return ixhtml10->out;
5619 }
5620
5621
5622 /**
5623  * It is a handler who processes the H4 tag.
5624  *
5625  * @param pdoc  [i/o] The pointer to the IXHTML10 structure at the output
5626  *                     destination is specified.
5627  * @param node   [i]   The H1 tag node is specified.
5628  * @return The conversion result is returned.
5629  */
5630 static char *
5631 s_ixhtml10_end_h4_tag(void *pdoc, Node *UNUSED(child))
5632 {
5633   ixhtml10_t      *ixhtml10;
5634   Doc           *doc;
5635   request_rec   *r;
5636
5637   ixhtml10 = GET_IXHTML10(pdoc);
5638   doc     = ixhtml10->doc;
5639   r       = doc->r;
5640
5641   W_L("</h4>");
5642   if (IS_CSS_ON(ixhtml10->entryp)) {
5643     chxj_css_pop_prop_list(ixhtml10->css_prop_stack);
5644   }
5645
5646   return ixhtml10->out;
5647 }
5648
5649
5650 /**
5651  * It is a handler who processes the H5 tag.
5652  *
5653  * @param pdoc  [i/o] The pointer to the IXHTML10 structure at the output
5654  *                     destination is specified.
5655  * @param node   [i]   The H1 tag node is specified.
5656  * @return The conversion result is returned.
5657  */
5658 static char *
5659 s_ixhtml10_start_h5_tag(void *pdoc, Node *node)
5660 {
5661   ixhtml10_t    *ixhtml10;
5662   Doc         *doc;
5663   request_rec *r;
5664   Attr        *attr;
5665   char        *attr_style = NULL;
5666   char        *attr_align = NULL;
5667   char        *css_clear  = NULL;
5668
5669   ixhtml10   = GET_IXHTML10(pdoc);
5670   doc     = ixhtml10->doc;
5671   r       = doc->r;
5672
5673   for (attr = qs_get_attr(doc,node);
5674        attr;
5675        attr = qs_get_next_attr(doc,attr)) {
5676     char *name  = qs_get_attr_name(doc,attr);
5677     char *value = qs_get_attr_value(doc,attr);
5678     if (STRCASEEQ('a','A',"align", name)) {
5679       if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
5680         attr_align = value;
5681       }
5682     }
5683     else if (STRCASEEQ('s','S',"style",name) && value && *value) {
5684       attr_style = value;
5685     }
5686   }
5687   if (IS_CSS_ON(ixhtml10->entryp)) {
5688     css_prop_list_t *style = s_ixhtml10_nopush_and_get_now_style(pdoc, node, attr_style);
5689     if (style) {
5690       css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
5691       css_property_t *clear_prop = chxj_css_get_property_value(doc, style, "clear");
5692       css_property_t *cur;
5693       for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
5694         if (STRCASEEQ('l','L',"left", cur->value)) {
5695           attr_align = apr_pstrdup(doc->pool, "left");
5696         }
5697         else if (STRCASEEQ('c','C',"center",cur->value)) {
5698           attr_align = apr_pstrdup(doc->pool, "center");
5699         }
5700         else if (STRCASEEQ('r','R',"right",cur->value)) {
5701           attr_align = apr_pstrdup(doc->pool, "right");
5702         }
5703       }
5704       for (cur = clear_prop->next; cur != clear_prop; cur = cur->next) {
5705         if (STRCASEEQ('b','B',"both", cur->value)) {
5706           css_clear = apr_pstrdup(doc->pool, "both");
5707         }
5708         else if (STRCASEEQ('r','R',"right", cur->value)) {
5709           css_clear = apr_pstrdup(doc->pool, "right");
5710         }
5711         else if (STRCASEEQ('l','L',"left", cur->value)) {
5712           css_clear = apr_pstrdup(doc->pool, "left");
5713         }
5714       }
5715     }
5716   }
5717   W_L("<h5");
5718   if (attr_align || css_clear ) {
5719     W_L(" style=\"");
5720     if(attr_align){
5721       W_L("text-align:");
5722       W_V(attr_align);
5723       W_L(";");
5724     }
5725     if(css_clear){
5726       W_L("clear:");
5727       W_V(css_clear);
5728       W_L(";");
5729     }
5730     W_L("\"");
5731   }
5732   W_L(">");
5733
5734   return ixhtml10->out;
5735 }
5736
5737
5738 /**
5739  * It is a handler who processes the H5 tag.
5740  *
5741  * @param pdoc  [i/o] The pointer to the IXHTML10 structure at the output
5742  *                     destination is specified.
5743  * @param node   [i]   The H1 tag node is specified.
5744  * @return The conversion result is returned.
5745  */
5746 static char *
5747 s_ixhtml10_end_h5_tag(void *pdoc, Node *UNUSED(child))
5748 {
5749   ixhtml10_t  *ixhtml10;
5750   Doc         *doc;
5751   request_rec *r;
5752
5753   ixhtml10 = GET_IXHTML10(pdoc);
5754   doc     = ixhtml10->doc;
5755   r       = doc->r;
5756
5757   W_L("</h5>");
5758   if (IS_CSS_ON(ixhtml10->entryp)) {
5759     chxj_css_pop_prop_list(ixhtml10->css_prop_stack);
5760   }
5761
5762   return ixhtml10->out;
5763 }
5764
5765
5766 /**
5767  * It is a handler who processes the H6 tag.
5768  *
5769  * @param pdoc  [i/o] The pointer to the IXHTML10 structure at the output
5770  *                     destination is specified.
5771  * @param node   [i]   The H1 tag node is specified.
5772  * @return The conversion result is returned.
5773  */
5774 static char *
5775 s_ixhtml10_start_h6_tag(void *pdoc, Node *node)
5776 {
5777   ixhtml10_t    *ixhtml10;
5778   Doc         *doc;
5779   request_rec *r;
5780   Attr        *attr;
5781   char        *attr_style = NULL;
5782   char        *attr_align = NULL;
5783   char        *css_clear  = NULL;
5784
5785   ixhtml10   = GET_IXHTML10(pdoc);
5786   doc     = ixhtml10->doc;
5787   r       = doc->r;
5788
5789   for (attr = qs_get_attr(doc,node);
5790        attr;
5791        attr = qs_get_next_attr(doc,attr)) {
5792     char *name  = qs_get_attr_name(doc,attr);
5793     char *value = qs_get_attr_value(doc,attr);
5794     if (STRCASEEQ('a','A',"align", name)) {
5795       if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
5796         attr_align = value;
5797       }
5798     }
5799     else if (STRCASEEQ('s','S',"style",name) && value && *value) {
5800       attr_style = value;
5801     }
5802   }
5803   if (IS_CSS_ON(ixhtml10->entryp)) {
5804     css_prop_list_t *style = s_ixhtml10_nopush_and_get_now_style(pdoc, node, attr_style);
5805     if (style) {
5806       css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
5807       css_property_t *clear_prop = chxj_css_get_property_value(doc, style, "clear");
5808       css_property_t *cur;
5809       for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
5810         if (STRCASEEQ('l','L',"left", cur->value)) {
5811           attr_align = apr_pstrdup(doc->pool, "left");
5812         }
5813         else if (STRCASEEQ('c','C',"center",cur->value)) {
5814           attr_align = apr_pstrdup(doc->pool, "center");
5815         }
5816         else if (STRCASEEQ('r','R',"right",cur->value)) {
5817           attr_align = apr_pstrdup(doc->pool, "right");
5818         }
5819       }
5820       for (cur = clear_prop->next; cur != clear_prop; cur = cur->next) {
5821         if (STRCASEEQ('b','B',"both", cur->value)) {
5822           css_clear = apr_pstrdup(doc->pool, "both");
5823         }
5824         else if (STRCASEEQ('r','R',"right", cur->value)) {
5825           css_clear = apr_pstrdup(doc->pool, "right");
5826         }
5827         else if (STRCASEEQ('l','L',"left", cur->value)) {
5828           css_clear = apr_pstrdup(doc->pool, "left");
5829         }
5830       }
5831     }
5832   }
5833   W_L("<h6");
5834   if (attr_align || css_clear ) {
5835     W_L(" style=\"");
5836     if(attr_align){
5837       W_L("text-align:");
5838       W_V(attr_align);
5839       W_L(";");
5840     }
5841     if(css_clear){
5842       W_L("clear:");
5843       W_V(css_clear);
5844       W_L(";");
5845     }
5846     W_L("\"");
5847   }
5848   W_L(">");
5849
5850   return ixhtml10->out;
5851 }
5852
5853
5854 /**
5855  * It is a handler who processes the H6 tag.
5856  *
5857  * @param pdoc  [i/o] The pointer to the IXHTML10 structure at the output
5858  *                     destination is specified.
5859  * @param node   [i]   The H1 tag node is specified.
5860  * @return The conversion result is returned.
5861  */
5862 static char *
5863 s_ixhtml10_end_h6_tag(void *pdoc, Node *UNUSED(child))
5864 {
5865   ixhtml10_t    *ixhtml10;
5866   Doc         *doc;
5867   request_rec *r;
5868
5869   ixhtml10 = GET_IXHTML10(pdoc);
5870   doc     = ixhtml10->doc;
5871   r       = doc->r;
5872
5873   W_L("</h6>");
5874   if (IS_CSS_ON(ixhtml10->entryp)) {
5875     chxj_css_pop_prop_list(ixhtml10->css_prop_stack);
5876   }
5877
5878   return ixhtml10->out;
5879 }
5880
5881
5882 /**
5883  * It is a handler who processes the MENU tag.
5884  *
5885  * @param pdoc  [i/o] The pointer to the IXHTML10 structure at the output
5886  *                     destination is specified.
5887  * @param node   [i]   The MENU tag node is specified.
5888  * @return The conversion result is returned.
5889  */
5890 static char *
5891 s_ixhtml10_start_menu_tag(void *pdoc, Node *node)
5892 {
5893   ixhtml10_t *ixhtml10      = GET_IXHTML10(pdoc);
5894   Doc       *doc        = ixhtml10->doc;
5895   Attr      *attr;
5896   char      *attr_style = NULL;
5897   char      *attr_color = NULL;
5898   char      *attr_type  = NULL;
5899   char      *attr_size  = NULL;
5900   for (attr = qs_get_attr(doc,node);
5901        attr;
5902        attr = qs_get_next_attr(doc,attr)) {
5903     char *name   = qs_get_attr_name(doc,attr);
5904     char *value  = qs_get_attr_value(doc,attr);
5905     if (STRCASEEQ('t','T',"type",name)) {
5906       if (value && (STRCASEEQ('d','D',"disc",value) || STRCASEEQ('c','C',"circle",value) || STRCASEEQ('s','S',"square",value))) {
5907         attr_type = value;
5908       }
5909     }
5910     else if (STRCASEEQ('s','S',"style", name) && value && *value) {
5911       attr_style = value;
5912     }
5913   }
5914   if (IS_CSS_ON(ixhtml10->entryp)) {
5915     css_prop_list_t *style = s_ixhtml10_nopush_and_get_now_style(pdoc, node, attr_style);
5916     if (style) {
5917       css_property_t *color_prop           = chxj_css_get_property_value(doc, style, "color");
5918       css_property_t *size_prop            = chxj_css_get_property_value(doc, style, "font-size");
5919       css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "list-style-type");
5920       css_property_t *cur;
5921       for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
5922         if (cur->value && *cur->value) {
5923           attr_color = apr_pstrdup(doc->pool, cur->value);
5924         }
5925       }
5926       for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
5927         if (cur->value && *cur->value) {
5928           attr_type = apr_pstrdup(doc->pool, cur->value);
5929         }
5930       }
5931       for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
5932         if (cur->value && *cur->value) {
5933           if (STRCASEEQ('x','X',"xx-small",cur->value)) {
5934             attr_size = apr_pstrdup(doc->pool, cur->value);
5935           }
5936           else if (STRCASEEQ('x','X',"x-small",cur->value)) {
5937             attr_size = apr_pstrdup(doc->pool, cur->value);
5938           }
5939           else if (STRCASEEQ('s','S',"small",cur->value)) {
5940             attr_size = apr_pstrdup(doc->pool, cur->value);
5941           }
5942           else if (STRCASEEQ('m','M',"medium",cur->value)) {
5943             attr_size = apr_pstrdup(doc->pool, cur->value);
5944           }
5945           else if (STRCASEEQ('l','L',"large",cur->value)) {
5946             attr_size = apr_pstrdup(doc->pool, cur->value);
5947           }
5948           else if (STRCASEEQ('x','X',"x-large",cur->value)) {
5949             attr_size = apr_pstrdup(doc->pool, cur->value);
5950           }
5951           else if (STRCASEEQ('x','X',"xx-large",cur->value)) {
5952             attr_size = apr_pstrdup(doc->pool, cur->value);
5953           }
5954         }
5955       }
5956     }
5957   }
5958   W_L("<ul");
5959   if (attr_type || attr_color || attr_size) {
5960     W_L(" style=\"");
5961     if (attr_type) {
5962       W_L("list-style-type:");
5963       W_V(attr_type);
5964       W_L(";");
5965     }
5966     if (attr_color) {
5967       attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
5968       W_L("color:");
5969       W_V(attr_color);
5970       W_L(";");
5971     }
5972     if (attr_size) {
5973       W_L("font-size:");
5974       W_V(attr_size);
5975       W_L(";");
5976     }
5977     W_L("\"");
5978   }
5979   W_L(">");
5980   return ixhtml10->out;
5981 }
5982
5983
5984 /**
5985  * It is a handler who processes the MENU tag.
5986  *
5987  * @param pdoc  [i/o] The pointer to the IXHTML10 structure at the output
5988  *                     destination is specified.
5989  * @param node   [i]   The MENU tag node is specified.
5990  * @return The conversion result is returned.
5991  */
5992 static char *
5993 s_ixhtml10_end_menu_tag(void *pdoc, Node *UNUSED(child))
5994 {
5995   ixhtml10_t *ixhtml10 = GET_IXHTML10(pdoc);
5996   Doc *doc = ixhtml10->doc;
5997   W_L("</ul>");
5998   if (IS_CSS_ON(ixhtml10->entryp)) {
5999     chxj_css_pop_prop_list(ixhtml10->css_prop_stack);
6000   }
6001   return ixhtml10->out;
6002 }
6003
6004
6005 /**
6006  * It is a handler who processes the PLAINTEXT tag.
6007  *
6008  * @param pdoc  [i/o] The pointer to the IXHTML10 structure at the output
6009  *                     destination is specified.
6010  * @param node   [i]   The PLAINTEXT tag node is specified.
6011  * @return The conversion result is returned.
6012  */
6013 static char *
6014 s_ixhtml10_start_plaintext_tag(void *pdoc, Node *node)
6015 {
6016   ixhtml10_t *ixhtml10;
6017   Doc *doc;
6018
6019   ixhtml10 = GET_IXHTML10(pdoc);
6020   doc     = ixhtml10->doc;
6021   W_L("<plaintext>");
6022   s_ixhtml10_start_plaintext_tag_inner(pdoc,node);
6023   return ixhtml10->out;
6024 }
6025
6026 static char *
6027 s_ixhtml10_start_plaintext_tag_inner(void *pdoc, Node *node)
6028 {
6029   ixhtml10_t *ixhtml10;
6030   Doc *doc;
6031   Node *child;
6032   ixhtml10 = GET_IXHTML10(pdoc);
6033   doc     = ixhtml10->doc;
6034   for (child = qs_get_child_node(doc, node);
6035        child;
6036        child = qs_get_next_node(doc, child)) {
6037     W_V(child->otext);
6038     s_ixhtml10_start_plaintext_tag_inner(pdoc, child);
6039   }
6040   return ixhtml10->out;
6041 }
6042
6043
6044 /**
6045  * It is a handler who processes the PLAINTEXT tag.
6046  *
6047  * @param pdoc  [i/o] The pointer to the IXHTML10 structure at the output
6048  *                     destination is specified.
6049  * @param node   [i]   The PLAINTEXT tag node is specified.
6050  * @return The conversion result is returned.
6051  */
6052 static char *
6053 s_ixhtml10_end_plaintext_tag(void *pdoc, Node *UNUSED(child))
6054 {
6055   ixhtml10_t *ixhtml10 = GET_IXHTML10(pdoc);
6056   return ixhtml10->out;
6057 }
6058
6059
6060 /**
6061  * It is a handler who processes the BLINK tag.
6062  *
6063  * @param pdoc  [i/o] The pointer to the IXHTML10 structure at the output
6064  *                     destination is specified.
6065  * @param node   [i]   The BLINK tag node is specified.
6066  * @return The conversion result is returned.
6067  */
6068 static char *
6069 s_ixhtml10_start_blink_tag(void *pdoc, Node *node)
6070 {
6071   ixhtml10_t *ixhtml10      = GET_IXHTML10(pdoc);
6072   Doc       *doc        = ixhtml10->doc;
6073   Attr      *attr;
6074   char      *attr_style = NULL;
6075   char      *attr_color = NULL;
6076   char      *attr_size  = NULL;
6077   for (attr = qs_get_attr(doc,node);
6078        attr;
6079        attr = qs_get_next_attr(doc,attr)) {
6080     char *name   = qs_get_attr_name(doc,attr);
6081     char *value  = qs_get_attr_value(doc,attr);
6082     if (STRCASEEQ('s','S',"style", name) && value && *value) {
6083       attr_style = value;
6084     }
6085   }
6086   if (IS_CSS_ON(ixhtml10->entryp)) {
6087     css_prop_list_t *style = s_ixhtml10_nopush_and_get_now_style(pdoc, node, attr_style);
6088     if (style) {
6089       css_property_t *color_prop           = chxj_css_get_property_value(doc, style, "color");
6090       css_property_t *size_prop            = chxj_css_get_property_value(doc, style, "font-size");
6091       css_property_t *cur;
6092       for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
6093         if (cur->value && *cur->value) {
6094           attr_color = apr_pstrdup(doc->pool, cur->value);
6095         }
6096       }
6097       for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
6098         if (cur->value && *cur->value) {
6099           if (STRCASEEQ('x','X',"xx-small",cur->value)) {
6100             attr_size = apr_pstrdup(doc->pool, cur->value);
6101           }
6102           else if (STRCASEEQ('x','X',"x-small",cur->value)) {
6103             attr_size = apr_pstrdup(doc->pool, cur->value);
6104           }
6105           else if (STRCASEEQ('s','S',"small",cur->value)) {
6106             attr_size = apr_pstrdup(doc->pool, cur->value);
6107           }
6108           else if (STRCASEEQ('m','M',"medium",cur->value)) {
6109             attr_size = apr_pstrdup(doc->pool, cur->value);
6110           }
6111           else if (STRCASEEQ('l','L',"large",cur->value)) {
6112             attr_size = apr_pstrdup(doc->pool, cur->value);
6113           }
6114           else if (STRCASEEQ('x','X',"x-large",cur->value)) {
6115             attr_size = apr_pstrdup(doc->pool, cur->value);
6116           }
6117           else if (STRCASEEQ('x','X',"xx-large",cur->value)) {
6118             attr_size = apr_pstrdup(doc->pool, cur->value);
6119           }
6120         }
6121       }
6122     }
6123   }
6124   W_L("<span");
6125   W_L(" style=\"text-decoration:blink;");
6126   if (attr_color || attr_size) {
6127     if (attr_color) {
6128       attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
6129       W_L("color:");
6130       W_V(attr_color);
6131       W_L(";");
6132     }
6133     if (attr_size) {
6134       W_L("font-size:");
6135       W_V(attr_size);
6136       W_L(";");
6137     }
6138   }
6139   W_L("\"");
6140   W_L(">");
6141   return ixhtml10->out;
6142 }
6143
6144
6145 /**
6146  * It is a handler who processes the BLINK tag.
6147  *
6148  * @param pdoc  [i/o] The pointer to the IXHTML10 structure at the output
6149  *                     destination is specified.
6150  * @param node   [i]   The BLINK tag node is specified.
6151  * @return The conversion result is returned.
6152  */
6153 static char *
6154 s_ixhtml10_end_blink_tag(void *pdoc, Node *UNUSED(child))
6155 {
6156   ixhtml10_t *ixhtml10 = GET_IXHTML10(pdoc);
6157   Doc      *doc = ixhtml10->doc;
6158   W_L("</span>");
6159   if (IS_CSS_ON(ixhtml10->entryp)) {
6160     chxj_css_pop_prop_list(ixhtml10->css_prop_stack);
6161   }
6162   return ixhtml10->out;
6163 }
6164
6165
6166 /**
6167  * It is a handler who processes the MARQUEE tag.
6168  *
6169  * @param pdoc  [i/o] The pointer to the IXHTML10 structure at the output
6170  *                     destination is specified.
6171  * @param node   [i]   The MARQUEE tag node is specified.
6172  * @return The conversion result is returned.
6173  */
6174 static char *
6175 s_ixhtml10_start_marquee_tag(void *pdoc, Node *node)
6176 {
6177   ixhtml10_t *ixhtml10 = GET_IXHTML10(pdoc);
6178   Doc       *doc = ixhtml10->doc;
6179   Attr      *attr;
6180   char      *attr_direction = NULL;
6181   char      *attr_style     = NULL;
6182   char      *attr_color     = NULL;
6183   char      *attr_size      = NULL;
6184   char      *attr_bgcolor   = NULL;
6185   /*--------------------------------------------------------------------------*/
6186   /* Get Attributes                                                           */
6187   /*--------------------------------------------------------------------------*/
6188   for (attr = qs_get_attr(doc,node);
6189        attr;
6190        attr = qs_get_next_attr(doc,attr)) {
6191     char *name   = qs_get_attr_name(doc,attr);
6192     char *value  = qs_get_attr_value(doc,attr);
6193     if (STRCASEEQ('d','D',"direction", name)) {
6194       if (value) {
6195         if (STRCASEEQ('l','L',"left",value)) {
6196           attr_direction = "rtl";
6197         }
6198         else if (STRCASEEQ('r','R',"right",value)) {
6199           attr_direction = "ltr";
6200         }
6201       }
6202     }
6203     else if (STRCASEEQ('b','B',"behavior",name)) {
6204       /* ignore */
6205     }
6206     else if (STRCASEEQ('l','L',"loop",name)) {
6207       /* ignore */
6208     }
6209     else if (STRCASEEQ('b','B',"bgcolor",name)) {
6210       if (value && *value) {
6211         attr_bgcolor = value;
6212       }
6213     }
6214     else if (STRCASEEQ('s','S',"style",name) && value && *value) {
6215       attr_style = value;
6216     }
6217   }
6218   if (IS_CSS_ON(ixhtml10->entryp)) {
6219     css_prop_list_t *style = s_ixhtml10_nopush_and_get_now_style(pdoc, node, attr_style);
6220     if (style) {
6221       css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
6222       css_property_t *size_prop  = chxj_css_get_property_value(doc, style, "font-size");
6223       css_property_t *bgcolor_prop  = chxj_css_get_property_value(doc, style, "background-color");
6224       css_property_t *direction_prop  = chxj_css_get_property_value(doc, style, "-wap-marquee-dir");
6225       css_property_t *cur;
6226       for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
6227         if (cur->value && *cur->value) {
6228           attr_color = apr_pstrdup(doc->pool, cur->value);
6229         }
6230       }
6231       for (cur = bgcolor_prop->next; cur != bgcolor_prop; cur = cur->next) {
6232         if (cur->value && *cur->value) {
6233           attr_bgcolor = apr_pstrdup(doc->pool, cur->value);
6234         }
6235       }
6236       for (cur = direction_prop->next; cur != direction_prop; cur = cur->next) {
6237         if (cur->value && *cur->value) {
6238           attr_direction = apr_pstrdup(doc->pool, cur->value);
6239         }
6240       }
6241       for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
6242         if (cur->value && *cur->value) {
6243           if ( STRCASEEQ('x','X',"xx-small",cur->value)
6244             || STRCASEEQ('x','X',"x-small", cur->value)
6245             || STRCASEEQ('s','S',"small",   cur->value)
6246             || STRCASEEQ('m','M',"medium",  cur->value)
6247             || STRCASEEQ('l','L',"large",   cur->value)
6248             || STRCASEEQ('x','X',"x-large", cur->value)
6249             || STRCASEEQ('x','X',"xx-large",cur->value)) {
6250             attr_size = apr_pstrdup(doc->pool, cur->value);
6251           }
6252         }
6253       }
6254     }
6255   }
6256   W_L("<div");
6257   W_L(" style=\"display:-wap-marquee;");
6258   if (attr_color || attr_size || attr_direction || attr_bgcolor) {
6259     if (attr_direction) {
6260       W_L("-wap-marquee-dir:");
6261       W_V(attr_direction);
6262       W_L(";");
6263     }
6264     if (attr_bgcolor) {
6265       attr_bgcolor = chxj_css_rgb_func_to_value(doc->pool, attr_bgcolor);
6266       W_L("background-color:");
6267       W_V(attr_bgcolor);
6268       W_L(";");
6269     }
6270     if (attr_color) {
6271       attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
6272       W_L("color:");
6273       W_V(attr_color);
6274       W_L(";");
6275     }
6276     if (attr_size) {
6277       W_L("font-size:");
6278       W_V(attr_size);
6279       W_L(";");
6280     }
6281   }
6282   W_L("\"");
6283   W_L(">");
6284
6285   return ixhtml10->out;
6286 }
6287
6288
6289 /**
6290  * It is a handler who processes the MARQUEE tag.
6291  *
6292  * @param pdoc  [i/o] The pointer to the IXHTML10 structure at the output
6293  *                     destination is specified.
6294  * @param node   [i]   The MARQUEE tag node is specified.
6295  * @return The conversion result is returned.
6296  */
6297 static char *
6298 s_ixhtml10_end_marquee_tag(void *pdoc, Node *UNUSED(node))
6299 {
6300   ixhtml10_t *ixhtml10 = GET_IXHTML10(pdoc);
6301   Doc      *doc     = ixhtml10->doc;
6302   W_L("</div>");
6303   if (IS_CSS_ON(ixhtml10->entryp)) {
6304     chxj_css_pop_prop_list(ixhtml10->css_prop_stack);
6305   }
6306   return ixhtml10->out;
6307 }
6308
6309
6310 /**
6311  * It is handler who processes the New Line Code.
6312  */
6313 static char *
6314 s_ixhtml10_newline_mark(void *pdoc, Node *UNUSED(node))
6315 {
6316   ixhtml10_t *ixhtml10 = GET_IXHTML10(pdoc);
6317   Doc *doc = ixhtml10->doc;
6318   if (ixhtml10->start_html_flag) {
6319     W_NLCODE();
6320   }
6321   return ixhtml10->out;
6322 }
6323
6324
6325 /**
6326  * It is a handler who processes the LINK tag.
6327  *
6328  * @param pdoc  [i/o] The pointer to the IXHTML10 structure at the output
6329  *                     destination is specified.
6330  * @param node   [i]   The LINK tag node is specified.
6331  * @return The conversion result is returned.
6332  */
6333 static char *
6334 s_ixhtml10_link_tag(void *pdoc, Node *node)
6335 {
6336   ixhtml10_t      *ixhtml10;
6337   Doc           *doc;
6338   Attr          *attr;
6339   char          *rel  = NULL;
6340   char          *href = NULL;
6341   char          *type = NULL;
6342
6343   ixhtml10 = GET_IXHTML10(pdoc);
6344   doc    = ixhtml10->doc;
6345
6346   if (! IS_CSS_ON(ixhtml10->entryp)) {
6347     return ixhtml10->out;
6348   }
6349
6350   for (attr = qs_get_attr(doc,node);
6351        attr;
6352        attr = qs_get_next_attr(doc,attr)) {
6353     char *name  = qs_get_attr_name(doc,attr);
6354     char *value = qs_get_attr_value(doc,attr);
6355     if (STRCASEEQ('r','R',"rel", name)) {
6356       if (value && *value && STRCASEEQ('s','S',"stylesheet", value)) {
6357         rel = value;
6358       }
6359     }
6360     else if (STRCASEEQ('h','H',"href", name)) {
6361       if (value && *value) {
6362         href = value;
6363       }
6364     }
6365     else if (STRCASEEQ('t','T',"type", name)) {
6366       if (value && *value && STRCASEEQ('t','T',"text/css",value)) {
6367         type = value;
6368       }
6369     }
6370   }
6371
6372   if (rel && href && type) {
6373     DBG(doc->r,"REQ[%X] start load CSS. url:[%s]", TO_ADDR(doc->r),href);
6374     ixhtml10->style = chxj_css_parse_from_uri(doc->r, doc->pool, ixhtml10->style, href);
6375     DBG(doc->r,"REQ[%X] end load CSS. url:[%s]", TO_ADDR(doc->r),href);
6376   }
6377
6378   return ixhtml10->out;
6379 }
6380
6381
6382 static css_prop_list_t *
6383 s_ixhtml10_push_and_get_now_style(void *pdoc, Node *node, const char *style_attr_value)
6384 {
6385   ixhtml10_t *ixhtml10 = GET_IXHTML10(pdoc);
6386   Doc *doc = ixhtml10->doc;
6387   css_prop_list_t *last_css = NULL;
6388   if (IS_CSS_ON(ixhtml10->entryp)) {
6389     css_prop_list_t *dup_css;
6390     css_selector_t  *selector;
6391
6392     last_css = chxj_css_get_last_prop_list(ixhtml10->css_prop_stack);
6393     dup_css  = chxj_dup_css_prop_list(doc, last_css);
6394     selector = chxj_css_find_selector(doc, ixhtml10->style, node);
6395     if (selector) {
6396       chxj_css_prop_list_merge_property(doc, dup_css, selector);
6397     }
6398     chxj_css_push_prop_list(ixhtml10->css_prop_stack, dup_css);
6399     last_css = chxj_css_get_last_prop_list(ixhtml10->css_prop_stack);
6400
6401     if (style_attr_value) {
6402       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));
6403       if (ssheet) {
6404         chxj_css_prop_list_merge_property(doc, last_css, ssheet->selector_head.next);
6405       }
6406     }
6407   }
6408   return last_css;
6409 }
6410
6411
6412 static css_prop_list_t *
6413 s_ixhtml10_nopush_and_get_now_style(void *pdoc, Node *node, const char *style_attr_value)
6414 {
6415   ixhtml10_t *ixhtml10 = GET_IXHTML10(pdoc);
6416   Doc *doc = ixhtml10->doc;
6417   css_prop_list_t *last_css = NULL;
6418   if (IS_CSS_ON(ixhtml10->entryp)) {
6419     css_prop_list_t *dup_css;
6420     css_selector_t  *selector;
6421
6422     last_css = chxj_css_get_last_prop_list(ixhtml10->css_prop_stack);
6423     dup_css  = chxj_dup_css_prop_list(doc, last_css);
6424     selector = chxj_css_find_selector(doc, ixhtml10->style, node);
6425     if (selector) {
6426       chxj_css_prop_list_merge_property(doc, dup_css, selector);
6427     }
6428     last_css = dup_css;
6429
6430     if (style_attr_value) {
6431       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));
6432       if (ssheet) {
6433         chxj_css_prop_list_merge_property(doc, last_css, ssheet->selector_head.next);
6434       }
6435     }
6436   }
6437   return last_css;
6438 }
6439
6440
6441 /**
6442  * It is a handler who processes the SPAN tag.
6443  *
6444  * @param pdoc  [i/o] The pointer to the IXHTML10 structure at the output
6445  *                     destination is specified.
6446  * @param node   [i]   The SPAN tag node is specified.
6447  * @return The conversion result is returned.
6448  */
6449 static char *
6450 s_ixhtml10_start_span_tag(void *pdoc, Node *node)
6451 {
6452   ixhtml10_t *ixhtml10;
6453   Doc *doc;
6454   Attr *attr;
6455   char *attr_style         = NULL;
6456   char *attr_color         = NULL;
6457   char *attr_size          = NULL;
6458   char *attr_align         = NULL;
6459   char *attr_blink         = NULL;
6460   char *attr_marquee       = NULL;
6461   char *attr_marquee_dir   = NULL;
6462   char *attr_marquee_style = NULL;
6463   char *attr_marquee_loop  = NULL;
6464   char *css_bgcolor        = NULL;
6465
6466   ixhtml10 = GET_IXHTML10(pdoc);
6467   doc     = ixhtml10->doc;
6468
6469   for (attr = qs_get_attr(doc,node);
6470        attr;
6471        attr = qs_get_next_attr(doc,attr)) {
6472     char *nm  = qs_get_attr_name(doc,attr);
6473     char *val = qs_get_attr_value(doc,attr);
6474     if (val && STRCASEEQ('s','S',"style", nm)) {
6475       attr_style = val;
6476     }
6477   }
6478   if (IS_CSS_ON(ixhtml10->entryp)) {
6479     css_prop_list_t *style = s_ixhtml10_nopush_and_get_now_style(pdoc, node, attr_style);
6480     if (style) {
6481       css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
6482       css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
6483       css_property_t *text_align_prop = chxj_css_get_property_value(doc, style, "text-align");
6484       css_property_t *decoration_prop = chxj_css_get_property_value(doc, style, "text-decoration");
6485       css_property_t *display_prop = chxj_css_get_property_value(doc, style, "display");
6486       css_property_t *marquee_dir_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-dir");
6487       css_property_t *marquee_style_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-style");
6488       css_property_t *marquee_loop_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-loop");
6489       css_property_t *bgcolor_prop = chxj_css_get_property_value(doc, style, "background-color");
6490       
6491       css_property_t *cur;
6492       for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
6493         attr_color = apr_pstrdup(doc->pool, cur->value);
6494       }
6495       for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
6496         if (cur->value && *cur->value) {
6497           if ( STRCASEEQ('x','X',"xx-small",cur->value)
6498             || STRCASEEQ('x','X',"x-small", cur->value)
6499             || STRCASEEQ('s','S',"small",   cur->value)
6500             || STRCASEEQ('m','M',"medium",  cur->value)
6501             || STRCASEEQ('l','L',"large",   cur->value)
6502             || STRCASEEQ('x','X',"x-large", cur->value)
6503             || STRCASEEQ('x','X',"xx-large",cur->value)) {
6504             attr_size = apr_pstrdup(doc->pool, cur->value);
6505           }
6506         }
6507       }
6508       for (cur = decoration_prop->next; cur != decoration_prop; cur = cur->next) {
6509         if (cur->value && STRCASEEQ('b','B',"blink",cur->value)) {
6510           attr_blink = apr_pstrdup(doc->pool, cur->value);
6511         }
6512       }
6513       for (cur = display_prop->next; cur != display_prop; cur = cur->next) {
6514         if (cur->value && strcasecmp("-wap-marquee",cur->value) == 0) {
6515           attr_marquee = apr_pstrdup(doc->pool, cur->value);
6516         }
6517       }
6518       for (cur = marquee_dir_prop->next; cur != marquee_dir_prop; cur = cur->next) {
6519         if (cur->value && *cur->value) {
6520           if ( STRCASEEQ('l','L',"ltr",cur->value)
6521             || STRCASEEQ('r','R',"rtl",cur->value)) {
6522             attr_marquee_dir = apr_pstrdup(doc->pool, cur->value);
6523           }
6524         }
6525       }
6526       for (cur = marquee_style_prop->next; cur != marquee_style_prop; cur = cur->next) {
6527         if (cur->value && *cur->value) {
6528           if ( STRCASEEQ('s','S',"scroll",cur->value)
6529             || STRCASEEQ('s','S',"slide",cur->value)
6530             || STRCASEEQ('a','A',"alternate",cur->value)) {
6531             attr_marquee_style = apr_pstrdup(doc->pool, cur->value);
6532           }
6533         }
6534       }
6535       for (cur = marquee_loop_prop->next; cur != marquee_loop_prop; cur = cur->next) {
6536         if (cur->value && *cur->value) {
6537           if(strcmp(cur->value,"0") == 0 || strcmp(cur->value,"-1") == 0){
6538             attr_marquee_loop = "infinite";
6539           }
6540           else{
6541             attr_marquee_loop = apr_pstrdup(doc->pool, cur->value);
6542           }
6543         }
6544       }
6545       for (cur = text_align_prop->next; cur != text_align_prop; cur = cur->next) {
6546         if (STRCASEEQ('l','L',"left", cur->value)) {
6547           attr_align = apr_pstrdup(doc->pool, "left");
6548         }
6549         else if (STRCASEEQ('c','C',"center",cur->value)) {
6550           attr_align = apr_pstrdup(doc->pool, "center");
6551         }
6552         else if (STRCASEEQ('r','R',"right",cur->value)) {
6553           attr_align = apr_pstrdup(doc->pool, "right");
6554         }
6555       }
6556       for (cur = bgcolor_prop->next; cur != bgcolor_prop; cur = cur->next) {
6557         if (cur->value && *cur->value) {
6558           css_bgcolor = apr_pstrdup(doc->pool, cur->value);
6559         }
6560       }
6561     }
6562   }
6563
6564   W_L("<span");
6565   if (attr_color || attr_size || attr_align || attr_blink || attr_marquee || css_bgcolor) {
6566     W_L(" style=\"");
6567     if (attr_color) {
6568       attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
6569       W_L("color:");
6570       W_V(attr_color);
6571       W_L(";");
6572     }
6573     if (attr_size) {
6574       W_L("font-size:");
6575       W_V(attr_size);
6576       W_L(";");
6577     }
6578     if (attr_align) {
6579       W_L("text-align:");
6580       W_V(attr_align);
6581       W_L(";");
6582     }
6583     if (attr_blink) {
6584       W_L("text-decoration:");
6585       W_V("blink");
6586       W_L(";");
6587     }
6588     if (attr_marquee) {
6589       W_L("display:-wap-marquee;");
6590       if (attr_marquee_dir) {
6591         W_L("-wap-marquee-dir:");
6592         W_V(attr_marquee_dir);
6593         W_L(";");
6594       }
6595       if (attr_marquee_style) {
6596         W_L("-wap-marquee-style:");
6597         W_V(attr_marquee_style);
6598         W_L(";");
6599       }
6600       if (attr_marquee_loop) {
6601         W_L("-wap-marquee-loop:");
6602         W_V(attr_marquee_loop);
6603         W_L(";");
6604       }
6605     }
6606     if(css_bgcolor){
6607       W_L("background-color:");
6608       W_V(css_bgcolor);
6609       W_L(";");
6610     }
6611     W_L("\"");
6612   }
6613   W_L(">");
6614   return ixhtml10->out;
6615 }
6616
6617
6618 /**
6619  * It is a handler who processes the SPAN tag.
6620  *
6621  * @param pdoc  [i/o] The pointer to the IXHTML10 structure at the output
6622  *                     destination is specified.
6623  * @param node   [i]   The SPAN tag node is specified.
6624  * @return The conversion result is returned.
6625  */
6626 static char *
6627 s_ixhtml10_end_span_tag(void *pdoc, Node *UNUSED(node))
6628 {
6629   ixhtml10_t *ixhtml10 = GET_IXHTML10(pdoc);
6630   Doc *doc = ixhtml10->doc;
6631
6632   W_L("</span>");
6633   /*
6634   if (IS_CSS_ON(ixhtml10->entryp)) {
6635     chxj_css_pop_prop_list(ixhtml10->css_prop_stack);
6636   }
6637   */
6638   return ixhtml10->out;
6639 }
6640
6641
6642 /**
6643  * It is a handler who processes the STYLE tag.
6644  *
6645  * @param pdoc  [i/o] The pointer to the IXHTML10 structure at the output
6646  *                     destination is specified.
6647  * @param node   [i]   The STYLE tag node is specified.
6648  * @return The conversion result is returned.
6649  */
6650 static char *
6651 s_ixhtml10_style_tag(void *pdoc, Node *node)
6652 {
6653   ixhtml10_t     *ixhtml10;
6654   Doc           *doc;
6655   Attr          *attr;
6656   char          *type = NULL;
6657   Node          *child   = NULL;
6658   char          *style;
6659
6660   ixhtml10 = GET_IXHTML10(pdoc);
6661   doc     = ixhtml10->doc;
6662
6663   if (! IS_CSS_ON(ixhtml10->entryp)) {
6664     return ixhtml10->out;
6665   }
6666
6667   for (attr = qs_get_attr(doc,node);
6668        attr;
6669        attr = qs_get_next_attr(doc,attr)) {
6670     char *name  = qs_get_attr_name(doc,attr);
6671     char *value = qs_get_attr_value(doc,attr);
6672     if (STRCASEEQ('t','T',"type", name)) {
6673       if (value && *value && STRCASEEQ('t','T',"text/css",value)) {
6674         type = value;
6675       }
6676     }
6677   }
6678
6679   if (type) {
6680     style = "";
6681     for (child = qs_get_child_node(doc, node);
6682          child;
6683          child = qs_get_next_node(doc, child)) {
6684       char *name = qs_get_node_name(doc, child);
6685       if (STRCASEEQ('t','T',"text", name)) {
6686         char *value = qs_get_node_value(doc, child);
6687         if (value && *value) {
6688           style = apr_pstrcat(doc->r->pool, style, value, NULL);
6689         }
6690       }
6691     }
6692     if (strlen(style) > 0) {
6693       DBG(doc->r,"REQ[%X] start load CSS. buf:[%s]", TO_ADDR(doc->r),style);
6694       ixhtml10->style = chxj_css_parse_style_value(doc, ixhtml10->style, style);
6695       DBG(doc->r,"REQ[%X] end load CSS. value:[%s]", TO_ADDR(doc->r),style);
6696     }
6697   }
6698   return ixhtml10->out;
6699 }
6700
6701
6702 static char *
6703 s_ixhtml10_create_style_data(apr_pool_t *pool, const char *style_data)
6704 {
6705   if (! style_data) {
6706     return "";
6707   }
6708   return apr_pstrcat(pool, "<style type=\"text/css\"><![CDATA[",style_data, "]]></style>", NULL);
6709 }
6710
6711
6712 /**
6713  * It is a handler who processes the NOBR tag.
6714  *
6715  * @param pdoc  [i/o] The pointer to the IXHTML10 structure at the output
6716  *                     destination is specified.
6717  * @param node   [i]   The NOBR tag node is specified.
6718  * @return The conversion result is returned.
6719  */
6720 static char *
6721 s_ixhtml10_start_nobr_tag(void *pdoc, Node *UNUSED(node))
6722 {
6723   ixhtml10_t *ixhtml10;
6724   Doc *doc;
6725
6726   ixhtml10 = GET_IXHTML10(pdoc);
6727   doc     = ixhtml10->doc;
6728
6729   W_L("<nobr>");
6730   return ixhtml10->out;
6731 }
6732
6733
6734 /**
6735  * It is a handler who processes the NOBR tag.
6736  *
6737  * @param pdoc  [i/o] The pointer to the IXHTML10 structure at the output
6738  *                     destination is specified.
6739  * @param node   [i]   The NOBR tag node is specified.
6740  * @return The conversion result is returned.
6741  */
6742 static char *
6743 s_ixhtml10_end_nobr_tag(void *pdoc, Node *UNUSED(node))
6744 {
6745   ixhtml10_t *ixhtml10 = GET_IXHTML10(pdoc);
6746   Doc *doc = ixhtml10->doc;
6747
6748   W_L("</nobr>");
6749   return ixhtml10->out;
6750 }
6751
6752
6753
6754 /**
6755  * It is a handler who processes the SMALL tag.
6756  *
6757  * @param pdoc  [i/o] The pointer to the IXHTML10 structure at the output
6758  *                     destination is specified.
6759  * @param node   [i]   The SMALL tag node is specified.
6760  * @return The conversion result is returned.
6761  */
6762 static char *
6763 s_ixhtml10_start_small_tag(void *pdoc, Node *UNUSED(node))
6764 {
6765   ixhtml10_t *ixhtml10;
6766   Doc *doc;
6767
6768   ixhtml10 = GET_IXHTML10(pdoc);
6769   doc     = ixhtml10->doc;
6770
6771   W_L("<small>");
6772   return ixhtml10->out;
6773 }
6774
6775
6776 /**
6777  * It is a handler who processes the SMALL tag.
6778  *
6779  * @param pdoc  [i/o] The pointer to the IXHTML10 structure at the output
6780  *                     destination is specified.
6781  * @param node   [i]   The SMALL tag node is specified.
6782  * @return The conversion result is returned.
6783  */
6784 static char *
6785 s_ixhtml10_end_small_tag(void *pdoc, Node *UNUSED(node))
6786 {
6787   ixhtml10_t *ixhtml10 = GET_IXHTML10(pdoc);
6788   Doc *doc = ixhtml10->doc;
6789
6790   W_L("</small>");
6791   return ixhtml10->out;
6792 }
6793
6794 /**
6795  * It is a handler who processes the OBJECT tag.
6796  *
6797  * @param pdoc  [i/o] The pointer to the IXHTML10 structure at the output
6798  *                     destination is specified.
6799  * @param node   [i]   The OBJECT tag node is specified.
6800  * @return The conversion result is returned.
6801  */
6802 static char *
6803 s_ixhtml10_start_object_tag(void *pdoc, Node *node)
6804 {
6805   ixhtml10_t *ixhtml10 = GET_IXHTML10(pdoc);
6806   Doc       *doc = ixhtml10->doc;
6807   Attr *attr;
6808   char *attr_id            = NULL;
6809   char *attr_width         = NULL;
6810   char *attr_height        = NULL;
6811   char *attr_data          = NULL;
6812   char *attr_type          = NULL;
6813   char *attr_declare       = NULL;
6814   
6815   /*--------------------------------------------------------------------------*/
6816   /* Get Attributes                                                           */
6817   /*--------------------------------------------------------------------------*/
6818   for (attr = qs_get_attr(doc,node);
6819        attr;
6820        attr = qs_get_next_attr(doc,attr)) {
6821     char *name   = qs_get_attr_name(doc,attr);
6822     char *value  = qs_get_attr_value(doc,attr);
6823     if (STRCASEEQ('i','I',"id",name)) {
6824       attr_id = apr_pstrdup(doc->pool, value);
6825     }
6826     else if (STRCASEEQ('w','W',"width",name)) {
6827       attr_width = apr_pstrdup(doc->pool, value);
6828     }
6829     else if (STRCASEEQ('h','H',"height",name)) {
6830       attr_height = apr_pstrdup(doc->pool, value);
6831     }
6832     else if (STRCASEEQ('d','D',"data",name)) {
6833       attr_data = apr_pstrdup(doc->pool, value);
6834     }
6835     else if  (STRCASEEQ('t','T',"type",name)) {
6836       attr_type = apr_pstrdup(doc->pool, value);
6837     }
6838     else if  (STRCASEEQ('d','D',"declare",name)) {
6839       attr_declare = apr_pstrdup(doc->pool, value);
6840     }
6841   }
6842   W_L("<object");
6843   
6844   if(attr_id){
6845     W_L(" id=\"");
6846     W_V(attr_id);
6847     W_L("\"");
6848   }
6849   if(attr_width){
6850     W_L(" width=\"");
6851     W_V(attr_width);
6852     W_L("\"");
6853   }
6854   if(attr_height){
6855     W_L(" height=\"");
6856     W_V(attr_height);
6857     W_L("\"");
6858   }
6859   if(attr_data){
6860     W_L(" data=\"");
6861     W_V(attr_data);
6862     W_L("\"");
6863   }
6864   if(attr_type){
6865     W_L(" type=\"");
6866     W_V(attr_type);
6867     W_L("\"");
6868   }
6869   if(attr_declare){
6870     W_L(" declare=\"declare\"");
6871   }
6872   
6873   W_L(">");
6874   return ixhtml10->out;
6875 }
6876
6877
6878 /**
6879  * It is a handler who processes the OBJECT tag.
6880  *
6881  * @param pdoc  [i/o] The pointer to the IXHTML10 structure at the output
6882  *                     destination is specified.
6883  * @param node   [i]   The OBJECT tag node is specified.
6884  * @return The conversion result is returned.
6885  */
6886 static char *
6887 s_ixhtml10_end_object_tag(void *pdoc, Node *UNUSED(node))
6888 {
6889   ixhtml10_t *ixhtml10 = GET_IXHTML10(pdoc);
6890   Doc *doc = ixhtml10->doc;
6891
6892   W_L("</object>");
6893   return ixhtml10->out;
6894 }
6895
6896 /**
6897  * It is a handler who processes the PARAM tag.
6898  *
6899  * @param pdoc  [i/o] The pointer to the IXHTML10 structure at the output
6900  *                     destination is specified.
6901  * @param node   [i]   The PARAM tag node is specified.
6902  * @return The conversion result is returned.
6903  */
6904 static char *
6905 s_ixhtml10_start_param_tag(void *pdoc, Node *node)
6906 {
6907   ixhtml10_t *ixhtml10 = GET_IXHTML10(pdoc);
6908   Doc       *doc = ixhtml10->doc;
6909   Attr *attr;
6910   char *attr_name          = NULL;
6911   char *attr_value         = NULL;
6912   char *attr_valuetype     = NULL;
6913   
6914   /*--------------------------------------------------------------------------*/
6915   /* Get Attributes                                                           */
6916   /*--------------------------------------------------------------------------*/
6917   for (attr = qs_get_attr(doc,node);
6918        attr;
6919        attr = qs_get_next_attr(doc,attr)) {
6920     char *name   = qs_get_attr_name(doc,attr);
6921     char *value  = qs_get_attr_value(doc,attr);
6922     if (STRCASEEQ('n','N',"name",name)) {
6923       attr_name = apr_pstrdup(doc->pool, value);
6924     }
6925     else if (STRCASEEQ('v','V',"value",name)) {
6926       attr_value = apr_pstrdup(doc->pool, value);
6927     }
6928     else if (STRCASEEQ('v','V',"valuetype",name)) {
6929       attr_valuetype = apr_pstrdup(doc->pool, value);
6930     }
6931   }
6932   W_L("<param");
6933   
6934   if(attr_name){
6935     W_L(" name=\"");
6936     W_V(attr_name);
6937     W_L("\"");
6938   }
6939   if(attr_value){
6940     W_L(" value=\"");
6941     W_V(attr_value);
6942     W_L("\"");
6943   }
6944   if(attr_valuetype){
6945     W_L(" valuetype=\"");
6946     W_V(attr_valuetype);
6947     W_L("\"");
6948   }
6949   W_L("/>");
6950   return ixhtml10->out;
6951 }
6952
6953 /**
6954  * It is a handler who processes the CAPTION tag.
6955  *
6956  * @param pdoc  [i/o] The pointer to the IXHTML10 structure at the output
6957  *                     destination is specified.
6958  * @param node   [i]   The CAPTION tag node is specified.
6959  * @return The conversion result is returned.
6960  */
6961 static char *
6962 s_ixhtml10_start_caption_tag(void *pdoc, Node *node)
6963 {
6964   ixhtml10_t    *ixhtml10;
6965   Doc         *doc;
6966   request_rec *r;
6967   Attr        *attr;
6968   char        *attr_style = NULL;
6969   char        *attr_align = NULL;
6970
6971   ixhtml10   = GET_IXHTML10(pdoc);
6972   doc     = ixhtml10->doc;
6973   r       = doc->r;
6974
6975   for (attr = qs_get_attr(doc,node);
6976        attr;
6977        attr = qs_get_next_attr(doc,attr)) {
6978     char *name  = qs_get_attr_name(doc,attr);
6979     char *value = qs_get_attr_value(doc,attr);
6980     if (STRCASEEQ('a','A',"align", name)) {
6981       if (value && 
6982           (STRCASEEQ('l','L',"left",value) 
6983         || STRCASEEQ('r','R',"right",value) 
6984         || STRCASEEQ('t','T',"top",value)
6985         || STRCASEEQ('b','B',"bottom",value) 
6986         )) {
6987         attr_align = value;
6988       }
6989     }
6990     else if (STRCASEEQ('s','S',"style",name) && value && *value) {
6991       attr_style = value;
6992     }
6993   }
6994   W_L("<caption");
6995   if(attr_align){
6996     W_L(" align=\"");
6997     W_V(attr_align);
6998     W_L("\"");
6999   }
7000   W_L(">");
7001   return ixhtml10->out;
7002 }
7003
7004
7005 /**
7006  * It is a handler who processes the CAPTION tag.
7007  *
7008  * @param pdoc  [i/o] The pointer to the IXHTML10 structure at the output
7009  *                     destination is specified.
7010  * @param node   [i]   The CAPTION tag node is specified.
7011  * @return The conversion result is returned.
7012  */
7013 static char *
7014 s_ixhtml10_end_caption_tag(void *pdoc, Node *UNUSED(node))
7015 {
7016   ixhtml10_t *ixhtml10 = GET_IXHTML10(pdoc);
7017   Doc *doc = ixhtml10->doc;
7018
7019   W_L("</caption>");
7020   return ixhtml10->out;
7021 }
7022
7023 /*
7024  * vim:ts=2 et
7025  */