OSDN Git Service

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