OSDN Git Service

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