OSDN Git Service

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