OSDN Git Service

* Fixed Bug.
[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
28
29 #define GET_JXHTML(X) ((jxhtml_t *)(X))
30 #undef W_L
31 #undef W_V
32 #define W_L(X)          do { jxhtml->out = BUFFERED_WRITE_LITERAL(jxhtml->out, &doc->buf, (X)); } while(0)
33 #define W_V(X)          do { jxhtml->out = (X) ? BUFFERED_WRITE_VALUE(jxhtml->out, &doc->buf, (X))  \
34                                                : BUFFERED_WRITE_LITERAL(jxhtml->out, &doc->buf, ""); } while(0)
35 #undef W_NLCODE
36 #define W_NLCODE()     do { char *nlcode = TO_NLCODE(jxhtml->conf); W_V(nlcode); } while (0)
37
38 static char *s_jxhtml_start_html_tag     (void *pdoc, Node *node);
39 static char *s_jxhtml_end_html_tag       (void *pdoc, Node *node);
40 static char *s_jxhtml_start_meta_tag     (void *pdoc, Node *node);
41 static char *s_jxhtml_end_meta_tag       (void *pdoc, Node *node);
42 static char *s_jxhtml_start_head_tag     (void *pdoc, Node *node);
43 static char *s_jxhtml_end_head_tag       (void *pdoc, Node *node);
44 static char *s_jxhtml_start_title_tag    (void *pdoc, Node *node);
45 static char *s_jxhtml_end_title_tag      (void *pdoc, Node *node);
46 static char *s_jxhtml_start_base_tag     (void *pdoc, Node *node);
47 static char *s_jxhtml_end_base_tag       (void *pdoc, Node *node);
48 static char *s_jxhtml_start_body_tag     (void *pdoc, Node *node);
49 static char *s_jxhtml_end_body_tag       (void *pdoc, Node *node);
50 static char *s_jxhtml_start_a_tag        (void *pdoc, Node *node);
51 static char *s_jxhtml_end_a_tag          (void *pdoc, Node *node);
52 static char *s_jxhtml_start_pre_tag      (void *pdoc, Node *node);
53 static char *s_jxhtml_end_pre_tag        (void *pdoc, Node *node);
54 static char *s_jxhtml_start_p_tag        (void *pdoc, Node *node);
55 static char *s_jxhtml_end_p_tag          (void *pdoc, Node *node);
56 static char *s_jxhtml_start_ul_tag       (void *pdoc, Node *node);
57 static char *s_jxhtml_end_ul_tag         (void *pdoc, Node *node);
58 static char *s_jxhtml_start_ol_tag       (void *pdoc, Node *node);
59 static char *s_jxhtml_end_ol_tag         (void *pdoc, Node *node);
60 static char *s_jxhtml_start_li_tag       (void *pdoc, Node *node);
61 static char *s_jxhtml_end_li_tag         (void *pdoc, Node *node);
62 static char *s_jxhtml_start_br_tag       (void *pdoc, Node *node);
63 static char *s_jxhtml_end_br_tag         (void *pdoc, Node *node);
64 static char *s_jxhtml_start_tr_tag       (void *pdoc, Node *node);
65 static char *s_jxhtml_end_tr_tag         (void *pdoc, Node *node);
66 static char *s_jxhtml_start_font_tag     (void *pdoc, Node *node);
67 static char *s_jxhtml_end_font_tag       (void *pdoc, Node *node);
68 static char *s_jxhtml_start_form_tag     (void *pdoc, Node *node);
69 static char *s_jxhtml_end_form_tag       (void *pdoc, Node *node);
70 static char *s_jxhtml_start_input_tag    (void *pdoc, Node *node);
71 static char *s_jxhtml_end_input_tag      (void *pdoc, Node *node);
72 static char *s_jxhtml_start_center_tag   (void *pdoc, Node *node);
73 static char *s_jxhtml_end_center_tag     (void *pdoc, Node *node);
74 static char *s_jxhtml_start_hr_tag       (void *pdoc, Node *node);
75 static char *s_jxhtml_end_hr_tag         (void *pdoc, Node *node);
76 static char *s_jxhtml_start_img_tag      (void *pdoc, Node *node);
77 static char *s_jxhtml_end_img_tag        (void *pdoc, Node *node);
78 static char *s_jxhtml_start_select_tag   (void *pdoc, Node *node);
79 static char *s_jxhtml_end_select_tag     (void *pdoc, Node *node);
80 static char *s_jxhtml_start_option_tag   (void *pdoc, Node *node);
81 static char *s_jxhtml_end_option_tag     (void *pdoc, Node *node);
82 static char *s_jxhtml_start_div_tag      (void *pdoc, Node *node);
83 static char *s_jxhtml_end_div_tag        (void *pdoc, Node *node);
84 static char *s_jxhtml_start_textarea_tag (void *pdoc, Node *node);
85 static char *s_jxhtml_end_textarea_tag   (void *pdoc, Node *node);
86 static char *s_jxhtml_start_b_tag        (void *pdoc, Node *node);
87 static char *s_jxhtml_end_b_tag          (void *pdoc, Node *node);
88 static char *s_jxhtml_chxjif_tag         (void *pdoc, Node *node); 
89 static char *s_jxhtml_text_tag           (void *pdoc, Node *node);
90 static char *s_jxhtml_start_blockquote_tag(void *pdoc, Node *node);
91 static char *s_jxhtml_end_blockquote_tag  (void *pdoc, Node *node);
92 static char *s_jxhtml_start_dir_tag      (void *pdoc, Node *node);
93 static char *s_jxhtml_end_dir_tag        (void *pdoc, Node *node);
94 static char *s_jxhtml_start_dl_tag       (void *pdoc, Node *node);
95 static char *s_jxhtml_end_dl_tag         (void *pdoc, Node *node);
96 static char *s_jxhtml_start_dt_tag       (void *pdoc, Node *node);
97 static char *s_jxhtml_end_dt_tag         (void *pdoc, Node *node);
98 static char *s_jxhtml_start_dd_tag       (void *pdoc, Node *node);
99 static char *s_jxhtml_end_dd_tag         (void *pdoc, Node *node);
100 static char *s_jxhtml_start_h1_tag       (void *pdoc, Node *node);
101 static char *s_jxhtml_end_h1_tag         (void *pdoc, Node *node);
102 static char *s_jxhtml_start_h2_tag       (void *pdoc, Node *node);
103 static char *s_jxhtml_end_h2_tag         (void *pdoc, Node *node);
104 static char *s_jxhtml_start_h3_tag       (void *pdoc, Node *node);
105 static char *s_jxhtml_end_h3_tag         (void *pdoc, Node *node);
106 static char *s_jxhtml_start_h4_tag       (void *pdoc, Node *node);
107 static char *s_jxhtml_end_h4_tag         (void *pdoc, Node *node);
108 static char *s_jxhtml_start_h5_tag       (void *pdoc, Node *node);
109 static char *s_jxhtml_end_h5_tag         (void *pdoc, Node *node);
110 static char *s_jxhtml_start_h6_tag       (void *pdoc, Node *node);
111 static char *s_jxhtml_end_h6_tag         (void *pdoc, Node *node);
112 static char *s_jxhtml_start_menu_tag     (void *pdoc, Node *node);
113 static char *s_jxhtml_end_menu_tag       (void *pdoc, Node *node);
114 static char *s_jxhtml_start_plaintext_tag       (void *pdoc, Node *node);
115 static char *s_jxhtml_start_plaintext_tag_inner (void *pdoc, Node *node);
116 static char *s_jxhtml_end_plaintext_tag         (void *pdoc, Node *node);
117 static char *s_jxhtml_start_blink_tag  (void *pdoc, Node *node);
118 static char *s_jxhtml_end_blink_tag    (void *pdoc, Node *node);
119 static char *s_jxhtml_start_marquee_tag(void *pdoc, Node *node);
120 static char *s_jxhtml_end_marquee_tag  (void *pdoc, Node *node);
121 static char *s_jxhtml_newline_mark       (void *pdoc, Node *node);
122
123 static void  s_init_jxhtml(jxhtml_t *jxhtml, Doc *doc, request_rec *r, device_table *spec);
124
125 static int   s_jxhtml_search_emoji(jxhtml_t *jxhtml, char *txt, char **rslt);
126
127 static char *s_jxhtml_istyle_to_mode(apr_pool_t *p, const char *s);
128
129
130
131 tag_handler jxhtml_handler[] = {
132   /* tagHTML */
133   {
134     s_jxhtml_start_html_tag,
135     s_jxhtml_end_html_tag,
136   },
137   /* tagMETA */
138   {
139     s_jxhtml_start_meta_tag,
140     s_jxhtml_end_meta_tag,
141   },
142   /* tagTEXTAREA */
143   {
144     s_jxhtml_start_textarea_tag,
145     s_jxhtml_end_textarea_tag,
146   },
147   /* tagP */
148   {
149     s_jxhtml_start_p_tag,
150     s_jxhtml_end_p_tag,
151   },
152   /* tagPRE */
153   {
154     s_jxhtml_start_pre_tag,
155     s_jxhtml_end_pre_tag,
156   },
157   /* tagUL */
158   {
159     s_jxhtml_start_ul_tag,
160     s_jxhtml_end_ul_tag,
161   },
162   /* tagLI */
163   {
164     s_jxhtml_start_li_tag,
165     s_jxhtml_end_li_tag,
166   },
167   /* tagOL */
168   {
169     s_jxhtml_start_ol_tag,
170     s_jxhtml_end_ol_tag,
171   },
172   /* tagH1 */
173   {
174     s_jxhtml_start_h1_tag,
175     s_jxhtml_end_h1_tag,
176   },
177   /* tagH2 */
178   {
179     s_jxhtml_start_h2_tag,
180     s_jxhtml_end_h2_tag,
181   },
182   /* tagH3 */
183   {
184     s_jxhtml_start_h3_tag,
185     s_jxhtml_end_h3_tag,
186   },
187   /* tagH4 */
188   {
189     s_jxhtml_start_h4_tag,
190     s_jxhtml_end_h4_tag,
191   },
192   /* tagH5 */
193   {
194     s_jxhtml_start_h5_tag,
195     s_jxhtml_end_h5_tag,
196   },
197   /* tagH6 */
198   {
199     s_jxhtml_start_h6_tag,
200     s_jxhtml_end_h6_tag,
201   },
202   /* tagHEAD */
203   {
204     s_jxhtml_start_head_tag,
205     s_jxhtml_end_head_tag,
206   },
207   /* tagTITLE */
208   {
209     s_jxhtml_start_title_tag,
210     s_jxhtml_end_title_tag,
211   },
212   /* tagBASE */
213   {
214     s_jxhtml_start_base_tag,
215     s_jxhtml_end_base_tag,
216   },
217   /* tagBODY */
218   {
219     s_jxhtml_start_body_tag,
220     s_jxhtml_end_body_tag,
221   },
222   /* tagA */
223   {
224     s_jxhtml_start_a_tag,
225     s_jxhtml_end_a_tag,
226   },
227   /* tagBR */
228   {
229     s_jxhtml_start_br_tag,
230     s_jxhtml_end_br_tag,
231   },
232   /* tagTABLE */
233   {
234     NULL,
235     NULL,
236   },
237   /* tagTR */
238   {
239     s_jxhtml_start_tr_tag,
240     s_jxhtml_end_tr_tag,
241   },
242   /* tagTD */
243   {
244     NULL,
245     NULL,
246   },
247   /* tagTBODY */
248   {
249     NULL,
250     NULL,
251   },
252   /* tagFONT */
253   {
254     s_jxhtml_start_font_tag,
255     s_jxhtml_end_font_tag,
256   },
257   /* tagFORM */
258   {
259     s_jxhtml_start_form_tag,
260     s_jxhtml_end_form_tag,
261   },
262   /* tagINPUT */
263   {
264     s_jxhtml_start_input_tag,
265     s_jxhtml_end_input_tag,
266   },
267   /* tagCENTER */
268   {
269     s_jxhtml_start_center_tag,
270     s_jxhtml_end_center_tag,
271   },
272   /* tagHR */
273   {
274     s_jxhtml_start_hr_tag,
275     s_jxhtml_end_hr_tag,
276   },
277   /* tagIMG */
278   {
279     s_jxhtml_start_img_tag,
280     s_jxhtml_end_img_tag,
281   },
282   /* tagSELECT */
283   {
284     s_jxhtml_start_select_tag,
285     s_jxhtml_end_select_tag,
286   },
287   /* tagOPTION */
288   {
289     s_jxhtml_start_option_tag,
290     s_jxhtml_end_option_tag,
291   },
292   /* tagDIV */
293   {
294     s_jxhtml_start_div_tag,
295     s_jxhtml_end_div_tag,
296   },
297   /* tagCHXJIF */
298   {
299     s_jxhtml_chxjif_tag,
300     NULL,
301   },
302   /* tagNOBR */
303   {
304     NULL,
305     NULL,
306   },
307   /* tagSMALL */
308   {
309     NULL,
310     NULL,
311   },
312   /* tagSTYLE */
313   {
314     NULL,
315     NULL,
316   },
317   /* tagSPAN */
318   {
319     NULL,
320     NULL,
321   },
322   /* tagTEXT */
323   {
324     s_jxhtml_text_tag,
325     NULL,
326   },
327   /* tagTH */
328   {
329     NULL,
330     NULL,
331   },
332   /* tagB */
333   {
334     s_jxhtml_start_b_tag,
335     s_jxhtml_end_b_tag,
336   },
337   /* tagFIELDSET */
338   {
339     NULL,
340     NULL,
341   },
342   /* tagDT */
343   {
344     s_jxhtml_start_dt_tag,
345     s_jxhtml_end_dt_tag,
346   },
347   /* tagLEGEND */
348   {
349     NULL,
350     NULL,
351   },
352   /* tagLABEL */
353   {
354     NULL,
355     NULL,
356   },
357   /* tagBLOCKQUOTE */
358   {
359     s_jxhtml_start_blockquote_tag,
360     s_jxhtml_end_blockquote_tag,
361   },
362   /* tagDIR */
363   {
364     s_jxhtml_start_dir_tag,
365     s_jxhtml_end_dir_tag,
366   },
367   /* tagDL */
368   {
369     s_jxhtml_start_dl_tag,
370     s_jxhtml_end_dl_tag,
371   },
372   /* tagDD */
373   {
374     s_jxhtml_start_dd_tag,
375     s_jxhtml_end_dd_tag,
376   },
377   /* tagMENU */
378   {
379     s_jxhtml_start_menu_tag,
380     s_jxhtml_end_menu_tag,
381   },
382   /* tagPLAINTEXT */
383   {
384     s_jxhtml_start_plaintext_tag,
385     s_jxhtml_end_plaintext_tag,
386   },
387   /* tagBLINK */
388   {
389     s_jxhtml_start_blink_tag,
390     s_jxhtml_end_blink_tag,
391   },
392   /* tagMARQUEE */
393   {
394     s_jxhtml_start_marquee_tag,
395     s_jxhtml_end_marquee_tag,
396   },
397   /* tagNLMARK */
398   {
399     s_jxhtml_newline_mark,
400     NULL,
401   },
402 };
403
404
405 /**
406  * converts from CHTML5.0 to JXHTML.
407  *
408  * @param r     [i]   Requet_rec is appointed.
409  * @param spec  [i]   The result of the device specification processing which 
410  *                    was done in advance is appointed.
411  * @param src   [i]   The character string before the converting is appointed.
412  * @return The character string after the converting is returned.
413  */
414 char *
415 chxj_convert_jxhtml(
416   request_rec         *r,
417   device_table        *spec,
418   const char          *src,
419   apr_size_t          srclen,
420   apr_size_t          *dstlen,
421   chxjconvrule_entry  *entryp,
422   cookie_t            *cookie
423 )
424 {
425   char      *dst;
426   char      *ss;
427   jxhtml_t   jxhtml;
428   Doc       doc;
429
430   dst = NULL;
431
432   /*--------------------------------------------------------------------------*/
433   /* If qrcode xml                                                            */
434   /*--------------------------------------------------------------------------*/
435   *dstlen = srclen;
436   dst = chxj_qr_code_blob_handler(r, src, (size_t*)dstlen);
437   if (dst) {
438     DBG(r,"I found qrcode xml");
439     return dst;
440   }
441   DBG(r,"not found qrcode xml");
442
443   /*--------------------------------------------------------------------------*/
444   /* The CHTML structure is initialized.                                      */
445   /*--------------------------------------------------------------------------*/
446   s_init_jxhtml(&jxhtml, &doc, r, spec);
447
448   jxhtml.entryp = entryp;
449   jxhtml.cookie = cookie;
450
451   chxj_set_content_type(r, chxj_header_inf_set_content_type(r, "application/xhtml+xml; charset=Windows-31J"));
452
453   /*--------------------------------------------------------------------------*/
454   /* The character string of the input is analyzed.                           */
455   /*--------------------------------------------------------------------------*/
456   qs_init_malloc(&doc);
457   qs_init_root_node(&doc);
458
459   ss = apr_pcalloc(r->pool, srclen + 1);
460
461   memset(ss,   0, srclen + 1);
462   memcpy(ss, src, srclen);
463
464 #ifdef DUMP_LOG
465   chxj_dump_out("[src] CHTML -> JXHTML", ss, srclen);
466 #endif
467
468   qs_parse_string(&doc,ss,strlen(ss));
469
470   chxj_buffered_write_init(r->pool, &doc.buf);
471   /*--------------------------------------------------------------------------*/
472   /* It converts it from CHTML to JXHTML.                                      */
473   /*--------------------------------------------------------------------------*/
474   chxj_node_convert(spec,r,(void*)&jxhtml, &doc, qs_get_root(&doc), 0);
475   jxhtml.out = chxj_buffered_write_flush(jxhtml.out, &doc.buf);
476   dst = apr_pstrdup(r->pool, jxhtml.out);
477   chxj_buffered_write_terminate(&doc.buf);
478
479
480   qs_all_free(&doc,QX_LOGMARK);
481
482   if (! dst) 
483     return apr_pstrdup(r->pool,ss);
484
485   if (! strlen(dst)) 
486     dst = apr_psprintf(r->pool, "\n");
487
488   *dstlen = strlen(dst);
489
490 #ifdef DUMP_LOG
491   chxj_dump_out("[dst] CHTML -> JXHTML", dst, *dstlen);
492 #endif
493
494   return dst;
495 }
496
497
498 /**
499  * The CHTML structure is initialized.
500  *
501  * @param jxhtml [i/o] The pointer to the JXHTML structure that wants to be
502  *                   initialized is specified.
503  * @param doc   [i]   The Doc structure that should be set to the initialized
504  *                   JXHTML structure is specified.
505  * @param r     [i]   To use POOL, the pointer to request_rec is specified.
506  * @param spec  [i]   The pointer to the device_table
507  */
508 static void
509 s_init_jxhtml(jxhtml_t *jxhtml, Doc *doc, request_rec *r, device_table *spec)
510 {
511   memset(doc,   0, sizeof(Doc));
512   memset(jxhtml, 0, sizeof(jxhtml_t));
513
514   doc->r      = r;
515   jxhtml->doc  = doc;
516   jxhtml->spec = spec;
517   jxhtml->out  = qs_alloc_zero_byte_string(r->pool);
518   jxhtml->conf = chxj_get_module_config(r->per_dir_config, &chxj_module);
519   jxhtml->doc->parse_mode = PARSE_MODE_CHTML;
520 }
521
522
523 /**
524  * Corresponding EMOJI to a current character-code is retrieved. 
525  * The substitution character string is stored in the rslt pointer if agreeing.
526  *
527  * @param jxhtml   [i]   The pointer to the CHTML structure is specified. 
528  * @param txt     [i]   The character string to want to examine whether it is 
529  *                      EMOJI is specified. 
530  * @param rslt    [o]   The pointer to the pointer that stores the result is 
531  *                      specified. 
532  * @return When corresponding EMOJI exists, it returns it excluding 0. 
533  */
534 static int
535 s_jxhtml_search_emoji(jxhtml_t *jxhtml, char *txt, char **rslt)
536 {
537   emoji_t       *ee;
538   request_rec   *r;
539   device_table  *spec;
540   int           len;
541
542   spec = jxhtml->spec;
543
544   len = strlen(txt);
545   r = jxhtml->doc->r;
546
547   if (! spec) DBG(r,"spec is NULL");
548
549   for (ee = jxhtml->conf->emoji;
550        ee;
551        ee = ee->next) {
552
553     unsigned char hex1byte;
554     unsigned char hex2byte;
555
556     if (! ee->imode) { 
557       DBG(r,"emoji->imode is NULL");
558       continue;
559     }
560
561     hex1byte = ee->imode->hex1byte & 0xff;
562     hex2byte = ee->imode->hex2byte & 0xff;
563
564     if (ee->imode->string
565     &&  strlen(ee->imode->string) > 0
566     &&  strncasecmp(ee->imode->string, txt, strlen(ee->imode->string)) == 0) {
567       if (spec == NULL || spec->emoji_type == NULL) {
568         *rslt = apr_psprintf(r->pool,"\e%s\ f", ee->jphone->string);
569         return strlen(ee->imode->string);
570       }
571
572       return 0;
573     }
574
575     if (len >= 2
576     && ((unsigned char)txt[0] & 0xff) == ((unsigned char)hex1byte)
577     && ((unsigned char)txt[1] & 0xff) == ((unsigned char)hex2byte)) {
578       if (spec == NULL || spec->emoji_type == NULL) {
579         *rslt = apr_psprintf(r->pool,"\e%s\ f", ee->jphone->string);
580         return 2;
581       }
582
583       return 0;
584     }
585   }
586
587   return 0;
588 }
589
590
591 char *
592 chxj_jxhtml_emoji_only_converter(request_rec *r, device_table *spec, const char *src, apr_size_t len)
593 {
594   apr_size_t ii;
595   Doc __doc;
596   Doc *doc;
597   jxhtml_t __jxhtml;
598   jxhtml_t *jxhtml;
599   char one_byte[2];
600   char two_byte[3];
601   apr_pool_t *pool;
602
603   jxhtml = &__jxhtml;
604   doc    = &__doc;
605
606   DBG(r, "REQ[%X] start chxj_jxhtml_emoji_eonly_converter()", (apr_size_t)(unsigned int)r);
607   memset(doc,    0, sizeof(Doc));
608   memset(jxhtml, 0, sizeof(jxhtml_t));
609
610   doc->r       = r;
611   jxhtml->doc  = doc;
612   jxhtml->spec = spec;
613   jxhtml->out  = qs_alloc_zero_byte_string(r->pool);
614   jxhtml->conf = chxj_get_module_config(r->per_dir_config, &chxj_module);
615   jxhtml->doc->parse_mode = PARSE_MODE_CHTML;
616
617   apr_pool_create(&pool, r->pool);
618
619   chxj_buffered_write_init(pool, &doc->buf);
620
621   for (ii=0; ii<len; ii++) {
622     char *out;
623     int   rtn;
624
625     rtn = s_jxhtml_search_emoji(jxhtml, (char *)&src[ii], &out);
626     if (rtn) {
627       W_V(out);
628       ii+=(rtn - 1);
629       continue;
630     }
631
632     if (is_sjis_kanji(src[ii])) {
633       two_byte[0] = src[ii+0];
634       two_byte[1] = src[ii+1];
635       two_byte[2] = 0;
636       W_V(two_byte);
637       ii++;
638     }
639     else {
640       one_byte[0] = src[ii+0];
641       one_byte[1] = 0;
642       W_V(one_byte);
643     }
644   }
645   jxhtml->out = chxj_buffered_write_flush(jxhtml->out, &doc->buf);
646
647   DBG(r, "REQ[%X] end chxj_jxhtml_emoji_eonly_converter()", (apr_size_t)(unsigned int)r);
648   return jxhtml->out;
649 }
650
651
652 /**
653  * It is a handler who processes the HTML tag.
654  *
655  * @param pdoc  [i/o] The pointer to the CHTML structure at the output
656  *                     destination is specified.
657  * @param node   [i]   The HTML tag node is specified.
658  * @return The conversion result is returned.
659  */
660 static char *
661 s_jxhtml_start_html_tag(void *pdoc, Node *UNUSED(node)) 
662 {
663   jxhtml_t       *jxhtml;
664   Doc           *doc;
665   request_rec   *r;
666
667
668   jxhtml  = GET_JXHTML(pdoc);
669   doc    = jxhtml->doc;
670   r      = doc->r;
671   DBG(r, "start s_jxhtml_start_html_tag()");
672
673   W_L("<?xml version='1.0' encoding='Shift_JIS' ?>");
674   W_NLCODE();
675   W_L("<!DOCTYPE html PUBLIC \"-//J-PHONE//DTD XHTML Basic 1.0 Plus//EN\" \"html-basic10-plus.dtd\">");
676   W_NLCODE();
677
678   /*--------------------------------------------------------------------------*/
679   /* start HTML tag                                                           */
680   /*--------------------------------------------------------------------------*/
681   W_L("<html>");
682
683   DBG(r, "end s_jxhtml_start_html_tag()");
684
685   return jxhtml->out;
686 }
687
688
689 /**
690  * It is a handler who processes the HTML tag.
691  *
692  * @param pdoc  [i/o] The pointer to the CHTML structure at the output
693  *                     destination is specified.
694  * @param node   [i]   The HTML tag node is specified.
695  * @return The conversion result is returned.
696  */
697 static char *
698 s_jxhtml_end_html_tag(void *pdoc, Node *UNUSED(child)) 
699 {
700   jxhtml_t      *jxhtml = GET_JXHTML(pdoc);
701   Doc           *doc = jxhtml->doc;
702
703   W_L("</html>");
704
705   return jxhtml->out;
706 }
707
708
709 /**
710  * It is a handler who processes the META tag.
711  *
712  * @param pdoc  [i/o] The pointer to the CHTML structure at the output
713  *                     destination is specified.
714  * @param node   [i]   The META tag node is specified.
715  * @return The conversion result is returned.
716  */
717 static char *
718 s_jxhtml_start_meta_tag(void *pdoc, Node *node) 
719 {
720   jxhtml_t     *jxhtml;
721   Doc          *doc;
722   request_rec  *r;
723   Attr         *attr;
724   int          content_type_flag;
725   int          refresh_flag;
726
727   jxhtml             = GET_JXHTML(pdoc);
728   doc               = jxhtml->doc;
729   r                 = doc->r;
730   refresh_flag      = 0;
731   content_type_flag = 0;
732
733   W_L("<meta");
734   /*--------------------------------------------------------------------------*/
735   /* Get Attributes                                                           */
736   /*--------------------------------------------------------------------------*/
737   for (attr = qs_get_attr(doc,node);
738        attr;
739        attr = qs_get_next_attr(doc,attr)) {
740     char *name   = qs_get_attr_name(doc,attr);
741     char *value  = qs_get_attr_value(doc,attr);
742     switch(*name) {
743     case 'h':
744     case 'H':
745       if (strcasecmp(name, "http-equiv") == 0 && value && *value) {
746         /*----------------------------------------------------------------------*/
747         /* CHTML 2.0                                                            */
748         /*----------------------------------------------------------------------*/
749         W_L(" http-equiv=\"");
750         W_V(value);
751         W_L("\"");
752         if (STRCASEEQ('c','C',"content-type",value)) {
753           content_type_flag = 1;
754         }
755         if (STRCASEEQ('r','R',"refresh",value)) {
756           refresh_flag = 1;
757         }
758       }
759       break;
760
761     case 'c':
762     case 'C':
763       if (strcasecmp(name, "content") == 0 && value && *value) {
764         /*----------------------------------------------------------------------*/
765         /* CHTML 2.0                                                            */
766         /*----------------------------------------------------------------------*/
767         if (content_type_flag)  {
768           W_L(" ");
769           W_V(name);
770           W_L("=\"");
771           W_V(chxj_header_inf_set_content_type(r, "application/xhtml+xml; charset=SHIFT_JIS"));
772           W_L("\"");
773         }
774         else
775         if (refresh_flag) {
776           char *buf;
777           char *sec;
778           char *url;
779   
780           buf = apr_pstrdup(r->pool, value);
781   
782           url = strchr(buf, ';');
783           if (url) {
784             sec = apr_pstrdup(r->pool, buf);
785             sec[url-buf] = 0;
786             url++;
787             url = chxj_encoding_parameter(r, url);
788             W_L(" ");
789             W_V(name);
790             W_L("=\"");
791             W_V(sec);
792             W_L(";");
793             W_V(url);
794             W_L("\"");
795           }
796         }
797         else {
798           W_L(" ");
799           W_V(name);
800           W_L("=\"");
801           W_V(value);
802           W_L("\"");
803         }
804       }
805       break;
806     
807     default:
808       break;
809     }
810   }
811   W_L(" />");
812   return jxhtml->out;
813 }
814
815
816 /**
817  * It is a handler who processes the META tag.
818  *
819  * @param pdoc  [i/o] The pointer to the CHTML structure at the output
820  *                     destination is specified.
821  * @param node   [i]   The META tag node is specified.
822  * @return The conversion result is returned.
823  */
824 static char *
825 s_jxhtml_end_meta_tag(void *pdoc, Node *UNUSED(child)) 
826 {
827   jxhtml_t *jxhtml = GET_JXHTML(pdoc);
828
829   return jxhtml->out;
830 }
831
832
833 /**
834  * It is a handler who processes the HEAD tag.
835  *
836  * @param pdoc  [i/o] The pointer to the CHTML structure at the output
837  *                     destination is specified.
838  * @param node   [i]   The HEAD tag node is specified.
839  * @return The conversion result is returned.
840  */
841 static char *
842 s_jxhtml_start_head_tag(void *pdoc, Node *UNUSED(node)) 
843 {
844   jxhtml_t       *jxhtml;
845   Doc           *doc;
846   request_rec   *r;
847
848   jxhtml = GET_JXHTML(pdoc);
849   doc   = jxhtml->doc;
850   r     = doc->r;
851
852   W_L("<head>");
853   return jxhtml->out;
854 }
855
856
857 /**
858  * It is a handler who processes the HEAD tag.
859  *
860  * @param pdoc  [i/o] The pointer to the CHTML structure at the output
861  *                     destination is specified.
862  * @param node   [i]   The HEAD tag node is specified.
863  * @return The conversion result is returned.
864  */
865 static char *
866 s_jxhtml_end_head_tag(void *pdoc, Node *UNUSED(child)) 
867 {
868   jxhtml_t       *jxhtml;
869   Doc           *doc;
870   request_rec   *r;
871
872   jxhtml = GET_JXHTML(pdoc);
873   doc   = jxhtml->doc;
874   r     = doc->r;
875
876   W_L("</head>");
877   return jxhtml->out;
878 }
879
880
881 /**
882  * It is a handler who processes the TITLE tag.
883  *
884  * @param pdoc  [i/o] The pointer to the CHTML structure at the output
885  *                     destination is specified.
886  * @param node   [i]   The TITLE tag node is specified.
887  * @return The conversion result is returned.
888  */
889 static char *
890 s_jxhtml_start_title_tag(void *pdoc, Node *UNUSED(node)) 
891 {
892   jxhtml_t      *jxhtml;
893   Doc          *doc;
894   request_rec  *r;
895
896   jxhtml = GET_JXHTML(pdoc);
897   doc   = jxhtml->doc;
898   r     = doc->r;
899
900   W_L("<title>");
901   return jxhtml->out;
902 }
903
904
905 /**
906  * It is a handler who processes the TITLE tag.
907  *
908  * @param pdoc  [i/o] The pointer to the CHTML structure at the output
909  *                     destination is specified.
910  * @param node   [i]   The TITLE tag node is specified.
911  * @return The conversion result is returned.
912  */
913 static char *
914 s_jxhtml_end_title_tag(void *pdoc, Node *UNUSED(child)) 
915 {
916   jxhtml_t       *jxhtml;
917   Doc           *doc;
918   request_rec   *r;
919
920   jxhtml = GET_JXHTML(pdoc);
921   doc   = jxhtml->doc;
922   r     = doc->r;
923
924   W_L("</title>");
925   return jxhtml->out;
926 }
927
928
929 /**
930  * It is a handler who processes the BASE tag.
931  *
932  * @param pdoc  [i/o] The pointer to the CHTML structure at the output
933  *                     destination is specified.
934  * @param node   [i]   The BASE tag node is specified.
935  * @return The conversion result is returned.
936  */
937 static char *
938 s_jxhtml_start_base_tag(void *pdoc, Node *node) 
939 {
940   jxhtml_t       *jxhtml;
941   Attr          *attr;
942   Doc           *doc;
943   request_rec   *r;
944
945   jxhtml = GET_JXHTML(pdoc);
946   doc   = jxhtml->doc;
947   r     = doc->r;
948
949   W_L("<base");
950   /*--------------------------------------------------------------------------*/
951   /* Get Attributes                                                           */
952   /*--------------------------------------------------------------------------*/
953   for (attr = qs_get_attr(doc,node);
954        attr;
955        attr = qs_get_next_attr(doc,attr)) {
956     char *name  = qs_get_attr_name(doc,attr);
957     char *value = qs_get_attr_value(doc,attr);
958     if (STRCASEEQ('h','H',"href",name)) {
959       W_L(" href=\"");
960       W_V(value);
961       W_L("\"");
962     }
963   }
964   W_L(" />");
965   return jxhtml->out;
966 }
967
968
969 /**
970  * It is a handler who processes the BASE tag.
971  *
972  * @param pdoc  [i/o] The pointer to the CHTML structure at the output
973  *                     destination is specified.
974  * @param node   [i]   The BASE tag node is specified.
975  * @return The conversion result is returned.
976  */
977 static char *
978 s_jxhtml_end_base_tag(void *pdoc, Node *UNUSED(child)) 
979 {
980   jxhtml_t *jxhtml = GET_JXHTML(pdoc);
981   return jxhtml->out;
982 }
983
984
985 /**
986  * It is a handler who processes the BODY tag.
987  *
988  * @param pdoc  [i/o] The pointer to the CHTML structure at the output
989  *                     destination is specified.
990  * @param node   [i]   The BODY tag node is specified.
991  * @return The conversion result is returned.
992  */
993 static char *
994 s_jxhtml_start_body_tag(void *pdoc, Node *node) 
995 {
996   jxhtml_t      *jxhtml;
997   Doc          *doc;
998   request_rec  *r;
999   Attr         *attr;
1000
1001   jxhtml = GET_JXHTML(pdoc);
1002   doc   = jxhtml->doc;
1003   r     = doc->r;
1004
1005   W_L("<body");
1006   /*--------------------------------------------------------------------------*/
1007   /* Get Attributes                                                           */
1008   /*--------------------------------------------------------------------------*/
1009   for (attr = qs_get_attr(doc,node);
1010        attr;
1011        attr = qs_get_next_attr(doc,attr)) {
1012     char *name   = qs_get_attr_name(doc,attr);
1013     char *value  = qs_get_attr_value(doc,attr);
1014     if (STRCASEEQ('b','B',"bgcolor",name) && value && *value) {
1015       /*----------------------------------------------------------------------*/
1016       /* CHTML 2.0                                                            */
1017       /*----------------------------------------------------------------------*/
1018       W_L(" bgcolor=\"");
1019       W_V(value);
1020       W_L("\"");
1021     }
1022     else if (STRCASEEQ('t','T',"text",name) && value && *value) {
1023       /*----------------------------------------------------------------------*/
1024       /* CHTML 2.0                                                            */
1025       /*----------------------------------------------------------------------*/
1026       W_L(" text=\"");
1027       W_V(value);
1028       W_L("\"");
1029     }
1030     else if (STRCASEEQ('l','L',"link",name) && value && *value) {
1031       /*----------------------------------------------------------------------*/
1032       /* CHTML 2.0                                                            */
1033       /*----------------------------------------------------------------------*/
1034       W_L(" link=\"");
1035       W_V(value);
1036       W_L("\"");
1037     }
1038     else if (STRCASEEQ('a','A',"alink",name)) {
1039       /*----------------------------------------------------------------------*/
1040       /* CHTML 4.0                                                            */
1041       /*----------------------------------------------------------------------*/
1042       /* ignore */
1043     }
1044     else if (STRCASEEQ('v','V',"vlink",name)) {
1045       /*----------------------------------------------------------------------*/
1046       /* CHTML 4.0                                                            */
1047       /*----------------------------------------------------------------------*/
1048       /* ignore */
1049     }
1050   }
1051   W_L("><div>");
1052   return jxhtml->out;
1053 }
1054
1055
1056 /**
1057  * It is a handler who processes the BODY tag.
1058  *
1059  * @param pdoc  [i/o] The pointer to the CHTML structure at the output
1060  *                     destination is specified.
1061  * @param node   [i]   The BODY tag node is specified.
1062  * @return The conversion result is returned.
1063  */
1064 static char *
1065 s_jxhtml_end_body_tag(void *pdoc, Node *UNUSED(child)) 
1066 {
1067   jxhtml_t       *jxhtml;
1068   Doc           *doc;
1069   request_rec   *r;
1070
1071   jxhtml = GET_JXHTML(pdoc);
1072   doc   = jxhtml->doc;
1073   r     = doc->r;
1074
1075   W_L("</div></body>");
1076   return jxhtml->out;
1077 }
1078
1079
1080 /**
1081  * It is a handler who processes the A tag.
1082  *
1083  * @param pdoc  [i/o] The pointer to the CHTML structure at the output
1084  *                     destination is specified.
1085  * @param node   [i]   The A tag node is specified.
1086  * @return The conversion result is returned.
1087  */
1088 static char *
1089 s_jxhtml_start_a_tag(void *pdoc, Node *node) 
1090 {
1091   jxhtml_t       *jxhtml;
1092   Doc           *doc;
1093   request_rec   *r;
1094   Attr          *attr;
1095
1096   jxhtml = GET_JXHTML(pdoc);
1097   doc   = jxhtml->doc;
1098   r     = doc->r;
1099
1100   W_L("<a");
1101   /*--------------------------------------------------------------------------*/
1102   /* Get Attributes                                                           */
1103   /*--------------------------------------------------------------------------*/
1104   for (attr = qs_get_attr(doc,node);
1105        attr; 
1106        attr = qs_get_next_attr(doc,attr)) {
1107     char *name  = qs_get_attr_name(doc,attr);
1108     char *value = qs_get_attr_value(doc,attr);
1109     if (STRCASEEQ('n','N',"name",name)) {
1110       /*----------------------------------------------------------------------*/
1111       /* CHTML1.0                                                             */
1112       /*----------------------------------------------------------------------*/
1113       W_L(" name=\"");
1114       W_V(chxj_jreserved_to_safe_tag(r, value, jxhtml->entryp));
1115       W_L("\"");
1116     }
1117     else if (STRCASEEQ('h','H',"href",name)) {
1118       /*----------------------------------------------------------------------*/
1119       /* CHTML1.0                                                             */
1120       /*----------------------------------------------------------------------*/
1121       value = chxj_encoding_parameter(r, value);
1122       if (! chxj_starts_with(value, "mailto:") && ! chxj_starts_with(value, "tel:")) {
1123         value = chxj_jreserved_tag_to_safe_for_query_string(r, value, jxhtml->entryp);
1124       }
1125       W_L(" href=\"");
1126       W_V(value);
1127       W_L("\"");
1128     }
1129     else if (STRCASEEQ('a','A',"accesskey",name)) {
1130       /*----------------------------------------------------------------------*/
1131       /* CHTML1.0                                                             */
1132       /*----------------------------------------------------------------------*/
1133       W_L(" accesskey=\"");
1134       W_V(value);
1135       W_L("\"");
1136     }
1137     else if (STRCASEEQ('c','C',"cti",name)) {
1138       /*----------------------------------------------------------------------*/
1139       /* CHTML 2.0                                                            */
1140       /*----------------------------------------------------------------------*/
1141       W_L(" cti=\"");
1142       W_V(value);
1143       W_L("\"");
1144     }
1145     else if (STRCASEEQ('i','I',"ijam",name)) {
1146       /*----------------------------------------------------------------------*/
1147       /* CHTML 3.0                                                            */
1148       /*----------------------------------------------------------------------*/
1149       /* ignore */
1150     }
1151     else if (STRCASEEQ('u','U',"utn",name)) {
1152       /*----------------------------------------------------------------------*/
1153       /* CHTML 3.0                                                            */
1154       /* It is special only for CHTML.                                        */
1155       /*----------------------------------------------------------------------*/
1156       W_L(" utn ");
1157     }
1158     else if (STRCASEEQ('t','T',"telbook",name)) {
1159       /*----------------------------------------------------------------------*/
1160       /* CHTML 3.0                                                            */
1161       /*----------------------------------------------------------------------*/
1162       /* not support */
1163     }
1164     else if (STRCASEEQ('k','K',"kana",name)) {
1165       /*----------------------------------------------------------------------*/
1166       /* CHTML 3.0                                                            */
1167       /*----------------------------------------------------------------------*/
1168       /* not support */
1169     }
1170     else if (STRCASEEQ('e','E',"email",name)) {
1171       /*----------------------------------------------------------------------*/
1172       /* CHTML 3.0                                                            */
1173       /*----------------------------------------------------------------------*/
1174       /* not support */
1175     }
1176     else if (STRCASEEQ('i','I',"ista",name)) {
1177       /*----------------------------------------------------------------------*/
1178       /* CHTML 4.0                                                            */
1179       /*----------------------------------------------------------------------*/
1180       /* ignore */
1181     }
1182     else if (STRCASEEQ('i','I',"ilet",name)) {
1183       /*----------------------------------------------------------------------*/
1184       /* CHTML 5.0                                                            */
1185       /*----------------------------------------------------------------------*/
1186       /* ignore */
1187     }
1188     else if (STRCASEEQ('i','I',"iswf",name)) {
1189       /*----------------------------------------------------------------------*/
1190       /* CHTML 5.0                                                            */
1191       /*----------------------------------------------------------------------*/
1192       /* ignore */
1193     }
1194     else if (STRCASEEQ('i','I',"irst",name)) {
1195       /*----------------------------------------------------------------------*/
1196       /* CHTML 5.0                                                            */
1197       /*----------------------------------------------------------------------*/
1198       /* ignore */
1199     }
1200   }
1201   W_L(">");
1202   return jxhtml->out;
1203 }
1204
1205
1206 /**
1207  * It is a handler who processes the A tag.
1208  *
1209  * @param pdoc  [i/o] The pointer to the CHTML structure at the output
1210  *                     destination is specified.
1211  * @param node   [i]   The A tag node is specified.
1212  * @return The conversion result is returned.
1213  */
1214 static char *
1215 s_jxhtml_end_a_tag(void *pdoc, Node *UNUSED(child)) 
1216 {
1217   jxhtml_t      *jxhtml;
1218   Doc          *doc;
1219   request_rec  *r;
1220
1221   jxhtml = GET_JXHTML(pdoc);
1222   doc   = jxhtml->doc;
1223   r     = doc->r;
1224
1225   W_L("</a>");
1226   return jxhtml->out;
1227 }
1228
1229
1230 /**
1231  * It is a handler who processes the BR tag.
1232  *
1233  * @param pdoc  [i/o] The pointer to the CHTML structure at the output
1234  *                     destination is specified.
1235  * @param node   [i]   The BR tag node is specified.
1236  * @return The conversion result is returned.
1237  */
1238 static char *
1239 s_jxhtml_start_br_tag(void *pdoc, Node *node)
1240 {
1241   jxhtml_t     *jxhtml;
1242   Doc          *doc;
1243   request_rec  *r;
1244   Attr         *attr;
1245
1246   jxhtml = GET_JXHTML(pdoc);
1247   doc   = jxhtml->doc;
1248   r     = doc->r;
1249
1250   W_L("<br");
1251   /*--------------------------------------------------------------------------*/
1252   /* Get Attributes                                                           */
1253   /*--------------------------------------------------------------------------*/
1254   for (attr = qs_get_attr(doc,node);
1255        attr;
1256        attr = qs_get_next_attr(doc,attr)) {
1257     char *name  = qs_get_attr_name(doc,attr);
1258     char *value = qs_get_attr_value(doc,attr);
1259     if (STRCASEEQ('c','C',"clear",name)) {
1260       if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('a','A',"all",value))) {
1261         W_L(" clear=\"");
1262         W_V(value);
1263         W_L("\"");
1264       }
1265     }
1266   }
1267   W_L(" />");
1268   return jxhtml->out;
1269 }
1270
1271
1272 /**
1273  * It is a handler who processes the BR tag.
1274  *
1275  * @param pdoc  [i/o] The pointer to the CHTML structure at the output
1276  *                     destination is specified.
1277  * @param node   [i]   The BR tag node is specified.
1278  * @return The conversion result is returned.
1279  */
1280 static char *
1281 s_jxhtml_end_br_tag(void *pdoc, Node *UNUSED(child)) 
1282 {
1283   jxhtml_t *jxhtml = GET_JXHTML(pdoc);
1284   return jxhtml->out;
1285 }
1286
1287
1288 /**
1289  * It is a handler who processes the TR tag.
1290  *
1291  * @param pdoc  [i/o] The pointer to the CHTML structure at the output
1292  *                     destination is specified.
1293  * @param node   [i]   The TR tag node is specified.
1294  * @return The conversion result is returned.
1295  */
1296 static char *
1297 s_jxhtml_start_tr_tag(void *pdoc, Node *UNUSED(node)) 
1298 {
1299   jxhtml_t      *jxhtml;
1300   Doc          *doc;
1301   request_rec  *r;
1302
1303   jxhtml = GET_JXHTML(pdoc);
1304   doc   = jxhtml->doc;
1305   r     = doc->r;
1306
1307   W_L("<br />");
1308   return jxhtml->out;
1309 }
1310
1311
1312 /**
1313  * It is a handler who processes the TR tag.
1314  *
1315  * @param pdoc  [i/o] The pointer to the CHTML structure at the output
1316  *                     destination is specified.
1317  * @param node   [i]   The TR tag node is specified.
1318  * @return The conversion result is returned.
1319  */
1320 static char *
1321 s_jxhtml_end_tr_tag(void *pdoc, Node *UNUSED(child)) 
1322 {
1323   jxhtml_t *jxhtml = GET_JXHTML(pdoc);
1324   return jxhtml->out;
1325 }
1326
1327
1328 /**
1329  * It is a handler who processes the FONT tag.
1330  *
1331  * @param pdoc  [i/o] The pointer to the CHTML structure at the output
1332  *                     destination is specified.
1333  * @param node   [i]   The FONT tag node is specified.
1334  * @return The conversion result is returned.
1335  */
1336 static char *
1337 s_jxhtml_start_font_tag(void *pdoc, Node *node) 
1338 {
1339   jxhtml_t      *jxhtml;
1340   Doc           *doc;
1341   request_rec   *r;
1342   Attr          *attr;
1343   char          *color = NULL;
1344   char          *size  = NULL;
1345
1346   jxhtml = GET_JXHTML(pdoc);
1347   doc   = jxhtml->doc;
1348   r     = doc->r;
1349
1350   /*--------------------------------------------------------------------------*/
1351   /* Get Attributes                                                           */
1352   /*--------------------------------------------------------------------------*/
1353   for (attr = qs_get_attr(doc,node);
1354        attr; 
1355        attr = qs_get_next_attr(doc,attr)) {
1356     char *name  = qs_get_attr_name(doc,attr);
1357     char *value = qs_get_attr_value(doc,attr);
1358     if (STRCASEEQ('c','C',"color",name) && value && *value) {
1359       color = apr_pstrdup(doc->buf.pool, value);
1360     }
1361     else if (STRCASEEQ('s','S',"size",name) && value && *value) {
1362       /*----------------------------------------------------------------------*/
1363       /* CHTML 5.0                                                            */
1364       /*----------------------------------------------------------------------*/
1365       size = apr_pstrdup(doc->buf.pool, value);
1366     }
1367   }
1368   if (color) {
1369     W_L("<font color=\"");
1370     W_V(color);
1371     W_L("\">");
1372     jxhtml->font_flag++;
1373   }
1374   if (size) {
1375     jxhtml->font_size_flag++;
1376     switch(*size) {
1377     case '1': W_L("<span style=\"font-size: xx-small\">"); break;
1378     case '2': W_L("<span style=\"font-size: x-small\">");  break;
1379     case '3': W_L("<span style=\"font-size: small\">");    break;
1380     case '4': W_L("<span style=\"font-size: medium\">");   break;
1381     case '5': W_L("<span style=\"font-size: large\">");    break;
1382     case '6': W_L("<span style=\"font-size: x-large\">");  break;
1383     case '7': W_L("<span style=\"font-size: xx-large\">"); break;
1384     case '-':
1385       if (*(size + 1) == '1') {
1386         W_L("<span style=\"font-size: small\">");
1387         break;
1388       }
1389       if (*(size + 1) == '2') {
1390         W_L("<span style=\"font-size: x-small\">");
1391         break;
1392       }
1393       if (*(size + 1) == '3') {
1394         W_L("<span style=\"font-size: xx-small\">");
1395         break;
1396       }
1397       jxhtml->font_size_flag--;
1398       break;
1399
1400     case '+':
1401       if (*(size + 1) == '1') {
1402         W_L("<span style=\"font-size: large\">");
1403         break;
1404       }
1405       if (*(size + 1) == '2') {
1406         W_L("<span style=\"font-size: x-large\">");
1407         break;
1408       }
1409       if (*(size + 1) == '3') {
1410         W_L("<span style=\"font-size: xx-large\">");
1411         break;
1412       }
1413       jxhtml->font_size_flag--;
1414       break;
1415
1416     default:
1417       WRN(doc->r, "invlalid font size. [%s] != (1|2|3|4|5|6|7|+1|+2|+3|-1|-2|-3)", size);
1418       jxhtml->font_size_flag--;
1419     }
1420   }
1421   return jxhtml->out;
1422 }
1423
1424
1425 /**
1426  * It is a handler who processes the FONT tag.
1427  *
1428  * @param pdoc  [i/o] The pointer to the CHTML structure at the output
1429  *                     destination is specified.
1430  * @param node   [i]   The FONT tag node is specified.
1431  * @return The conversion result is returned.
1432  */
1433 static char *
1434 s_jxhtml_end_font_tag(void *pdoc, Node *UNUSED(child)) 
1435 {
1436   jxhtml_t      *jxhtml;
1437   request_rec  *r;
1438   Doc          *doc;
1439
1440   jxhtml = GET_JXHTML(pdoc);
1441   doc   = jxhtml->doc;
1442   r     = jxhtml->doc->r;
1443
1444   if (jxhtml->font_size_flag) {
1445     W_L("</span>");  
1446     jxhtml->font_size_flag--;
1447   }
1448   if (jxhtml->font_flag) {
1449     W_L("</font>");
1450     jxhtml->font_flag--;
1451   }
1452   return jxhtml->out;
1453 }
1454
1455
1456 /**
1457  * It is a handler who processes the FORM tag.
1458  *
1459  * @param pdoc  [i/o] The pointer to the CHTML structure at the output
1460  *                     destination is specified.
1461  * @param node   [i]   The FORM tag node is specified.
1462  * @return The conversion result is returned.
1463  */
1464 static char *
1465 s_jxhtml_start_form_tag(void *pdoc, Node *node) 
1466 {
1467   jxhtml_t      *jxhtml;
1468   Doc           *doc;
1469   request_rec   *r;
1470   Attr          *attr;
1471   char          *new_hidden_tag = NULL;
1472   char          *attr_method = NULL;
1473   char          *attr_action = NULL;
1474   char          *attr_utn    = NULL;
1475
1476   jxhtml  = GET_JXHTML(pdoc);
1477   doc     = jxhtml->doc;
1478   r       = doc->r;
1479
1480   /*--------------------------------------------------------------------------*/
1481   /* Get Attributes                                                           */
1482   /*--------------------------------------------------------------------------*/
1483   for (attr = qs_get_attr(doc,node);
1484        attr;
1485        attr = qs_get_next_attr(doc,attr)) {
1486     char *name  = qs_get_attr_name(doc,attr);
1487     char *value = qs_get_attr_value(doc,attr);
1488     if (STRCASEEQ('a','A',"action", name)) {
1489       /*----------------------------------------------------------------------*/
1490       /* CHTML 1.0                                                            */
1491       /*----------------------------------------------------------------------*/
1492       attr_action = chxj_encoding_parameter(r, value);
1493       attr_action = chxj_add_cookie_parameter(r, attr_action, jxhtml->cookie);
1494     }
1495     else if (STRCASEEQ('m','M',"method", name)) {
1496       /*----------------------------------------------------------------------*/
1497       /* CHTML 1.0                                                            */
1498       /*----------------------------------------------------------------------*/
1499       attr_method = apr_pstrdup(doc->pool, value);
1500     }
1501     else if (STRCASEEQ('u','U',"utn", name)) {
1502       /*----------------------------------------------------------------------*/
1503       /* CHTML 3.0                                                            */
1504       /* It is special only for CHTML.                                        */
1505       /*----------------------------------------------------------------------*/
1506       attr_utn = value;
1507     }
1508   }
1509
1510   int post_flag = (attr_method && strcasecmp(attr_method, "post") == 0) ? 1 : 0;
1511
1512   W_L("<form");
1513   if (attr_action) {
1514     char *q;
1515     char *old_qs = NULL;
1516     q = strchr(attr_action, '?');
1517     if (q) {
1518       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);
1519       if (new_hidden_tag || old_qs) {
1520         *q = 0;
1521       }
1522     }
1523     W_L(" action=\"");
1524     W_V(attr_action);
1525     if (old_qs) {
1526       W_L("?");
1527       W_V(old_qs);
1528     }
1529     W_L("\"");
1530   }
1531   if (attr_method) {
1532     W_L(" method=\"");
1533     W_V(attr_method);
1534     W_L("\"");
1535   }
1536   if (attr_utn) {
1537     W_L(" utn");
1538   }
1539   W_L(">");
1540   if (new_hidden_tag) {
1541     W_V(new_hidden_tag);
1542   }
1543   return jxhtml->out;
1544 }
1545
1546
1547 /**
1548  * It is a handler who processes the FORM tag.
1549  *
1550  * @param pdoc  [i/o] The pointer to the CHTML structure at the output
1551  *                     destination is specified.
1552  * @param node   [i]   The FORM tag node is specified.
1553  * @return The conversion result is returned.
1554  */
1555 static char *
1556 s_jxhtml_end_form_tag(void *pdoc, Node *UNUSED(child)) 
1557 {
1558   jxhtml_t *jxhtml = GET_JXHTML(pdoc);
1559   Doc     *doc   = jxhtml->doc;
1560   W_L("</form>");
1561   return jxhtml->out;
1562 }
1563
1564
1565 /**
1566  * It is a handler who processes the INPUT tag.
1567  *
1568  * @param pdoc  [i/o] The pointer to the CHTML structure at the output
1569  *                     destination is specified.
1570  * @param node   [i]   The INPUT tag node is specified.
1571  * @return The conversion result is returned.
1572  */
1573 static char *
1574 s_jxhtml_start_input_tag(void *pdoc, Node *node) 
1575 {
1576   jxhtml_t       *jxhtml;
1577   Doc           *doc;
1578   request_rec   *r;
1579   char          *max_length;
1580   char          *type;
1581   char          *name;
1582   char          *value;
1583   char          *istyle;
1584   char          *size;
1585   char          *checked;
1586   char          *accesskey;
1587
1588   jxhtml       = GET_JXHTML(pdoc);
1589   doc         = jxhtml->doc;
1590   r           = doc->r;
1591   max_length  = NULL;
1592   type        = NULL;
1593   name        = NULL;
1594   value       = NULL;
1595   istyle      = NULL;
1596   size        = NULL;
1597   checked     = NULL;
1598   accesskey   = NULL;
1599
1600   W_L("<input");
1601   /*--------------------------------------------------------------------------*/
1602   /* Get Attributes                                                           */
1603   /*--------------------------------------------------------------------------*/
1604   type       = qs_get_type_attr(doc, node, doc->buf.pool);
1605   name       = qs_get_name_attr(doc, node, doc->buf.pool);
1606   value      = qs_get_value_attr(doc,node, doc->buf.pool);
1607   istyle     = qs_get_istyle_attr(doc,node,doc->buf.pool);
1608   max_length = qs_get_maxlength_attr(doc,node,doc->buf.pool);
1609   checked    = qs_get_checked_attr(doc,node,doc->buf.pool);
1610   accesskey  = qs_get_accesskey_attr(doc, node, doc->buf.pool);
1611   size       = qs_get_size_attr(doc, node, doc->buf.pool);
1612
1613   if (type) {
1614     if (type && (STRCASEEQ('t','T',"text",    type) ||
1615                  STRCASEEQ('p','P',"password",type) ||
1616                  STRCASEEQ('c','C',"checkbox",type) ||
1617                  STRCASEEQ('r','R',"radio",   type) ||
1618                  STRCASEEQ('h','H',"hidden",  type) ||
1619                  STRCASEEQ('s','S',"submit",  type) ||
1620                  STRCASEEQ('r','R',"reset",   type))) {
1621       W_L(" type=\"");
1622       W_V(type);
1623       W_L("\"");
1624     }
1625   }
1626   if (size && *size) {
1627     W_L(" size=\"");
1628     W_V(size);
1629     W_L("\"");
1630   }
1631   if (name && *name) {
1632     W_L(" name=\"");
1633     W_V(chxj_jreserved_to_safe_tag(r, name, jxhtml->entryp));
1634     W_L("\"");
1635   }
1636   if (value && *value) {
1637     W_L(" value=\"");
1638     W_V(chxj_add_slash_to_doublequote(doc->pool, value));
1639     W_L("\"");
1640   }
1641   if (accesskey && *accesskey) {
1642     W_L(" accesskey=\"");
1643     W_V(accesskey);
1644     W_L("\"");
1645   }
1646   if (istyle && (*istyle == '1' || *istyle == '2' || *istyle == '3' || *istyle == '4')) {
1647     /*------------------------------------------------------------------------*/
1648     /* CHTML 2.0                                                              */
1649     /*------------------------------------------------------------------------*/
1650     if (type && STRCASEEQ('p','P',"password", type) && ! jxhtml->entryp->pc_flag ) {
1651       W_L(" mode=\"");
1652       W_L("numeric");
1653       W_L("\"");
1654     }
1655     else {
1656       char *vv = s_jxhtml_istyle_to_mode(doc->buf.pool,istyle);
1657       W_L(" mode=\"");
1658       W_V(vv);
1659       W_L("\"");
1660     }
1661   }
1662   else if (type && STRCASEEQ('p','P',"password",type)) {
1663     W_L(" mode=\"");
1664     W_L("numeric");
1665     W_L("\"");
1666   }
1667   /*--------------------------------------------------------------------------*/
1668   /* The figure is default for the password.                                  */
1669   /*--------------------------------------------------------------------------*/
1670   if (max_length && *max_length) {
1671     if (chxj_chk_numeric(max_length) == 0) {
1672       W_L(" maxlength=\"");
1673       W_V(max_length);
1674       W_L("\"");
1675     }
1676   }
1677
1678   if (checked) {
1679     W_L(" checked=\"checked\"");
1680   }
1681   W_L(" />");
1682   return jxhtml->out;
1683 }
1684
1685
1686 /**
1687  * It is a handler who processes the INPUT tag.
1688  *
1689  * @param pdoc  [i/o] The pointer to the CHTML structure at the output
1690  *                     destination is specified.
1691  * @param node   [i]   The INPUT tag node is specified.
1692  * @return The conversion result is returned.
1693  */
1694 static char *
1695 s_jxhtml_end_input_tag(void *pdoc, Node *UNUSED(child)) 
1696 {
1697   jxhtml_t *jxhtml = GET_JXHTML(pdoc);
1698   return jxhtml->out;
1699 }
1700
1701
1702 /**
1703  * It is a handler who processes the CENTER tag.
1704  *
1705  * @param pdoc  [i/o] The pointer to the CHTML structure at the output
1706  *                     destination is specified.
1707  * @param node   [i]   The CENTER tag node is specified.
1708  * @return The conversion result is returned.
1709  */
1710 static char *
1711 s_jxhtml_start_center_tag(void *pdoc, Node *UNUSED(node)) 
1712 {
1713   jxhtml_t *jxhtml = GET_JXHTML(pdoc);
1714   Doc     *doc   = jxhtml->doc;
1715   W_L("<center>");
1716   return jxhtml->out;
1717 }
1718
1719
1720 /**
1721  * It is a handler who processes the CENTER tag.
1722  *
1723  * @param pdoc  [i/o] The pointer to the CHTML structure at the output
1724  *                     destination is specified.
1725  * @param node   [i]   The CENTER tag node is specified.
1726  * @return The conversion result is returned.
1727  */
1728 static char *
1729 s_jxhtml_end_center_tag(void *pdoc, Node *UNUSED(child)) 
1730 {
1731   jxhtml_t     *jxhtml;
1732   Doc         *doc;
1733   request_rec *r;
1734
1735   jxhtml = GET_JXHTML(pdoc);
1736   doc   = jxhtml->doc;
1737   r     = doc->r;
1738
1739   W_L("</center>");
1740   return jxhtml->out;
1741 }
1742
1743
1744 /**
1745  * It is a handler who processes the li tag.
1746  *
1747  * @param pdoc  [i/o] The pointer to the CHTML structure at the output
1748  *                     destination is specified.
1749  * @param node   [i]   The li tag node is specified.
1750  * @return The conversion result is returned.
1751  */
1752 static char *
1753 s_jxhtml_start_li_tag(void *pdoc, Node *node)
1754 {
1755   jxhtml_t       *jxhtml;
1756   Doc           *doc;
1757   request_rec   *r;
1758   Attr          *attr;
1759
1760   jxhtml = GET_JXHTML(pdoc);
1761   doc   = jxhtml->doc;
1762   r     = doc->r;
1763
1764   W_L("<li");
1765   /*--------------------------------------------------------------------------*/
1766   /* Get Attributes                                                           */
1767   /*--------------------------------------------------------------------------*/
1768   for (attr = qs_get_attr(doc,node);
1769        attr;
1770        attr = qs_get_next_attr(doc,attr)) {
1771     char *name = qs_get_attr_name(doc,attr);
1772     char *value = qs_get_attr_value(doc,attr);
1773     if (STRCASEEQ('t','T',"type",name)) {
1774       if (value && (*value == '1' || *value == 'a' || *value == 'A' || STRCASEEQ('d','D',"disc",value) || STRCASEEQ('c','C',"circle",value) || STRCASEEQ('s','S',"square",value))) {
1775         W_L(" type=\"");
1776         W_V(value);
1777         W_L("\"");
1778       }
1779     }
1780     else if (STRCASEEQ('v','V',"value", name) && value && *value) {
1781       W_L(" value=\"");
1782       W_V(value);
1783       W_L("\"");
1784     }
1785   }
1786   W_L(">");
1787   return jxhtml->out;
1788 }
1789
1790
1791 /**
1792  * It is a handler who processes the li tag.
1793  *
1794  * @param pdoc  [i/o] The pointer to the CHTML structure at the output
1795  *                     destination is specified.
1796  * @param node   [i]   The li tag node is specified.
1797  * @return The conversion result is returned.
1798  */
1799 static char *
1800 s_jxhtml_end_li_tag(void *pdoc, Node *UNUSED(child)) 
1801 {
1802   jxhtml_t     *jxhtml;
1803   Doc         *doc;
1804   request_rec *r;
1805
1806   jxhtml = GET_JXHTML(pdoc);
1807   doc   = jxhtml->doc;
1808   r     = doc->r;
1809
1810   W_L("</li>");
1811   return jxhtml->out;
1812 }
1813
1814
1815 /**
1816  * It is a handler who processes the OL tag.
1817  *
1818  * @param pdoc  [i/o] The pointer to the CHTML structure at the output
1819  *                     destination is specified.
1820  * @param node   [i]   The OL tag node is specified.
1821  * @return The conversion result is returned.
1822  */
1823 static char *
1824 s_jxhtml_start_ol_tag(void *pdoc, Node *node)
1825 {
1826   jxhtml_t     *jxhtml;
1827   Doc         *doc;
1828   request_rec *r;
1829   Attr        *attr;
1830
1831   jxhtml = GET_JXHTML(pdoc);
1832   doc   = jxhtml->doc;
1833   r     = doc->r;
1834
1835   W_L("<ol");
1836   /*--------------------------------------------------------------------------*/
1837   /* Get Attributes                                                           */
1838   /*--------------------------------------------------------------------------*/
1839   for (attr = qs_get_attr(doc,node);
1840        attr;
1841        attr = qs_get_next_attr(doc,attr)) {
1842     char *name = qs_get_attr_name(doc,attr);
1843     char *value = qs_get_attr_value(doc,attr);
1844     if (STRCASEEQ('t','T',"type",name) && value && (*value == '1' || *value == 'a' || *value == 'A')) {
1845       W_L(" type=\"");
1846       W_V(value);
1847       W_L("\"");
1848     }
1849     else if (STRCASEEQ('s','S',"start",name) && value && *value) {
1850       W_L(" start=\"");
1851       W_V(value);
1852       W_L("\"");
1853     }
1854   }
1855   W_L(">");
1856   return jxhtml->out;
1857 }
1858
1859
1860 /**
1861  * It is a handler who processes the OL tag.
1862  *
1863  * @param pdoc  [i/o] The pointer to the CHTML structure at the output
1864  *                     destination is specified.
1865  * @param node   [i]   The OL tag node is specified.
1866  * @return The conversion result is returned.
1867  */
1868 static char *
1869 s_jxhtml_end_ol_tag(void *pdoc, Node *UNUSED(child)) 
1870 {
1871   jxhtml_t     *jxhtml;
1872   Doc         *doc;
1873   request_rec *r;
1874
1875   jxhtml = GET_JXHTML(pdoc);
1876   doc   = jxhtml->doc;
1877   r     = doc->r;
1878
1879   W_L("</ol>");
1880   return jxhtml->out;
1881 }
1882
1883
1884 /**
1885  * It is a handler who processes the P tag.
1886  *
1887  * @param pdoc  [i/o] The pointer to the CHTML structure at the output
1888  *                     destination is specified.
1889  * @param node   [i]   The P tag node is specified.
1890  * @return The conversion result is returned.
1891  */
1892 static char *
1893 s_jxhtml_start_p_tag(void *pdoc, Node *node)
1894 {
1895   jxhtml_t     *jxhtml;
1896   Doc         *doc;
1897   request_rec *r;
1898   char        *align = NULL;
1899   Attr        *attr;
1900
1901   jxhtml = GET_JXHTML(pdoc);
1902   doc   = jxhtml->doc;
1903   r     = doc->r;
1904
1905   W_L("<p");
1906   for (attr = qs_get_attr(doc,node);
1907        attr;
1908        attr = qs_get_next_attr(doc,attr)) {
1909     char *nm  = qs_get_attr_name(doc,attr);
1910     char *val = qs_get_attr_value(doc,attr);
1911     if (STRCASEEQ('a','A',"align", nm)) {
1912       /*----------------------------------------------------------------------*/
1913       /* CHTML 1.0 (W3C version 3.2)                                          */
1914       /*----------------------------------------------------------------------*/
1915       if (val && (STRCASEEQ('l','L',"left",val) || STRCASEEQ('r','R',"right",val) || STRCASEEQ('c','C',"center",val))) {
1916         align = apr_pstrdup(doc->buf.pool, val);
1917         break;
1918       }
1919     }
1920   }
1921   if (align) {
1922     W_L(" align=\"");
1923     W_V(align);
1924     W_L("\"");
1925   }
1926   W_L(">");
1927   return jxhtml->out;
1928 }
1929
1930
1931 /**
1932  * It is a handler who processes the P tag.
1933  *
1934  * @param pdoc  [i/o] The pointer to the CHTML structure at the output
1935  *                     destination is specified.
1936  * @param node   [i]   The P tag node is specified.
1937  * @return The conversion result is returned.
1938  */
1939 static char *
1940 s_jxhtml_end_p_tag(void *pdoc, Node *UNUSED(child)) 
1941 {
1942   jxhtml_t   *jxhtml = GET_JXHTML(pdoc);
1943   Doc       *doc   = jxhtml->doc;
1944
1945   W_L("</p>");
1946   return jxhtml->out;
1947 }
1948
1949
1950 /**
1951  * It is a handler who processes the PRE tag.
1952  *
1953  * @param pdoc  [i/o] The pointer to the CHTML structure at the output
1954  *                     destination is specified.
1955  * @param node   [i]   The PRE tag node is specified.
1956  * @return The conversion result is returned.
1957  */
1958 static char *
1959 s_jxhtml_start_pre_tag(void *pdoc, Node *UNUSED(node)) 
1960 {
1961   jxhtml_t  *jxhtml = GET_JXHTML(pdoc);
1962   Doc      *doc   = jxhtml->doc;
1963
1964   jxhtml->pre_flag++;
1965   W_L("<pre>");
1966   return jxhtml->out;
1967 }
1968
1969
1970 /**
1971  * It is a handler who processes the PRE tag.
1972  *
1973  * @param pdoc  [i/o] The pointer to the CHTML structure at the output
1974  *                     destination is specified.
1975  * @param node   [i]   The PRE tag node is specified.
1976  * @return The conversion result is returned.
1977  */
1978 static char *
1979 s_jxhtml_end_pre_tag(void *pdoc, Node *UNUSED(child)) 
1980 {
1981   jxhtml_t *jxhtml = GET_JXHTML(pdoc);
1982   Doc     *doc   = jxhtml->doc;
1983
1984   W_L("</pre>");
1985   jxhtml->pre_flag--;
1986
1987   return jxhtml->out;
1988 }
1989
1990
1991 /**
1992  * It is a handler who processes the UL tag.
1993  *
1994  * @param pdoc  [i/o] The pointer to the CHTML structure at the output
1995  *                     destination is specified.
1996  * @param node   [i]   The UL tag node is specified.
1997  * @return The conversion result is returned.
1998  */
1999 static char *
2000 s_jxhtml_start_ul_tag(void *pdoc, Node *node)
2001 {
2002   jxhtml_t *jxhtml = GET_JXHTML(pdoc);
2003   Doc      *doc    = jxhtml->doc;
2004   Attr     *attr;
2005   W_L("<ul");
2006   /*--------------------------------------------------------------------------*/
2007   /* Get Attributes                                                           */
2008   /*--------------------------------------------------------------------------*/
2009   for (attr = qs_get_attr(doc,node);
2010        attr;
2011        attr = qs_get_next_attr(doc,attr)) {
2012     char *name   = qs_get_attr_name(doc,attr);
2013     char *value  = qs_get_attr_value(doc,attr);
2014     if (STRCASEEQ('t','T',"type",name)) {
2015       if (value && (STRCASEEQ('d','D',"disc",value) || STRCASEEQ('c','C',"circle",value) || STRCASEEQ('s','S',"square",value))) {
2016         W_L(" type=\"");
2017         W_V(value);
2018         W_L("\"");
2019       }
2020     }
2021   }
2022   W_L(">");
2023   return jxhtml->out;
2024 }
2025
2026
2027 /**
2028  * It is a handler who processes the UL tag.
2029  *
2030  * @param pdoc  [i/o] The pointer to the CHTML structure at the output
2031  *                     destination is specified.
2032  * @param node   [i]   The UL tag node is specified.
2033  * @return The conversion result is returned.
2034  */
2035 static char *
2036 s_jxhtml_end_ul_tag(void *pdoc, Node *UNUSED(child)) 
2037 {
2038   jxhtml_t *jxhtml = GET_JXHTML(pdoc);
2039   Doc     *doc   = jxhtml->doc;
2040
2041   W_L("</ul>");
2042   return jxhtml->out;
2043 }
2044
2045
2046 /**
2047  * It is a handler who processes the HR tag.
2048  *
2049  * @param pdoc  [i/o] The pointer to the CHTML structure at the output
2050  *                     destination is specified.
2051  * @param node   [i]   The HR tag node is specified.
2052  * @return The conversion result is returned.
2053  */
2054 static char *
2055 s_jxhtml_start_hr_tag(void *pdoc, Node *node) 
2056 {
2057   jxhtml_t *jxhtml = GET_JXHTML(pdoc);
2058   Doc     *doc   = jxhtml->doc;
2059   Attr    *attr;
2060
2061   W_L("<hr");
2062   for (attr = qs_get_attr(doc,node);
2063        attr; 
2064        attr = qs_get_next_attr(doc,attr)) {
2065     char *name = qs_get_attr_name(doc,attr);
2066     char *value = qs_get_attr_value(doc,attr);
2067     if (STRCASEEQ('a','A',"align",name)) {
2068       /*----------------------------------------------------------------------*/
2069       /* CHTML 1.0                                                            */
2070       /*----------------------------------------------------------------------*/
2071       if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
2072         W_L(" align=\"");
2073         W_V(value);
2074         W_L("\"");
2075       }
2076     }
2077     else if (STRCASEEQ('s','S',"size",name) && value && *value) {
2078       /*----------------------------------------------------------------------*/
2079       /* CHTML 1.0                                                            */
2080       /*----------------------------------------------------------------------*/
2081       W_L(" size=\"");
2082       W_V(value);
2083       W_L("\"");
2084     }
2085     else if (STRCASEEQ('w','W',"width",name) && value && *value) {
2086       /*----------------------------------------------------------------------*/
2087       /* CHTML 1.0                                                            */
2088       /*----------------------------------------------------------------------*/
2089       W_L(" width=\"");
2090       W_V(value);
2091       W_L("\"");
2092     }
2093     else if (STRCASEEQ('n','N',"noshade",name)) {
2094       /*----------------------------------------------------------------------*/
2095       /* CHTML 1.0                                                            */
2096       /*----------------------------------------------------------------------*/
2097       W_L(" noshade");
2098     }
2099     else if (STRCASEEQ('c','C',"color",name) && value && *value) {
2100       /*----------------------------------------------------------------------*/
2101       /* CHTML 4.0                                                            */
2102       /*----------------------------------------------------------------------*/
2103       W_L(" color=\"");
2104       W_V(value);
2105       W_L("\"");
2106     }
2107   }
2108   W_L(" />");
2109   return jxhtml->out;
2110 }
2111
2112
2113 /**
2114  * It is a handler who processes the HR tag.
2115  *
2116  * @param jxhtml  [i/o] The pointer to the CHTML structure at the output
2117  *                     destination is specified.
2118  * @param node   [i]   The HR tag node is specified.
2119  * @return The conversion result is returned.
2120  */
2121 static char *
2122 s_jxhtml_end_hr_tag(void *pdoc, Node *UNUSED(child)) 
2123 {
2124   jxhtml_t *jxhtml = GET_JXHTML(pdoc);
2125   return jxhtml->out;
2126 }
2127
2128
2129 /**
2130  * It is a handler who processes the IMG tag.
2131  *
2132  * @param pdoc  [i/o] The pointer to the CHTML structure at the output
2133  *                     destination is specified.
2134  * @param node   [i]   The IMG tag node is specified.
2135  * @return The conversion result is returned.
2136  */
2137 static char *
2138 s_jxhtml_start_img_tag(void *pdoc, Node *node) 
2139 {
2140   jxhtml_t       *jxhtml = GET_JXHTML(pdoc);
2141   Doc           *doc   = jxhtml->doc;
2142   request_rec   *r     = doc->r;
2143   Attr          *attr;
2144 #ifndef IMG_NOT_CONVERT_FILENAME
2145   device_table  *spec = jxhtml->spec;
2146 #endif
2147   int           has_alt = 0;
2148
2149   W_L("<img");
2150   /*--------------------------------------------------------------------------*/
2151   /* Get Attributes                                                           */
2152   /*--------------------------------------------------------------------------*/
2153   for (attr = qs_get_attr(doc,node);
2154        attr;
2155        attr = qs_get_next_attr(doc,attr)) {
2156     char *name  = qs_get_attr_name(doc,attr);
2157     char *value = qs_get_attr_value(doc,attr);
2158     if (STRCASEEQ('s','S',"src",name)) {
2159       /*----------------------------------------------------------------------*/
2160       /* CHTML 1.0                                                            */
2161       /*----------------------------------------------------------------------*/
2162 #ifdef IMG_NOT_CONVERT_FILENAME
2163       value = chxj_encoding_parameter(r, value);
2164       value = chxj_jreserved_tag_to_safe_for_query_string(r, value, jxhtml->entryp);
2165       value = chxj_add_cookie_no_update_parameter(r, value);
2166       W_L(" src=\"");
2167       W_V(value);
2168       W_L("\"");
2169 #else
2170       value = chxj_img_conv(r, spec, value);
2171       value = chxj_encoding_parameter(r, value);
2172       value = chxj_jreserved_tag_to_safe_for_query_string(r, value, jxhtml->entryp);
2173       value = chxj_add_cookie_no_update_parameter(r, value);
2174       W_L(" src=\"");
2175       W_V(value);
2176       W_L("\"");
2177 #endif
2178     }
2179     else if (STRCASEEQ('a','A',"align",name)) {
2180       /*----------------------------------------------------------------------*/
2181       /* CHTML 1.0                                                            */
2182       /*----------------------------------------------------------------------*/
2183       if (value) {
2184         if (STRCASEEQ('t','T',"top",   value) ||
2185             STRCASEEQ('m','M',"middle",value) ||
2186             STRCASEEQ('b','B',"bottom",value) ||
2187             STRCASEEQ('l','L',"left",  value) ||
2188             STRCASEEQ('r','R',"right", value)) {
2189           W_L(" align=\"");
2190           W_V(value);
2191           W_L("\"");
2192         }
2193         else if (STRCASEEQ('c','C',"center",value)) {
2194           W_L(" align=\"");
2195           W_L("middle"); 
2196           W_L("\"");
2197         }
2198       }
2199     }
2200     else if (STRCASEEQ('w','W',"width",name) && value && *value) {
2201       /*----------------------------------------------------------------------*/
2202       /* CHTML 1.0                                                            */
2203       /*----------------------------------------------------------------------*/
2204       W_L(" width=\"");
2205       W_V(value);
2206       W_L("\"");
2207     }
2208     else if (STRCASEEQ('h','H',"height",name) && value && *value) {
2209       /*----------------------------------------------------------------------*/
2210       /* CHTML 1.0                                                            */
2211       /*----------------------------------------------------------------------*/
2212       W_L(" height=\"");
2213       W_V(value);
2214       W_L("\"");
2215     }
2216     else if (STRCASEEQ('h','H',"hspace",name)) {
2217       /*----------------------------------------------------------------------*/
2218       /* CHTML 1.0                                                            */
2219       /*----------------------------------------------------------------------*/
2220       /* ignore */
2221     }
2222     else if (STRCASEEQ('v','V',"vspace",name)) {
2223       /*----------------------------------------------------------------------*/
2224       /* CHTML 1.0                                                            */
2225       /*----------------------------------------------------------------------*/
2226       /* ignore */
2227     }
2228     else if (STRCASEEQ('a','A',"alt",name) && value && *value) {
2229       /*----------------------------------------------------------------------*/
2230       /* CHTML 1.0                                                            */
2231       /*----------------------------------------------------------------------*/
2232       W_L(" alt=\"");
2233       W_V(value);
2234       W_L("\"");
2235       has_alt = 1;
2236     }
2237   }
2238   if (! has_alt) {
2239     W_L(" alt=\"\"");
2240   }
2241   W_L(" />");
2242   return jxhtml->out;
2243 }
2244
2245
2246 /**
2247  * It is a handler who processes the IMG tag.
2248  *
2249  * @param pdoc  [i/o] The pointer to the CHTML structure at the output
2250  *                     destination is specified.
2251  * @param node   [i]   The IMG tag node is specified.
2252  * @return The conversion result is returned.
2253  */
2254 static char *
2255 s_jxhtml_end_img_tag(void *pdoc, Node *UNUSED(child)) 
2256 {
2257   jxhtml_t *jxhtml = GET_JXHTML(pdoc);
2258   return jxhtml->out;
2259 }
2260
2261
2262 /**
2263  * It is a handler who processes the SELECT tag.
2264  *
2265  * @param pdoc  [i/o] The pointer to the CHTML structure at the output
2266  *                     destination is specified.
2267  * @param node   [i]   The SELECT tag node is specified.
2268  * @return The conversion result is returned.
2269  */
2270 static char *
2271 s_jxhtml_start_select_tag(void *pdoc, Node *child)
2272 {
2273   jxhtml_t *jxhtml    = GET_JXHTML(pdoc);
2274   Doc     *doc      = jxhtml->doc;
2275   Attr    *attr;
2276   char    *size     = NULL;
2277   char    *name     = NULL;
2278   char    *multiple = NULL;
2279
2280   W_L("<select");
2281   for (attr = qs_get_attr(doc,child);
2282        attr;
2283        attr = qs_get_next_attr(doc,attr)) {
2284     char *nm  = qs_get_attr_name(doc,attr);
2285     char *val = qs_get_attr_value(doc,attr);
2286     if (STRCASEEQ('s','S',"size",nm)) {
2287       /*----------------------------------------------------------------------*/
2288       /* CHTML 1.0 version 2.0                                                */
2289       /*----------------------------------------------------------------------*/
2290       size = apr_pstrdup(doc->buf.pool, val);
2291     }
2292     else if (STRCASEEQ('n','N',"name",nm)) {
2293       /*----------------------------------------------------------------------*/
2294       /* CHTML 1.0 version 2.0                                                */
2295       /*----------------------------------------------------------------------*/
2296       name = apr_pstrdup(doc->buf.pool, val);
2297     }
2298     else if (STRCASEEQ('m','M',"multiple", nm)) {
2299       /*----------------------------------------------------------------------*/
2300       /* CHTML 1.0 version 2.0                                                */
2301       /*----------------------------------------------------------------------*/
2302       multiple = apr_pstrdup(doc->buf.pool, val);
2303     }
2304   }
2305   if (size && *size) {
2306     W_L(" size=\"");
2307     W_V(size);
2308     W_L("\"");
2309   }
2310   if (name && *name) {
2311     W_L(" name=\"");
2312     W_V(name);
2313     W_L("\"");
2314   }
2315   if (multiple) {
2316     W_L(" multiple");
2317   }
2318   W_L(">");
2319   return jxhtml->out;
2320 }
2321
2322
2323 /**
2324  * It is a handler who processes the SELECT tag.
2325  *
2326  * @param pdoc  [i/o] The pointer to the CHTML structure at the output
2327  *                     destination is specified.
2328  * @param node   [i]   The SELECT tag node is specified.
2329  * @return The conversion result is returned.
2330  */
2331 static char *
2332 s_jxhtml_end_select_tag(void *pdoc, Node *UNUSED(child))
2333 {
2334   jxhtml_t *jxhtml = GET_JXHTML(pdoc);
2335   Doc     *doc   = jxhtml->doc;
2336
2337   W_L("</select>");
2338   return jxhtml->out;
2339 }
2340
2341 /**
2342  * It is a handler who processes the OPTION tag.
2343  *
2344  * @param pdoc  [i/o] The pointer to the CHTML structure at the output
2345  *                     destination is specified.
2346  * @param node   [i]   The OPTION tag node is specified.
2347  * @return The conversion result is returned.
2348  */
2349 static char *
2350 s_jxhtml_start_option_tag(void *pdoc, Node *child)
2351 {
2352   jxhtml_t *jxhtml = GET_JXHTML(pdoc);
2353   Doc     *doc   = jxhtml->doc;
2354   Attr    *attr;
2355
2356   char *selected   = NULL;
2357   char *value      = NULL;
2358
2359   W_L("<option");
2360   for (attr = qs_get_attr(doc,child);
2361        attr;
2362        attr = qs_get_next_attr(doc,attr)) {
2363     char *nm  = qs_get_attr_name(doc,attr);
2364     char *val = qs_get_attr_value(doc,attr);
2365     if (STRCASEEQ('s','S',"selected",nm)) {
2366       /*----------------------------------------------------------------------*/
2367       /* CHTML 1.0 version 2.0                                                */
2368       /*----------------------------------------------------------------------*/
2369       selected = apr_pstrdup(doc->buf.pool, val);
2370     }
2371     else if (STRCASEEQ('v','V',"value",nm)) {
2372       /*----------------------------------------------------------------------*/
2373       /* CHTML 1.0 version 2.0                                                */
2374       /*----------------------------------------------------------------------*/
2375       value = apr_pstrdup(doc->buf.pool, val);
2376     }
2377   }
2378   if (value) {
2379     W_L(" value=\"");
2380     W_V(value);
2381     W_L("\"");
2382   }
2383   if (selected) {
2384     W_L(" selected");
2385   }
2386   W_L(">");
2387   return jxhtml->out;
2388 }
2389
2390
2391 /**
2392  * It is a handler who processes the OPTION tag.
2393  *
2394  * @param pdoc  [i/o] The pointer to the CHTML structure at the output
2395  *                     destination is specified.
2396  * @param node   [i]   The OPTION tag node is specified.
2397  * @return The conversion result is returned.
2398  */
2399 static char *
2400 s_jxhtml_end_option_tag(void *pdoc, Node *UNUSED(child))
2401 {
2402   jxhtml_t *jxhtml = GET_JXHTML(pdoc);
2403   Doc      *doc = jxhtml->doc;
2404   W_L("</option>");
2405   return jxhtml->out;
2406 }
2407
2408
2409 /**
2410  * It is a handler who processes the DIV tag.
2411  *
2412  * @param pdoc  [i/o] The pointer to the CHTML structure at the output
2413  *                     destination is specified.
2414  * @param node   [i]   The DIV tag node is specified.
2415  * @return The conversion result is returned.
2416  */
2417 static char *
2418 s_jxhtml_start_div_tag(void *pdoc, Node *child)
2419 {
2420   jxhtml_t     *jxhtml;
2421   Doc          *doc;
2422   request_rec  *r;
2423   Attr         *attr;
2424   char         *align = NULL;
2425
2426   jxhtml = GET_JXHTML(pdoc);
2427   doc   = jxhtml->doc;
2428   r     = doc->r;
2429
2430   W_L("<div");
2431   for (attr = qs_get_attr(doc,child);
2432        attr;
2433        attr = qs_get_next_attr(doc,attr)) {
2434     char *nm  = qs_get_attr_name(doc,attr);
2435     char *val = qs_get_attr_value(doc,attr);
2436     if (STRCASEEQ('a','A',"align",nm)) {
2437       /*----------------------------------------------------------------------*/
2438       /* CHTML 1.0 (W3C version 3.2)                                          */
2439       /*----------------------------------------------------------------------*/
2440       if (val && (STRCASEEQ('l','L',"left",val) || STRCASEEQ('r','R',"right",val) || STRCASEEQ('c','C',"center",val))) {
2441         align = apr_pstrdup(doc->buf.pool, val);
2442       }
2443     }
2444   }
2445   if (align) {
2446     W_L(" align=\"");
2447     W_V(align);
2448     W_L("\"");
2449   }
2450   W_L(">");
2451   return jxhtml->out;
2452 }
2453
2454
2455 /**
2456  * It is a handler who processes the DIV tag.
2457  *
2458  * @param pdoc  [i/o] The pointer to the CHTML structure at the output
2459  *                     destination is specified.
2460  * @param node   [i]   The DIV tag node is specified.
2461  * @return The conversion result is returned.
2462  */
2463 static char *
2464 s_jxhtml_end_div_tag(void *pdoc, Node *UNUSED(child))
2465 {
2466   jxhtml_t      *jxhtml;
2467   Doc          *doc;
2468   request_rec  *r;
2469
2470   jxhtml = GET_JXHTML(pdoc);
2471   doc   = jxhtml->doc;
2472   r     = doc->r;
2473
2474   W_L("</div>");
2475   return jxhtml->out;
2476 }
2477
2478
2479 static char *
2480 s_jxhtml_istyle_to_mode(apr_pool_t *p, const char *s)
2481 {
2482   char *tmp;
2483
2484   if (s) {
2485     switch (s[0]) {
2486     case '1': return apr_psprintf(p, "hiragana");
2487     case '2': return apr_psprintf(p, "hankakukana");
2488     case '3': return apr_psprintf(p, "alphabet");
2489     case '4': return apr_psprintf(p, "numeric");
2490     default: 
2491       tmp = apr_palloc(p, 1);
2492       tmp[0] = '\0';
2493       return apr_pstrdup(p, tmp);
2494     }
2495   }
2496
2497   tmp = apr_palloc(p, 1);
2498   tmp[0] = '\0';
2499   return apr_pstrdup(p,tmp);
2500 }
2501
2502
2503 static char *
2504 s_jxhtml_chxjif_tag(void *pdoc, Node *node)
2505 {
2506   jxhtml_t *jxhtml;
2507   Doc     *doc;
2508   Node    *child;
2509   request_rec *r;
2510
2511   jxhtml = GET_JXHTML(pdoc);
2512   doc   = jxhtml->doc;
2513   r     = doc->r;
2514
2515   for (child = qs_get_child_node(doc, node);
2516        child;
2517        child = qs_get_next_node(doc, child)) {
2518     W_V(child->otext);
2519     s_jxhtml_chxjif_tag(jxhtml, child);
2520   }
2521   return NULL;
2522 }
2523
2524
2525 /**
2526  * It is a handler who processes the TEXTARE tag.
2527  *
2528  * @param pdoc  [i/o] The pointer to the CHTML structure at the output
2529  *                     destination is specified.
2530  * @param node   [i]   The TEXTAREA tag node is specified.
2531  * @return The conversion result is returned.
2532  */
2533 static char *
2534 s_jxhtml_start_textarea_tag(void *pdoc, Node *node) 
2535 {
2536   jxhtml_t       *jxhtml;
2537   Doc           *doc;
2538   request_rec   *r;
2539   Attr          *attr;
2540
2541   jxhtml = GET_JXHTML(pdoc);
2542   doc   = jxhtml->doc;
2543   r     = doc->r;
2544
2545   jxhtml->textarea_flag++;
2546   W_L("<textarea");
2547   for (attr = qs_get_attr(doc,node);
2548        attr;
2549        attr = qs_get_next_attr(doc,attr)) {
2550     char *name  = qs_get_attr_name(doc,attr);
2551     char *value = qs_get_attr_value(doc,attr);
2552     if (STRCASEEQ('a','A',"accesskey",name) && value && *value != 0) {
2553       W_L(" accesskey=\"");
2554       W_V(value);
2555       W_L("\"");
2556     }
2557     else if (STRCASEEQ('i','I',"istyle", name) && value && (*value == '1' || *value == '2' || *value == '3' || *value == '4')) {
2558       char *vv = s_jxhtml_istyle_to_mode(doc->buf.pool,value);
2559       W_L(" mode=\"");
2560       W_V(vv);
2561       W_L("\"");
2562     }
2563     else if (STRCASEEQ('n','N',"name", name) && value && *value) {
2564       W_L(" name=\"");
2565       W_V(value);
2566       W_L("\"");
2567     }
2568     else if (STRCASEEQ('r','R',"rows", name) && value && *value) {
2569       W_L(" rows=\"");
2570       W_V(value);
2571       W_L("\"");
2572     }
2573     else if (STRCASEEQ('c','C',"cols", name) && value && *value) {
2574       W_L(" cols=\"");
2575       W_V(value);
2576       W_L("\"");
2577     }
2578   }
2579   W_L(">");
2580   return jxhtml->out;
2581 }
2582
2583
2584 /**
2585  * It is a handler who processes the TEXTAREA tag.
2586  *
2587  * @param pdoc  [i/o] The pointer to the CHTML structure at the output
2588  *                     destination is specified.
2589  * @param node   [i]   The TEXTAREA tag node is specified.
2590  * @return The conversion result is returned.
2591  */
2592 static char *
2593 s_jxhtml_end_textarea_tag(void *pdoc, Node *UNUSED(child)) 
2594 {
2595   jxhtml_t       *jxhtml;
2596   Doc           *doc;
2597   request_rec   *r;
2598
2599   jxhtml = GET_JXHTML(pdoc);
2600   doc   = jxhtml->doc;
2601   r     = doc->r;
2602
2603   W_L("</textarea>");
2604   jxhtml->textarea_flag--;
2605
2606   return jxhtml->out;
2607 }
2608
2609
2610 /**
2611  * It is a handler who processes the B tag.
2612  *
2613  * @param pdoc  [i/o] The pointer to the CHTML structure at the output
2614  *                     destination is specified.
2615  * @param node   [i]   The B tag node is specified.
2616  * @return The conversion result is returned.
2617  */
2618 static char*
2619 s_jxhtml_start_b_tag(void* pdoc, Node* UNUSED(node)) 
2620 {
2621   jxhtml_t*      jxhtml;
2622   Doc*          doc;
2623   request_rec*  r;
2624
2625   jxhtml = GET_JXHTML(pdoc);
2626   doc   = jxhtml->doc;
2627   r     = doc->r;
2628
2629   W_L("<b>");
2630   return jxhtml->out;
2631 }
2632
2633
2634 /**
2635  * It is a handler who processes the B tag.
2636  *
2637  * @param pdoc  [i/o] The pointer to the CHTML structure at the output
2638  *                     destination is specified.
2639  * @param node   [i]   The B tag node is specified.
2640  * @return The conversion result is returned.
2641  */
2642 static char*
2643 s_jxhtml_end_b_tag(void* pdoc, Node* UNUSED(child)) 
2644 {
2645   jxhtml_t*      jxhtml = GET_JXHTML(pdoc);
2646   Doc*          doc   = jxhtml->doc;
2647
2648   W_L("</b>");
2649   return jxhtml->out;
2650 }
2651
2652 static char*
2653 s_jxhtml_text_tag(void* pdoc, Node* child)
2654 {
2655   jxhtml_t*     jxhtml;
2656   Doc*         doc;
2657   char*        textval;
2658   char*        tmp;
2659   char*        tdst;
2660   char         one_byte[2];
2661   int          ii;
2662   int          tdst_len;
2663   request_rec* r;
2664
2665   jxhtml = GET_JXHTML(pdoc);
2666   doc   = jxhtml->doc;
2667   r     = doc->r;
2668
2669   textval = qs_get_node_value(doc,child);
2670   if (strlen(textval) == 0) {
2671     return jxhtml->out;
2672   }
2673
2674   tmp = apr_palloc(r->pool, qs_get_node_size(doc,child)+1);
2675   memset(tmp, 0, qs_get_node_size(doc,child)+1);
2676
2677   tdst     = qs_alloc_zero_byte_string(doc->buf.pool);
2678   memset(one_byte, 0, sizeof(one_byte));
2679   tdst_len = 0;
2680
2681   for (ii=0; ii<qs_get_node_size(doc,child); ii++) {
2682     char* out;
2683     int rtn = s_jxhtml_search_emoji(jxhtml, &textval[ii], &out);
2684     if (rtn) {
2685       tdst = qs_out_apr_pstrcat(r, tdst, out, &tdst_len);
2686       ii+=(rtn - 1);
2687       continue;
2688     }
2689
2690     if (is_sjis_kanji(textval[ii])) {
2691       one_byte[0] = textval[ii+0];
2692       tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
2693       one_byte[0] = textval[ii+1];
2694       tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
2695       ii++;
2696     }
2697     else 
2698     if (jxhtml->pre_flag) {
2699       one_byte[0] = textval[ii+0];
2700       tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
2701     }
2702     else
2703     if (jxhtml->textarea_flag) {
2704       one_byte[0] = textval[ii+0];
2705       tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
2706     }
2707     else {
2708       if (textval[ii] != '\r' && textval[ii] != '\n') {
2709         one_byte[0] = textval[ii+0];
2710         tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
2711       }
2712     }
2713   }
2714   W_V(tdst);
2715   return jxhtml->out;
2716 }
2717
2718
2719 /**
2720  * It is a handler who processes the BLOCKQUOTE tag.
2721  *
2722  * @param pdoc  [i/o] The pointer to the JXHTML structure at the output
2723  *                     destination is specified.
2724  * @param node   [i]   The BLOCKQUOTE tag node is specified.
2725  * @return The conversion result is returned.
2726  */
2727 static char *
2728 s_jxhtml_start_blockquote_tag(void *pdoc, Node *UNUSED(child))
2729 {
2730   jxhtml_t *jxhtml = GET_JXHTML(pdoc);
2731   Doc     *doc   = jxhtml->doc;
2732   W_L("<blockquote>");
2733   return jxhtml->out;
2734 }
2735
2736
2737 /**
2738  * It is a handler who processes the BLOCKQUOTE tag.
2739  *
2740  * @param pdoc  [i/o] The pointer to the JXHTML structure at the output
2741  *                     destination is specified.
2742  * @param node   [i]   The BLOCKQUOTE tag node is specified.
2743  * @return The conversion result is returned.
2744  */
2745 static char *
2746 s_jxhtml_end_blockquote_tag(void *pdoc, Node *UNUSED(child))
2747 {
2748   jxhtml_t *jxhtml = GET_JXHTML(pdoc);
2749   Doc     *doc   = jxhtml->doc;
2750   W_L("</blockquote>");
2751   return jxhtml->out;
2752 }
2753
2754
2755 /**
2756  * It is a handler who processes the DIR tag.
2757  *
2758  * @param pdoc  [i/o] The pointer to the JXHTML structure at the output
2759  *                     destination is specified.
2760  * @param node   [i]   The DIR tag node is specified.
2761  * @return The conversion result is returned.
2762  */
2763 static char *
2764 s_jxhtml_start_dir_tag(void *pdoc, Node *node)
2765 {
2766   jxhtml_t *jxhtml = GET_JXHTML(pdoc);
2767   Doc      *doc = jxhtml->doc;
2768   Attr     *attr;
2769   W_L("<dir");
2770   for (attr = qs_get_attr(doc,node);
2771        attr;
2772        attr = qs_get_next_attr(doc,attr)) {
2773     char *name   = qs_get_attr_name(doc,attr);
2774     char *value  = qs_get_attr_value(doc,attr);
2775     if (STRCASEEQ('t','T',"type",name)) {
2776       if (value && (STRCASEEQ('d','D',"disc",value) || STRCASEEQ('c','C',"circle",value) || STRCASEEQ('s','S',"square",value))) {
2777         W_L(" type=\"");
2778         W_V(value);
2779         W_L("\"");
2780       }
2781     }
2782   }
2783   W_L(">");
2784   return jxhtml->out;
2785 }
2786
2787
2788 /**
2789  * It is a handler who processes the DIR tag.
2790  *
2791  * @param pdoc  [i/o] The pointer to the JXHTML structure at the output
2792  *                     destination is specified.
2793  * @param node   [i]   The DIR tag node is specified.
2794  * @return The conversion result is returned.
2795  */
2796 static char *
2797 s_jxhtml_end_dir_tag(void *pdoc, Node *UNUSED(child))
2798 {
2799   jxhtml_t *jxhtml = GET_JXHTML(pdoc);
2800   Doc *doc = jxhtml->doc;
2801   W_L("</dir>");
2802   return jxhtml->out;
2803 }
2804
2805
2806 /**
2807  * It is a handler who processes the DL tag.
2808  *
2809  * @param pdoc  [i/o] The pointer to the JXHTML structure at the output
2810  *                     destination is specified.
2811  * @param node   [i]   The DL tag node is specified.
2812  * @return The conversion result is returned.
2813  */
2814 static char *
2815 s_jxhtml_start_dl_tag(void *pdoc, Node *UNUSED(child))
2816 {
2817   jxhtml_t *jxhtml = GET_JXHTML(pdoc);
2818   Doc *doc = jxhtml->doc;
2819   W_L("<dl>");
2820   return jxhtml->out;
2821 }
2822
2823
2824 /**
2825  * It is a handler who processes the DL tag.
2826  *
2827  * @param pdoc  [i/o] The pointer to the JXHTML structure at the output
2828  *                     destination is specified.
2829  * @param node   [i]   The DL tag node is specified.
2830  * @return The conversion result is returned.
2831  */
2832 static char *
2833 s_jxhtml_end_dl_tag(void *pdoc, Node *UNUSED(child))
2834 {
2835   jxhtml_t *jxhtml = GET_JXHTML(pdoc);
2836   Doc *doc = jxhtml->doc;
2837   W_L("</dl>");
2838   return jxhtml->out;
2839 }
2840
2841
2842 /**
2843  * It is a handler who processes the DT tag.
2844  *
2845  * @param pdoc  [i/o] The pointer to the JXHTML structure at the output
2846  *                     destination is specified.
2847  * @param node   [i]   The DT tag node is specified.
2848  * @return The conversion result is returned.
2849  */
2850 static char *
2851 s_jxhtml_start_dt_tag(void *pdoc, Node *UNUSED(child))
2852 {
2853   jxhtml_t *jxhtml = GET_JXHTML(pdoc);
2854   Doc     *doc   = jxhtml->doc;
2855   W_L("<dt>");
2856   return jxhtml->out;
2857 }
2858
2859
2860 /**
2861  * It is a handler who processes the DT tag.
2862  *
2863  * @param pdoc  [i/o] The pointer to the JXHTML structure at the output
2864  *                     destination is specified.
2865  * @param node   [i]   The DT tag node is specified.
2866  * @return The conversion result is returned.
2867  */
2868 static char *
2869 s_jxhtml_end_dt_tag(void *pdoc, Node *UNUSED(child))
2870 {
2871   jxhtml_t *jxhtml = GET_JXHTML(pdoc);
2872   return jxhtml->out;
2873 }
2874
2875
2876 /**
2877  * It is a handler who processes the DD tag.
2878  *
2879  * @param pdoc  [i/o] The pointer to the JXHTML structure at the output
2880  *                     destination is specified.
2881  * @param node   [i]   The DD tag node is specified.
2882  * @return The conversion result is returned.
2883  */
2884 static char *
2885 s_jxhtml_start_dd_tag(void *pdoc, Node *UNUSED(child))
2886 {
2887   jxhtml_t *jxhtml = GET_JXHTML(pdoc);
2888   Doc *doc = jxhtml->doc;
2889   W_L("<dd>");
2890   return jxhtml->out;
2891 }
2892
2893
2894 /**
2895  * It is a handler who processes the DD tag.
2896  *
2897  * @param pdoc  [i/o] The pointer to the JXHTML structure at the output
2898  *                     destination is specified.
2899  * @param node   [i]   The DD tag node is specified.
2900  * @return The conversion result is returned.
2901  */
2902 static char *
2903 s_jxhtml_end_dd_tag(void *pdoc, Node *UNUSED(child))
2904 {
2905   jxhtml_t *jxhtml = GET_JXHTML(pdoc);
2906   return jxhtml->out;
2907 }
2908
2909
2910 /**
2911  * It is a handler who processes the H1 tag.
2912  *
2913  * @param pdoc  [i/o] The pointer to the JXHTML structure at the output
2914  *                     destination is specified.
2915  * @param node   [i]   The H1 tag node is specified.
2916  * @return The conversion result is returned.
2917  */
2918 static char *
2919 s_jxhtml_start_h1_tag(void *pdoc, Node *node)
2920 {
2921   jxhtml_t       *jxhtml;
2922   Doc           *doc;
2923   request_rec   *r;
2924   Attr          *attr;
2925   char          *align = NULL;
2926
2927   jxhtml   = GET_JXHTML(pdoc);
2928   doc     = jxhtml->doc;
2929   r       = doc->r;
2930
2931   for (attr = qs_get_attr(doc,node);
2932        attr;
2933        attr = qs_get_next_attr(doc,attr)) {
2934     char *name  = qs_get_attr_name(doc,attr);
2935     char *value = qs_get_attr_value(doc,attr);
2936     if (STRCASEEQ('a','A',"align", name)) {
2937       if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
2938         jxhtml->h1_align_flag++;
2939         align = apr_pstrdup(doc->buf.pool, value);
2940         break;
2941       }
2942     }
2943   }
2944   if (align) {
2945     W_L("<div align=\"");
2946     W_V(align);
2947     W_L("\">");
2948   }
2949   return jxhtml->out;
2950 }
2951
2952
2953 /**
2954  * It is a handler who processes the H1 tag.
2955  *
2956  * @param pdoc  [i/o] The pointer to the JXHTML structure at the output
2957  *                     destination is specified.
2958  * @param node   [i]   The H1 tag node is specified.
2959  * @return The conversion result is returned.
2960  */
2961 static char *
2962 s_jxhtml_end_h1_tag(void *pdoc, Node *UNUSED(child)) 
2963 {
2964   jxhtml_t*    jxhtml;
2965   Doc*          doc;
2966   request_rec*  r;
2967
2968   jxhtml = GET_JXHTML(pdoc);
2969   doc     = jxhtml->doc;
2970   r       = doc->r;
2971   
2972   if (jxhtml->h1_align_flag) {
2973     jxhtml->h1_align_flag--;
2974     W_L("</div>");
2975   }
2976   return jxhtml->out;
2977 }
2978
2979
2980 /**
2981  * It is a handler who processes the H2 tag.
2982  *
2983  * @param pdoc  [i/o] The pointer to the JXHTML structure at the output
2984  *                     destination is specified.
2985  * @param node   [i]   The H1 tag node is specified.
2986  * @return The conversion result is returned.
2987  */
2988 static char *
2989 s_jxhtml_start_h2_tag(void *pdoc, Node *node)
2990 {
2991   jxhtml_t       *jxhtml;
2992   Doc           *doc;
2993   request_rec   *r;
2994   Attr          *attr;
2995   char          *align = NULL;
2996
2997   jxhtml   = GET_JXHTML(pdoc);
2998   doc     = jxhtml->doc;
2999   r       = doc->r;
3000
3001   for (attr = qs_get_attr(doc,node);
3002        attr;
3003        attr = qs_get_next_attr(doc,attr)) {
3004     char *name  = qs_get_attr_name(doc,attr);
3005     char *value = qs_get_attr_value(doc,attr);
3006     if (STRCASEEQ('a','A',"align", name)) {
3007       if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
3008         jxhtml->h2_align_flag++;
3009         align = apr_pstrdup(doc->buf.pool, value);
3010         break;
3011       }
3012     }
3013   }
3014   if (align) {
3015     W_L("<div align=\"");
3016     W_V(align);
3017     W_L("\">");
3018   }
3019   return jxhtml->out;
3020 }
3021
3022
3023 /**
3024  * It is a handler who processes the H2 tag.
3025  *
3026  * @param pdoc  [i/o] The pointer to the JXHTML structure at the output
3027  *                     destination is specified.
3028  * @param node   [i]   The H1 tag node is specified.
3029  * @return The conversion result is returned.
3030  */
3031 static char *
3032 s_jxhtml_end_h2_tag(void *pdoc, Node *UNUSED(child)) 
3033 {
3034   jxhtml_t*    jxhtml;
3035   Doc*          doc;
3036   request_rec*  r;
3037
3038   jxhtml = GET_JXHTML(pdoc);
3039   doc     = jxhtml->doc;
3040   r       = doc->r;
3041   
3042   if (jxhtml->h2_align_flag) {
3043     jxhtml->h2_align_flag--;
3044     W_L("</div>");
3045   }
3046   return jxhtml->out;
3047 }
3048
3049
3050 /**
3051  * It is a handler who processes the H3 tag.
3052  *
3053  * @param pdoc  [i/o] The pointer to the JXHTML structure at the output
3054  *                     destination is specified.
3055  * @param node   [i]   The H1 tag node is specified.
3056  * @return The conversion result is returned.
3057  */
3058 static char *
3059 s_jxhtml_start_h3_tag(void *pdoc, Node *node)
3060 {
3061   jxhtml_t       *jxhtml;
3062   Doc           *doc;
3063   request_rec   *r;
3064   Attr          *attr;
3065   char          *align = NULL;
3066
3067   jxhtml   = GET_JXHTML(pdoc);
3068   doc     = jxhtml->doc;
3069   r       = doc->r;
3070
3071   for (attr = qs_get_attr(doc,node);
3072        attr;
3073        attr = qs_get_next_attr(doc,attr)) {
3074     char* name;
3075     char* value;
3076     name  = qs_get_attr_name(doc,attr);
3077     value = qs_get_attr_value(doc,attr);
3078     if (STRCASEEQ('a','A',"align", name)) {
3079       if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
3080         jxhtml->h3_align_flag++;
3081         align = apr_pstrdup(doc->buf.pool, value);
3082         break;
3083       }
3084     }
3085   }
3086   if (align) {
3087     W_L("<div align=\"");
3088     W_V(align);
3089     W_L("\">");
3090   }
3091   return jxhtml->out;
3092 }
3093
3094
3095 /**
3096  * It is a handler who processes the H3 tag.
3097  *
3098  * @param pdoc  [i/o] The pointer to the JXHTML structure at the output
3099  *                     destination is specified.
3100  * @param node   [i]   The H1 tag node is specified.
3101  * @return The conversion result is returned.
3102  */
3103 static char *
3104 s_jxhtml_end_h3_tag(void *pdoc, Node *UNUSED(child)) 
3105 {
3106   jxhtml_t*    jxhtml;
3107   Doc*          doc;
3108   request_rec*  r;
3109
3110   jxhtml = GET_JXHTML(pdoc);
3111   doc     = jxhtml->doc;
3112   r       = doc->r;
3113   
3114   if (jxhtml->h3_align_flag) {
3115     jxhtml->h3_align_flag--;
3116     W_L("</div>");
3117   }
3118   return jxhtml->out;
3119 }
3120
3121
3122 /**
3123  * It is a handler who processes the H4 tag.
3124  *
3125  * @param pdoc  [i/o] The pointer to the JXHTML structure at the output
3126  *                     destination is specified.
3127  * @param node   [i]   The H1 tag node is specified.
3128  * @return The conversion result is returned.
3129  */
3130 static char *
3131 s_jxhtml_start_h4_tag(void *pdoc, Node *node)
3132 {
3133   jxhtml_t       *jxhtml;
3134   Doc           *doc;
3135   request_rec   *r;
3136   Attr          *attr;
3137   char          *align = NULL;
3138
3139   jxhtml   = GET_JXHTML(pdoc);
3140   doc     = jxhtml->doc;
3141   r       = doc->r;
3142
3143   for (attr = qs_get_attr(doc,node);
3144        attr;
3145        attr = qs_get_next_attr(doc,attr)) {
3146     char *name  = qs_get_attr_name(doc,attr);
3147     char *value = qs_get_attr_value(doc,attr);
3148     if (STRCASEEQ('a','A',"align", name)) {
3149       if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
3150         jxhtml->h4_align_flag++;
3151         align = apr_pstrdup(doc->buf.pool, value);
3152         break;
3153       }
3154     }
3155   }
3156   if (align) {
3157     W_L("<div align=\"");
3158     W_V(align);
3159     W_L("\">");
3160   }
3161   return jxhtml->out;
3162 }
3163
3164
3165 /**
3166  * It is a handler who processes the H4 tag.
3167  *
3168  * @param pdoc  [i/o] The pointer to the JXHTML structure at the output
3169  *                     destination is specified.
3170  * @param node   [i]   The H1 tag node is specified.
3171  * @return The conversion result is returned.
3172  */
3173 static char *
3174 s_jxhtml_end_h4_tag(void *pdoc, Node *UNUSED(child)) 
3175 {
3176   jxhtml_t      *jxhtml;
3177   Doc           *doc;
3178   request_rec   *r;
3179
3180   jxhtml = GET_JXHTML(pdoc);
3181   doc     = jxhtml->doc;
3182   r       = doc->r;
3183   
3184   if (jxhtml->h4_align_flag) {
3185     jxhtml->h4_align_flag--;
3186     W_L("</div>");
3187   }
3188   return jxhtml->out;
3189 }
3190
3191
3192 /**
3193  * It is a handler who processes the H5 tag.
3194  *
3195  * @param pdoc  [i/o] The pointer to the JXHTML structure at the output
3196  *                     destination is specified.
3197  * @param node   [i]   The H1 tag node is specified.
3198  * @return The conversion result is returned.
3199  */
3200 static char *
3201 s_jxhtml_start_h5_tag(void *pdoc, Node *node)
3202 {
3203   jxhtml_t      *jxhtml;
3204   Doc           *doc;
3205   request_rec   *r;
3206   Attr          *attr;
3207   char          *align = NULL;
3208
3209   jxhtml   = GET_JXHTML(pdoc);
3210   doc     = jxhtml->doc;
3211   r       = doc->r;
3212
3213   for (attr = qs_get_attr(doc,node);
3214        attr;
3215        attr = qs_get_next_attr(doc,attr)) {
3216     char *name  = qs_get_attr_name(doc,attr);
3217     char *value = qs_get_attr_value(doc,attr);
3218     if (STRCASEEQ('a','A',"align", name)) {
3219       if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
3220         jxhtml->h5_align_flag++;
3221         align = apr_pstrdup(doc->buf.pool, value);
3222         break;
3223       }
3224     }
3225   }
3226   if (align) {
3227     W_L("<div align=\"");
3228     W_V(align);
3229     W_L("\">");
3230   }
3231   return jxhtml->out;
3232 }
3233
3234
3235 /**
3236  * It is a handler who processes the H5 tag.
3237  *
3238  * @param pdoc  [i/o] The pointer to the JXHTML structure at the output
3239  *                     destination is specified.
3240  * @param node   [i]   The H1 tag node is specified.
3241  * @return The conversion result is returned.
3242  */
3243 static char *
3244 s_jxhtml_end_h5_tag(void *pdoc, Node *UNUSED(child)) 
3245 {
3246   jxhtml_t    *jxhtml;
3247   Doc         *doc;
3248   request_rec *r;
3249
3250   jxhtml = GET_JXHTML(pdoc);
3251   doc     = jxhtml->doc;
3252   r       = doc->r;
3253   
3254   if (jxhtml->h5_align_flag) {
3255     jxhtml->h5_align_flag--;
3256     W_L("</div>");
3257   }
3258   return jxhtml->out;
3259 }
3260
3261
3262 /**
3263  * It is a handler who processes the H6 tag.
3264  *
3265  * @param pdoc  [i/o] The pointer to the JXHTML structure at the output
3266  *                     destination is specified.
3267  * @param node   [i]   The H1 tag node is specified.
3268  * @return The conversion result is returned.
3269  */
3270 static char *
3271 s_jxhtml_start_h6_tag(void *pdoc, Node *node)
3272 {
3273   jxhtml_t      *jxhtml;
3274   Doc           *doc;
3275   request_rec   *r;
3276   Attr          *attr;
3277   char          *align = NULL;
3278
3279   jxhtml   = GET_JXHTML(pdoc);
3280   doc     = jxhtml->doc;
3281   r       = doc->r;
3282
3283   for (attr = qs_get_attr(doc,node);
3284        attr;
3285        attr = qs_get_next_attr(doc,attr)) {
3286     char *name  = qs_get_attr_name(doc,attr);
3287     char *value = qs_get_attr_value(doc,attr);
3288     if (STRCASEEQ('a','A',"align", name)) {
3289       if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
3290         jxhtml->h6_align_flag++;
3291         align = apr_pstrdup(doc->buf.pool, value);
3292         break;
3293       }
3294     }
3295   }
3296   if (align) {
3297     W_L("<div align=\"");
3298     W_V(align);
3299     W_L("\">");
3300   }
3301   return jxhtml->out;
3302 }
3303
3304
3305 /**
3306  * It is a handler who processes the H6 tag.
3307  *
3308  * @param pdoc  [i/o] The pointer to the JXHTML structure at the output
3309  *                     destination is specified.
3310  * @param node   [i]   The H1 tag node is specified.
3311  * @return The conversion result is returned.
3312  */
3313 static char *
3314 s_jxhtml_end_h6_tag(void *pdoc, Node *UNUSED(child)) 
3315 {
3316   jxhtml_t    *jxhtml;
3317   Doc         *doc;
3318   request_rec *r;
3319
3320   jxhtml = GET_JXHTML(pdoc);
3321   doc     = jxhtml->doc;
3322   r       = doc->r;
3323   
3324   if (jxhtml->h6_align_flag) {
3325     jxhtml->h6_align_flag--;
3326     W_L("</div>");
3327   }
3328   return jxhtml->out;
3329 }
3330
3331
3332 /**
3333  * It is a handler who processes the MENU tag.
3334  *
3335  * @param pdoc  [i/o] The pointer to the JXHTML structure at the output
3336  *                     destination is specified.
3337  * @param node   [i]   The MENU tag node is specified.
3338  * @return The conversion result is returned.
3339  */
3340 static char *
3341 s_jxhtml_start_menu_tag(void *pdoc, Node *node)
3342 {
3343   jxhtml_t *jxhtml = GET_JXHTML(pdoc);
3344   Doc      *doc = jxhtml->doc;
3345   Attr     *attr;
3346   W_L("<menu");
3347   /*--------------------------------------------------------------------------*/
3348   /* Get Attributes                                                           */
3349   /*--------------------------------------------------------------------------*/
3350   for (attr = qs_get_attr(doc,node);
3351        attr;
3352        attr = qs_get_next_attr(doc,attr)) {
3353     char *name   = qs_get_attr_name(doc,attr);
3354     char *value  = qs_get_attr_value(doc,attr);
3355     if (STRCASEEQ('t','T',"type",name)) {
3356       if (value && (STRCASEEQ('d','D',"disc",value) || STRCASEEQ('c','C',"circle",value) || STRCASEEQ('s','S',"square",value))) {
3357         W_L(" type=\"");
3358         W_V(value);
3359         W_L("\"");
3360       }
3361     }
3362   }
3363   W_L(">");
3364   return jxhtml->out;
3365 }
3366
3367
3368 /**
3369  * It is a handler who processes the MENU tag.
3370  *
3371  * @param pdoc  [i/o] The pointer to the JXHTML structure at the output
3372  *                     destination is specified.
3373  * @param node   [i]   The MENU tag node is specified.
3374  * @return The conversion result is returned.
3375  */
3376 static char *
3377 s_jxhtml_end_menu_tag(void *pdoc, Node *UNUSED(child))
3378 {
3379   jxhtml_t *jxhtml = GET_JXHTML(pdoc);
3380   Doc     *doc = jxhtml->doc;
3381   W_L("</menu>");
3382   return jxhtml->out;
3383 }
3384
3385
3386 /**
3387  * It is a handler who processes the PLAINTEXT tag.
3388  *
3389  * @param pdoc  [i/o] The pointer to the JXHTML structure at the output
3390  *                     destination is specified.
3391  * @param node   [i]   The PLAINTEXT tag node is specified.
3392  * @return The conversion result is returned.
3393  */
3394 static char *
3395 s_jxhtml_start_plaintext_tag(void *pdoc, Node *node)
3396 {
3397   jxhtml_t *jxhtml;
3398   Doc *doc;
3399
3400   jxhtml = GET_JXHTML(pdoc);
3401   doc     = jxhtml->doc;
3402   W_L("<plaintext>");
3403   s_jxhtml_start_plaintext_tag_inner(pdoc,node);
3404   return jxhtml->out;
3405 }
3406
3407 static char *
3408 s_jxhtml_start_plaintext_tag_inner(void *pdoc, Node *node)
3409 {
3410   jxhtml_t *jxhtml;
3411   Doc *doc;
3412   Node *child;
3413   jxhtml = GET_JXHTML(pdoc);
3414   doc     = jxhtml->doc;
3415   for (child = qs_get_child_node(doc, node);
3416        child;
3417        child = qs_get_next_node(doc, child)) {
3418     W_V(child->otext);
3419     s_jxhtml_start_plaintext_tag_inner(pdoc, child);
3420   }
3421   return jxhtml->out;
3422 }
3423
3424
3425 /**
3426  * It is a handler who processes the PLAINTEXT tag.
3427  *
3428  * @param pdoc  [i/o] The pointer to the JXHTML structure at the output
3429  *                     destination is specified.
3430  * @param node   [i]   The PLAINTEXT tag node is specified.
3431  * @return The conversion result is returned.
3432  */
3433 static char *
3434 s_jxhtml_end_plaintext_tag(void *pdoc, Node *UNUSED(child))
3435 {
3436   jxhtml_t *jxhtml = GET_JXHTML(pdoc);
3437   return jxhtml->out;
3438 }
3439
3440
3441 /**
3442  * It is a handler who processes the BLINK tag.
3443  *
3444  * @param pdoc  [i/o] The pointer to the JXHTML structure at the output
3445  *                     destination is specified.
3446  * @param node   [i]   The BLINK tag node is specified.
3447  * @return The conversion result is returned.
3448  */
3449 static char *
3450 s_jxhtml_start_blink_tag(void *pdoc, Node *UNUSED(child))
3451 {
3452   jxhtml_t *jxhtml = GET_JXHTML(pdoc);
3453   Doc     *doc = jxhtml->doc;
3454   W_L("<blink>");
3455   return jxhtml->out;
3456 }
3457
3458
3459 /**
3460  * It is a handler who processes the BLINK tag.
3461  *
3462  * @param pdoc  [i/o] The pointer to the JXHTML structure at the output
3463  *                     destination is specified.
3464  * @param node   [i]   The BLINK tag node is specified.
3465  * @return The conversion result is returned.
3466  */
3467 static char *
3468 s_jxhtml_end_blink_tag(void *pdoc, Node *UNUSED(child))
3469 {
3470   jxhtml_t *jxhtml = GET_JXHTML(pdoc);
3471   Doc     *doc = jxhtml->doc;
3472   W_L("</blink>");
3473   return jxhtml->out;
3474 }
3475
3476
3477 /**
3478  * It is a handler who processes the MARQUEE tag.
3479  *
3480  * @param pdoc  [i/o] The pointer to the JXHTML structure at the output
3481  *                     destination is specified.
3482  * @param node   [i]   The MARQUEE tag node is specified.
3483  * @return The conversion result is returned.
3484  */
3485 static char *
3486 s_jxhtml_start_marquee_tag(void *pdoc, Node *node)
3487 {
3488   jxhtml_t *jxhtml = GET_JXHTML(pdoc);
3489   Doc *doc = jxhtml->doc;
3490   Attr *attr;
3491   W_L("<marquee");
3492   /*--------------------------------------------------------------------------*/
3493   /* Get Attributes                                                           */
3494   /*--------------------------------------------------------------------------*/
3495   for (attr = qs_get_attr(doc,node);
3496        attr;
3497        attr = qs_get_next_attr(doc,attr)) {
3498     char *name   = qs_get_attr_name(doc,attr);
3499     char *value  = qs_get_attr_value(doc,attr);
3500     if (STRCASEEQ('d','D',"direction", name)) {
3501       if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value))) {
3502         W_L(" direction=\"");
3503         W_V(value);
3504         W_L("\"");
3505       }
3506     }
3507     else if (STRCASEEQ('b','B',"behavior",name)) {
3508       /* ignore */
3509     }
3510     else if (STRCASEEQ('l','L',"loop",name)) {
3511       /* ignore */
3512     }
3513     else if (STRCASEEQ('b','B',"bgcolor",name) && value && *value) {
3514       W_L(" bgcolor=\"");
3515       W_V(value);
3516       W_L("\"");
3517     }
3518   }
3519   W_L(">");
3520   return jxhtml->out;
3521 }
3522
3523
3524 /**
3525  * It is a handler who processes the MARQUEE tag.
3526  *
3527  * @param pdoc  [i/o] The pointer to the JXHTML structure at the output
3528  *                     destination is specified.
3529  * @param node   [i]   The MARQUEE tag node is specified.
3530  * @return The conversion result is returned.
3531  */
3532 static char *
3533 s_jxhtml_end_marquee_tag(void *pdoc, Node *UNUSED(child))
3534 {
3535   jxhtml_t *jxhtml = GET_JXHTML(pdoc);
3536   Doc *doc = jxhtml->doc;
3537   W_L("</marquee>");
3538   return jxhtml->out;
3539 }
3540
3541
3542 /**
3543  * It is handler who processes the New Line Code.
3544  */
3545 static char *
3546 s_jxhtml_newline_mark(void *pdoc, Node *UNUSED(node))
3547 {
3548   jxhtml_t *jxhtml = GET_JXHTML(pdoc);
3549   Doc *doc = jxhtml->doc;
3550   W_NLCODE();
3551   return jxhtml->out;
3552 }
3553 /*
3554  * vim:ts=2 et
3555  */