OSDN Git Service

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