OSDN Git Service

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