OSDN Git Service

* Added <marquee> tag for CHTML2.0 converter.
[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;
631
632   chtml10 = GET_CHTML10(pdoc);
633
634   /* ignore */
635
636   return chtml10->out;
637 }
638
639
640 /**
641  * It is a handler who processes the META tag.
642  *
643  * @param pdoc  [i/o] The pointer to the CHTML structure at the output
644  *                     destination is specified.
645  * @param node   [i]   The META tag node is specified.
646  * @return The conversion result is returned.
647  */
648 static char*
649 s_chtml10_end_meta_tag(void* pdoc, Node* UNUSED(child)) 
650 {
651   chtml10_t* chtml10;
652
653   chtml10 = GET_CHTML10(pdoc);
654
655   return chtml10->out;
656 }
657
658
659 /**
660  * It is a handler who processes the HEAD tag.
661  *
662  * @param pdoc  [i/o] The pointer to the CHTML structure at the output
663  *                     destination is specified.
664  * @param node   [i]   The HEAD tag node is specified.
665  * @return The conversion result is returned.
666  */
667 static char*
668 s_chtml10_start_head_tag(void* pdoc, Node* UNUSED(node)) 
669 {
670   Doc*          doc;
671   request_rec*  r;
672   chtml10_t*    chtml10;
673
674   chtml10 = GET_CHTML10(pdoc);
675   doc     = chtml10->doc;
676   r       = doc->r;
677
678   W10_L("<head>");
679
680   return chtml10->out;
681 }
682
683
684 /**
685  * It is a handler who processes the HEAD tag.
686  *
687  * @param pdoc  [i/o] The pointer to the CHTML structure at the output
688  *                     destination is specified.
689  * @param node   [i]   The HEAD tag node is specified.
690  * @return The conversion result is returned.
691  */
692 static char*
693 s_chtml10_end_head_tag(void* pdoc, Node* UNUSED(child)) 
694 {
695   Doc*          doc;
696   request_rec*  r;
697   chtml10_t*    chtml10;
698
699   chtml10 = GET_CHTML10(pdoc);
700   doc     = chtml10->doc;
701   r       = doc->r;
702
703   W10_L("</head>");
704
705   return chtml10->out;
706 }
707
708
709 /**
710  * It is a handler who processes the OL tag.
711  *
712  * @param pdoc  [i/o] The pointer to the CHTML structure at the output
713  *                     destination is specified.
714  * @param node   [i]   The OL tag node is specified.
715  * @return The conversion result is returned.
716  */
717 static char*
718 s_chtml10_start_ol_tag(void* pdoc, Node* UNUSED(node)) 
719 {
720   Doc*          doc;
721   request_rec*  r;
722   chtml10_t*    chtml10;
723
724   chtml10 = GET_CHTML10(pdoc);
725   doc     = chtml10->doc;
726   r       = doc->r;
727
728   W10_L("<ol>");
729
730   return chtml10->out;
731 }
732
733
734 /**
735  * It is a handler who processes the OL tag.
736  *
737  * @param pdoc  [i/o] The pointer to the CHTML structure at the output
738  *                     destination is specified.
739  * @param node   [i]   The OL tag node is specified.
740  * @return The conversion result is returned.
741  */
742 static char*
743 s_chtml10_end_ol_tag(void* pdoc, Node* UNUSED(child)) 
744 {
745   Doc*          doc;
746   request_rec*  r;
747   chtml10_t*    chtml10;
748
749   chtml10 = GET_CHTML10(pdoc);
750   doc     = chtml10->doc;
751   r       = doc->r;
752
753   W10_L("</ol>");
754
755   return chtml10->out;
756 }
757
758
759 /**
760  * It is a handler who processes the UL tag.
761  *
762  * @param pdoc  [i/o] The pointer to the CHTML structure at the output
763  *                     destination is specified.
764  * @param node   [i]   The UL tag node is specified.
765  * @return The conversion result is returned.
766  */
767 static char*
768 s_chtml10_start_ul_tag(void* pdoc, Node* UNUSED(node)) 
769 {
770   Doc*          doc;
771   request_rec*  r;
772   chtml10_t*    chtml10;
773
774   chtml10    = GET_CHTML10(pdoc);
775   doc        = chtml10->doc;
776   r          = doc->r;
777
778   W10_L("<ul>");
779
780   return chtml10->out;
781 }
782
783
784 /**
785  * It is a handler who processes the UL tag.
786  *
787  * @param pdoc  [i/o] The pointer to the CHTML structure at the output
788  *                     destination is specified.
789  * @param node   [i]   The UL tag node is specified.
790  * @return The conversion result is returned.
791  */
792 static char*
793 s_chtml10_end_ul_tag(void* pdoc, Node* UNUSED(child)) 
794 {
795   Doc*          doc;
796   request_rec*  r;
797   chtml10_t*    chtml10;
798
799   chtml10 = GET_CHTML10(pdoc);
800   doc     = chtml10->doc;
801   r       = doc->r;
802
803   W10_L("</ul>");
804
805   return chtml10->out;
806 }
807
808
809 /**
810  * It is a handler who processes the LI tag.
811  *
812  * @param pdoc  [i/o] The pointer to the CHTML structure at the output
813  *                     destination is specified.
814  * @param node   [i]   The LI tag node is specified.
815  * @return The conversion result is returned.
816  */
817 static char*
818 s_chtml10_start_li_tag(void* pdoc, Node* UNUSED(node)) 
819 {
820   Doc*          doc;
821   request_rec*  r;
822   chtml10_t*    chtml10;
823
824   chtml10 = GET_CHTML10(pdoc);
825   doc     = chtml10->doc;
826   r       = doc->r;
827
828   W10_L("<li>");
829
830   return chtml10->out;
831 }
832
833
834 /**
835  * It is a handler who processes the LI tag.
836  *
837  * @param pdoc  [i/o] The pointer to the CHTML structure at the output
838  *                     destination is specified.
839  * @param node   [i]   The LI tag node is specified.
840  * @return The conversion result is returned.
841  */
842 static char*
843 s_chtml10_end_li_tag(void* pdoc, Node* UNUSED(child)) 
844 {
845   chtml10_t*    chtml10;
846   chtml10 = GET_CHTML10(pdoc);
847   return chtml10->out;
848 }
849
850
851 /**
852  * It is a handler who processes the H1 tag.
853  *
854  * @param pdoc  [i/o] The pointer to the CHTML structure at the output
855  *                     destination is specified.
856  * @param node   [i]   The H1 tag node is specified.
857  * @return The conversion result is returned.
858  */
859 static char*
860 s_chtml10_start_h1_tag(void* pdoc, Node* node) 
861 {
862   Doc*          doc;
863   request_rec*  r;
864   Attr*         attr;
865   chtml10_t*    chtml10;
866
867   chtml10 = GET_CHTML10(pdoc);
868   doc     = chtml10->doc;
869   r       = doc->r;
870
871   W10_L("<h1");
872   for (attr = qs_get_attr(doc,node);
873        attr;
874        attr = qs_get_next_attr(doc,attr)) {
875     char* name;
876     char* value;
877     name  = qs_get_attr_name(doc,attr);
878     value = qs_get_attr_value(doc,attr);
879     if (STRCASEEQ('a','A',"align", name)) {
880       if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
881         W10_L(" align=\"");
882         W10_V(value);
883         W10_L("\"");
884         break;
885       }
886     }
887   }
888   W10_L(">");
889
890   return chtml10->out;
891 }
892
893
894 /**
895  * It is a handler who processes the H1 tag.
896  *
897  * @param pdoc  [i/o] The pointer to the CHTML structure at the output
898  *                     destination is specified.
899  * @param node   [i]   The H1 tag node is specified.
900  * @return The conversion result is returned.
901  */
902 static char*
903 s_chtml10_end_h1_tag(void* pdoc, Node* UNUSED(child)) 
904 {
905   Doc*          doc;
906   request_rec*  r;
907   chtml10_t*    chtml10;
908
909   chtml10 = GET_CHTML10(pdoc);
910   doc     = chtml10->doc;
911   r       = doc->r;
912
913   W10_L("</h1>");
914
915   return chtml10->out;
916 }
917
918
919 /**
920  * It is a handler who processes the H2 tag.
921  *
922  * @param pdoc  [i/o] The pointer to the CHTML structure at the output
923  *                     destination is specified.
924  * @param node   [i]   The H2 tag node is specified.
925  * @return The conversion result is returned.
926  */
927 static char*
928 s_chtml10_start_h2_tag(void *pdoc, Node *node) 
929 {
930   Doc           *doc;
931   Attr          *attr;
932   request_rec   *r;
933   chtml10_t     *chtml10;
934
935   chtml10 = GET_CHTML10(pdoc);
936   doc     = chtml10->doc;
937   r       = doc->r;
938
939   W10_L("<h2");
940   for (attr = qs_get_attr(doc,node);
941        attr;
942        attr = qs_get_next_attr(doc,attr)) {
943     char* name;
944     char* value;
945     name  = qs_get_attr_name(doc,attr);
946     value = qs_get_attr_value(doc,attr);
947     if (STRCASEEQ('a','A',"align", name)) {
948       if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
949         W10_L(" align=\"");
950         W10_V(value);
951         W10_L("\"");
952         break;
953       }
954     }
955   }
956   W10_L(">");
957
958   return chtml10->out;
959 }
960
961
962 /**
963  * It is a handler who processes the H2 tag.
964  *
965  * @param pdoc  [i/o] The pointer to the CHTML structure at the output
966  *                     destination is specified.
967  * @param node   [i]   The H2 tag node is specified.
968  * @return The conversion result is returned.
969  */
970 static char*
971 s_chtml10_end_h2_tag(void* pdoc, Node* UNUSED(child)) 
972 {
973   Doc*          doc;
974   request_rec*  r;
975   chtml10_t*    chtml10;
976
977   chtml10 = GET_CHTML10(pdoc);
978   doc     = chtml10->doc;
979   r       = doc->r;
980
981   W10_L("</h2>");
982
983   return chtml10->out;
984 }
985
986
987 /**
988  * It is a handler who processes the H3 tag.
989  *
990  * @param pdoc  [i/o] The pointer to the CHTML structure at the output
991  *                     destination is specified.
992  * @param node   [i]   The H3 tag node is specified.
993  * @return The conversion result is returned.
994  */
995 static char *
996 s_chtml10_start_h3_tag(void *pdoc, Node *node) 
997 {
998   Doc           *doc;
999   Attr          *attr;
1000   request_rec   *r;
1001   chtml10_t     *chtml10;
1002
1003   chtml10 = GET_CHTML10(pdoc);
1004   doc     = chtml10->doc;
1005   r       = doc->r;
1006
1007   W10_L("<h3");
1008   for (attr = qs_get_attr(doc,node);
1009        attr;
1010        attr = qs_get_next_attr(doc,attr)) {
1011     char* name;
1012     char* value;
1013     name  = qs_get_attr_name(doc,attr);
1014     value = qs_get_attr_value(doc,attr);
1015     if (STRCASEEQ('a','A',"align", name)) {
1016       if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
1017         W10_L(" align=\"");
1018         W10_V(value);
1019         W10_L("\"");
1020         break;
1021       }
1022     }
1023   }
1024   W10_L(">");
1025
1026   return chtml10->out;
1027 }
1028
1029
1030 /**
1031  * It is a handler who processes the H3 tag.
1032  *
1033  * @param pdoc  [i/o] The pointer to the CHTML structure at the output
1034  *                     destination is specified.
1035  * @param node   [i]   The H3 tag node is specified.
1036  * @return The conversion result is returned.
1037  */
1038 static char*
1039 s_chtml10_end_h3_tag(void* pdoc, Node* UNUSED(child)) 
1040 {
1041   chtml10_t*    chtml10;
1042   Doc*          doc;
1043   request_rec*  r;
1044
1045   chtml10 = GET_CHTML10(pdoc);
1046   doc     = chtml10->doc;
1047   r       = doc->r;
1048
1049   W10_L("</h3>");
1050
1051   return chtml10->out;
1052 }
1053
1054
1055 /**
1056  * It is a handler who processes the H4 tag.
1057  *
1058  * @param pdoc  [i/o] The pointer to the CHTML structure at the output
1059  *                     destination is specified.
1060  * @param node   [i]   The H4 tag node is specified.
1061  * @return The conversion result is returned.
1062  */
1063 static char *
1064 s_chtml10_start_h4_tag(void *pdoc, Node *node)
1065 {
1066   chtml10_t     *chtml10;
1067   Attr          *attr;
1068   Doc           *doc;
1069   request_rec   *r;
1070
1071   chtml10 = GET_CHTML10(pdoc);
1072   doc     = chtml10->doc;
1073   r       = doc->r;
1074
1075   W10_L("<h4");
1076   for (attr = qs_get_attr(doc,node);
1077        attr;
1078        attr = qs_get_next_attr(doc,attr)) {
1079     char* name;
1080     char* value;
1081     name  = qs_get_attr_name(doc,attr);
1082     value = qs_get_attr_value(doc,attr);
1083     if (STRCASEEQ('a','A',"align", name)) {
1084       if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
1085         W10_L(" align=\"");
1086         W10_V(value);
1087         W10_L("\"");
1088         break;
1089       }
1090     }
1091   }
1092   W10_L(">");
1093
1094   return chtml10->out;
1095 }
1096
1097
1098 /**
1099  * It is a handler who processes the H4 tag.
1100  *
1101  * @param pdoc  [i/o] The pointer to the CHTML structure at the output
1102  *                     destination is specified.
1103  * @param node   [i]   The H4 tag node is specified.
1104  * @return The conversion result is returned.
1105  */
1106 static char*
1107 s_chtml10_end_h4_tag(void* pdoc, Node* UNUSED(child)) 
1108 {
1109   Doc*          doc;
1110   request_rec*  r;
1111   chtml10_t*    chtml10;
1112
1113   chtml10  = GET_CHTML10(pdoc);
1114   doc      = chtml10->doc;
1115   r        = doc->r;
1116
1117   W10_L("</h4>");
1118
1119   return chtml10->out;
1120 }
1121
1122
1123 /**
1124  * It is a handler who processes the H5 tag.
1125  *
1126  * @param pdoc  [i/o] The pointer to the CHTML structure at the output
1127  *                     destination is specified.
1128  * @param node   [i]   The H5 tag node is specified.
1129  * @return The conversion result is returned.
1130  */
1131 static char *
1132 s_chtml10_start_h5_tag(void *pdoc, Node *node) 
1133 {
1134   Doc           *doc;
1135   request_rec  *r;
1136   chtml10_t    *chtml10;
1137   Attr         *attr;
1138
1139   chtml10 = GET_CHTML10(pdoc);
1140   doc     = chtml10->doc;
1141   r       = doc->r;
1142
1143   W10_L("<h5");
1144   for (attr = qs_get_attr(doc,node);
1145        attr;
1146        attr = qs_get_next_attr(doc,attr)) {
1147     char* name;
1148     char* value;
1149     name  = qs_get_attr_name(doc,attr);
1150     value = qs_get_attr_value(doc,attr);
1151     if (STRCASEEQ('a','A',"align", name)) {
1152       if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
1153         W10_L(" align=\"");
1154         W10_V(value);
1155         W10_L("\"");
1156         break;
1157       }
1158     }
1159   }
1160   W10_L(">");
1161
1162   return chtml10->out;
1163 }
1164
1165
1166 /**
1167  * It is a handler who processes the H5 tag.
1168  *
1169  * @param pdoc  [i/o] The pointer to the CHTML structure at the output
1170  *                     destination is specified.
1171  * @param node   [i]   The H5 tag node is specified.
1172  * @return The conversion result is returned.
1173  */
1174 static char*
1175 s_chtml10_end_h5_tag(void* pdoc, Node* UNUSED(child)) 
1176 {
1177   Doc*          doc;
1178   request_rec*  r;
1179   chtml10_t*    chtml10;
1180
1181   chtml10 = GET_CHTML10(pdoc);
1182   doc     = chtml10->doc;
1183   r       = doc->r;
1184
1185   W10_L("</h5>");
1186
1187   return chtml10->out;
1188 }
1189
1190
1191 /**
1192  * It is a handler who processes the H6 tag.
1193  *
1194  * @param pdoc  [i/o] The pointer to the CHTML structure at the output
1195  *                     destination is specified.
1196  * @param node   [i]   The H6 tag node is specified.
1197  * @return The conversion result is returned.
1198  */
1199 static char *
1200 s_chtml10_start_h6_tag(void *pdoc, Node *node)
1201 {
1202   Doc           *doc;
1203   request_rec   *r;
1204   chtml10_t     *chtml10;
1205   Attr          *attr;
1206
1207   chtml10 = GET_CHTML10(pdoc);
1208   doc     = chtml10->doc;
1209   r       = doc->r;
1210
1211   W10_L("<h6");
1212   for (attr = qs_get_attr(doc,node);
1213        attr;
1214        attr = qs_get_next_attr(doc,attr)) {
1215     char* name;
1216     char* value;
1217     name  = qs_get_attr_name(doc,attr);
1218     value = qs_get_attr_value(doc,attr);
1219     if (STRCASEEQ('a','A',"align", name)) {
1220       if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
1221         W10_L(" align=\"");
1222         W10_V(value);
1223         W10_L("\"");
1224         break;
1225       }
1226     }
1227   }
1228   W10_L(">");
1229
1230   return chtml10->out;
1231 }
1232
1233
1234 /**
1235  * It is a handler who processes the H6 tag.
1236  *
1237  * @param pdoc  [i/o] The pointer to the CHTML structure at the output
1238  *                     destination is specified.
1239  * @param node   [i]   The H6 tag node is specified.
1240  * @return The conversion result is returned.
1241  */
1242 static char *
1243 s_chtml10_end_h6_tag(void *pdoc, Node *UNUSED(child)) 
1244 {
1245   Doc*          doc;
1246   request_rec*  r;
1247   chtml10_t*    chtml10;
1248
1249   chtml10 = GET_CHTML10(pdoc);
1250   doc     = chtml10->doc;
1251   r       = doc->r;
1252
1253   W10_L("</h6>");
1254
1255   return chtml10->out;
1256 }
1257
1258
1259 /**
1260  * It is a handler who processes the TITLE tag.
1261  *
1262  * @param pdoc  [i/o] The pointer to the CHTML structure at the output
1263  *                     destination is specified.
1264  * @param node   [i]   The TITLE tag node is specified.
1265  * @return The conversion result is returned.
1266  */
1267 static char*
1268 s_chtml10_start_title_tag(void* pdoc, Node* UNUSED(node)) 
1269 {
1270   Doc*         doc;
1271   request_rec* r;
1272   chtml10_t*   chtml10;
1273
1274   chtml10 = GET_CHTML10(pdoc);
1275   doc     = chtml10->doc;
1276   r       = doc->r;
1277
1278   W10_L("<title>");
1279
1280   return chtml10->out;
1281 }
1282
1283
1284 /**
1285  * It is a handler who processes the TITLE tag.
1286  *
1287  * @param pdoc  [i/o] The pointer to the CHTML structure at the output
1288  *                     destination is specified.
1289  * @param node   [i]   The TITLE tag node is specified.
1290  * @return The conversion result is returned.
1291  */
1292 static char*
1293 s_chtml10_end_title_tag(void* pdoc, Node* UNUSED(child)) 
1294 {
1295   Doc*          doc;
1296   request_rec*  r;
1297   chtml10_t*    chtml10;
1298
1299   chtml10 = GET_CHTML10(pdoc);
1300   doc     = chtml10->doc;
1301   r       = doc->r;
1302
1303   W10_L("</title>");
1304
1305   return chtml10->out;
1306 }
1307
1308
1309 /**
1310  * It is a handler who processes the BASE tag.
1311  *
1312  * @param pdoc  [i/o] The pointer to the CHTML structure at the output
1313  *                     destination is specified.
1314  * @param node   [i]   The BASE tag node is specified.
1315  * @return The conversion result is returned.
1316  */
1317 static char*
1318 s_chtml10_start_base_tag(void* pdoc, Node* node) 
1319 {
1320   Attr*         attr;
1321   chtml10_t*    chtml10;
1322   Doc*          doc;
1323   request_rec*  r;
1324
1325   chtml10 = GET_CHTML10(pdoc);
1326   doc     = chtml10->doc;
1327   r       = doc->r;
1328   
1329   W10_L("<base");
1330
1331   /*--------------------------------------------------------------------------*/
1332   /* Get Attributes                                                           */
1333   /*--------------------------------------------------------------------------*/
1334   for (attr = qs_get_attr(doc,node);
1335        attr;
1336        attr = qs_get_next_attr(doc,attr)) {
1337     char* name;
1338     char* value;
1339
1340     name  = qs_get_attr_name(doc,attr);
1341     value = qs_get_attr_value(doc,attr);
1342
1343     if (STRCASEEQ('h','H',"href", name)) {
1344       W10_L(" href=\"");
1345       W10_V(value);
1346       W10_L("\"");
1347     }
1348   }
1349
1350   W10_L(">");
1351
1352   return chtml10->out;
1353 }
1354
1355
1356 /**
1357  * It is a handler who processes the BASE 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 BASE tag node is specified.
1362  * @return The conversion result is returned.
1363  */
1364 static char*
1365 s_chtml10_end_base_tag(void* pdoc, Node* UNUSED(child)) 
1366 {
1367   chtml10_t* chtml10 = GET_CHTML10(pdoc);
1368
1369   return chtml10->out;
1370 }
1371
1372
1373 /**
1374  * It is a handler who processes the BODY tag.
1375  *
1376  * @param pdoc  [i/o] The pointer to the CHTML structure at the output
1377  *                     destination is specified.
1378  * @param node   [i]   The BODY tag node is specified.
1379  * @return The conversion result is returned.
1380  */
1381 static char*
1382 s_chtml10_start_body_tag(void* pdoc, Node* node) 
1383 {
1384   chtml10_t*   chtml10;
1385   Doc*         doc;
1386   request_rec* r;
1387   Attr*        attr;
1388
1389   chtml10 = GET_CHTML10(pdoc);
1390   doc     = chtml10->doc;
1391   r       = doc->r;
1392
1393
1394   W10_L("<body");
1395
1396   /*--------------------------------------------------------------------------*/
1397   /* Get Attributes                                                           */
1398   /*--------------------------------------------------------------------------*/
1399   for (attr = qs_get_attr(doc,node);
1400        attr;
1401        attr = qs_get_next_attr(doc,attr)) {
1402
1403     char* name;
1404
1405     name  = qs_get_attr_name(doc,attr);
1406
1407     switch(*name) {
1408     case 'a':
1409     case 'A':
1410       if (strcasecmp(name, "alink") == 0) {
1411         /*----------------------------------------------------------------------*/
1412         /* CHTML 4.0                                                            */
1413         /*----------------------------------------------------------------------*/
1414         /* ignore */
1415       }
1416       break;
1417
1418     case 'b':
1419     case 'B':
1420       if (strcasecmp(name, "bgcolor") == 0) {
1421         /*----------------------------------------------------------------------*/
1422         /* CHTML 2.0                                                            */
1423         /*----------------------------------------------------------------------*/
1424         /* ignore */
1425       }
1426       break;
1427
1428     case 't':
1429     case 'T':
1430       if (strcasecmp(name, "text") == 0) {
1431         /*----------------------------------------------------------------------*/
1432         /* CHTML 2.0                                                            */
1433         /*----------------------------------------------------------------------*/
1434         /* ignore */
1435       }
1436       break;
1437
1438     case 'l':
1439     case 'L':
1440       if (strcasecmp(name, "link") == 0) {
1441         /*----------------------------------------------------------------------*/
1442         /* CHTML 2.0                                                            */
1443         /*----------------------------------------------------------------------*/
1444         /* ignore */
1445       }
1446       break;
1447
1448     case 'v':
1449     case 'V':
1450       if (strcasecmp(name, "vlink") == 0) {
1451         /*----------------------------------------------------------------------*/
1452         /* CHTML 4.0                                                            */
1453         /*----------------------------------------------------------------------*/
1454         /* ignore */
1455       }
1456       break;
1457
1458     default:
1459       break;
1460     }
1461   }
1462
1463   W10_L(">");
1464
1465   return chtml10->out;
1466 }
1467
1468
1469 /**
1470  * It is a handler who processes the BODY tag.
1471  *
1472  * @param pdoc  [i/o] The pointer to the CHTML structure at the output
1473  *                     destination is specified.
1474  * @param node   [i]   The BODY tag node is specified.
1475  * @return The conversion result is returned.
1476  */
1477 static char*
1478 s_chtml10_end_body_tag(void* pdoc, Node* UNUSED(child)) 
1479 {
1480   Doc*          doc;
1481   request_rec*  r;
1482   chtml10_t*    chtml10;
1483
1484   chtml10 = GET_CHTML10(pdoc);
1485   doc     = chtml10->doc;
1486   r       = doc->r;
1487
1488   W10_L("</body>");
1489
1490   return chtml10->out;
1491 }
1492
1493
1494 /**
1495  * It is a handler who processes the A tag.
1496  *
1497  * @param pdoc  [i/o] The pointer to the CHTML structure at the output
1498  *                     destination is specified.
1499  * @param node   [i]   The A tag node is specified.
1500  * @return The conversion result is returned.
1501  */
1502 static char *
1503 s_chtml10_start_a_tag(void *pdoc, Node *node) 
1504 {
1505   chtml10_t     *chtml10;
1506   Doc           *doc;
1507   request_rec   *r;
1508   Attr          *attr;
1509
1510   chtml10 = GET_CHTML10(pdoc);
1511   doc     = chtml10->doc;
1512   r       = doc->r;
1513
1514   W10_L("<a");
1515
1516   /*--------------------------------------------------------------------------*/
1517   /* Get Attributes                                                           */
1518   /*--------------------------------------------------------------------------*/
1519   for (attr = qs_get_attr(doc,node);
1520        attr; 
1521        attr = qs_get_next_attr(doc,attr)) {
1522
1523     char *name;
1524     char *value;
1525
1526     name  = qs_get_attr_name(doc,attr);
1527     value = qs_get_attr_value(doc,attr);
1528
1529     switch(*name) {
1530     case 'n':
1531     case 'N':
1532       if (strcasecmp(name, "name") == 0) {
1533         /*--------------------------------------------------------------------*/
1534         /* CHTML1.0                                                           */
1535         /*--------------------------------------------------------------------*/
1536         W10_L(" name=\"");
1537         W10_V(value);
1538         W10_L("\"");
1539       }
1540       break;
1541
1542     case 'h':
1543     case 'H':
1544       if (strcasecmp(name, "href") == 0) {
1545         /*--------------------------------------------------------------------*/
1546         /* CHTML1.0                                                           */
1547         /*--------------------------------------------------------------------*/
1548         value = chxj_encoding_parameter(r, value);
1549         value = chxj_add_cookie_parameter(r, value, chtml10->cookie);
1550         W10_L(" href=\"");
1551         W10_V(value);
1552         W10_L("\"");
1553       }
1554       break;
1555
1556     case 'a':
1557     case 'A':
1558       if (strcasecmp(name, "accesskey") == 0) {
1559         /*--------------------------------------------------------------------*/
1560         /* CHTML1.0                                                           */
1561         /*--------------------------------------------------------------------*/
1562         W10_L(" accesskey=\"");
1563         W10_V(value);
1564         W10_L("\"");
1565       }
1566       break;
1567
1568     case 'c':
1569     case 'C':
1570       if (strcasecmp(name, "cti") == 0) {
1571         /*--------------------------------------------------------------------*/
1572         /* CHTML 2.0                                                          */
1573         /*--------------------------------------------------------------------*/
1574         /* ignore */
1575       }
1576       break;
1577
1578     case 'u':
1579     case 'U':
1580       if (strcasecmp(name, "utn") == 0) {
1581         /*--------------------------------------------------------------------*/
1582         /* CHTML 3.0                                                          */
1583         /*--------------------------------------------------------------------*/
1584         /* ignore */
1585       }
1586       break;
1587
1588     case 't':
1589     case 'T':
1590       if (strcasecmp(name, "telbook") == 0) {
1591         /*--------------------------------------------------------------------*/
1592         /* CHTML 3.0                                                          */
1593         /*--------------------------------------------------------------------*/
1594         /* ignore */
1595       }
1596       break;
1597
1598     case 'k':
1599     case 'K':
1600       if (strcasecmp(name, "kana") == 0) {
1601         /*--------------------------------------------------------------------*/
1602         /* CHTML 3.0                                                          */
1603         /*--------------------------------------------------------------------*/
1604         /* ignore */
1605       }
1606       break;
1607
1608     case 'e':
1609     case 'E':
1610       if (strcasecmp(name, "email") == 0) {
1611         /*--------------------------------------------------------------------*/
1612         /* CHTML 3.0                                                          */
1613         /*--------------------------------------------------------------------*/
1614         /* ignore */
1615       }
1616       break;
1617
1618     case 'i':
1619     case 'I':
1620       if (strcasecmp(name, "ista") == 0) {
1621         /*--------------------------------------------------------------------*/
1622         /* CHTML 4.0                                                          */
1623         /*--------------------------------------------------------------------*/
1624         /* ignore */
1625       }
1626       else
1627       if (strcasecmp(name, "ilet") == 0) {
1628         /*--------------------------------------------------------------------*/
1629         /* CHTML 5.0                                                          */
1630         /*--------------------------------------------------------------------*/
1631         /* ignore */
1632       }
1633       else
1634       if (strcasecmp(name, "iswf") == 0) {
1635         /*--------------------------------------------------------------------*/
1636         /* CHTML 5.0                                                          */
1637         /*--------------------------------------------------------------------*/
1638         /* ignore */
1639       }
1640       else
1641       if (strcasecmp(name, "irst") == 0) {
1642         /*--------------------------------------------------------------------*/
1643         /* CHTML 5.0                                                          */
1644         /*--------------------------------------------------------------------*/
1645         /* ignore */
1646       }
1647       else
1648       if (strcasecmp(name, "ijam") == 0) {
1649         /*--------------------------------------------------------------------*/
1650         /* CHTML 3.0                                                          */
1651         /*--------------------------------------------------------------------*/
1652         /* ignore */
1653       }
1654       break;
1655
1656     default:
1657       break;
1658     }
1659   }
1660
1661   W10_L(">");
1662   return chtml10->out;
1663 }
1664
1665
1666 /**
1667  * It is a handler who processes the A tag.
1668  *
1669  * @param pdoc  [i/o] The pointer to the CHTML structure at the output
1670  *                     destination is specified.
1671  * @param node   [i]   The A tag node is specified.
1672  * @return The conversion result is returned.
1673  */
1674 static char *
1675 s_chtml10_end_a_tag(void *pdoc, Node *UNUSED(child)) 
1676 {
1677   chtml10_t    *chtml10;
1678   Doc          *doc;
1679   request_rec  *r;
1680
1681   chtml10 = GET_CHTML10(pdoc);
1682   doc     = chtml10->doc;
1683   r       = doc->r;
1684
1685   W10_L("</a>");
1686   return chtml10->out;
1687 }
1688
1689
1690 /**
1691  * It is a handler who processes the BR tag.
1692  *
1693  * @param pdoc  [i/o] The pointer to the CHTML structure at the output
1694  *                     destination is specified.
1695  * @param node   [i]   The BR tag node is specified.
1696  * @return The conversion result is returned.
1697  */
1698 static char *
1699 s_chtml10_start_br_tag(void *pdoc, Node *node) 
1700 {
1701   chtml10_t    *chtml10;
1702   Doc          *doc;
1703   request_rec  *r;
1704   Attr         *attr = NULL;
1705
1706   chtml10 = GET_CHTML10(pdoc);
1707   doc     = chtml10->doc;
1708   r       = doc->r;
1709
1710   W10_L("<br");
1711
1712   /*--------------------------------------------------------------------------*/
1713   /* Get Attributes                                                           */
1714   /*--------------------------------------------------------------------------*/
1715   for (attr = qs_get_attr(doc,node);
1716        attr;
1717        attr = qs_get_next_attr(doc,attr)) {
1718     char *name;
1719     char *value;
1720
1721     name  = qs_get_attr_name(doc,attr);
1722     value = qs_get_attr_value(doc,attr);
1723
1724     if (STRCASEEQ('c','C',"clear",name)) {
1725       if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('a','A',"all",value))) {
1726         W10_L(" clear=\"");
1727         W10_V(value);
1728         W10_L("\"");
1729       }
1730     }
1731   }
1732   W10_L(">");
1733   return chtml10->out;
1734 }
1735
1736
1737 /**
1738  * It is a handler who processes the BR tag.
1739  *
1740  * @param pdoc  [i/o] The pointer to the CHTML structure at the output
1741  *                     destination is specified.
1742  * @param node   [i]   The BR tag node is specified.
1743  * @return The conversion result is returned.
1744  */
1745 static char *
1746 s_chtml10_end_br_tag(void *pdoc, Node *UNUSED(child)) 
1747 {
1748   chtml10_t *chtml10 = GET_CHTML10(pdoc);
1749
1750   return chtml10->out;
1751 }
1752
1753
1754 /**
1755  * It is a handler who processes the TR tag.
1756  *
1757  * @param pdoc  [i/o] The pointer to the CHTML structure at the output
1758  *                     destination is specified.
1759  * @param node   [i]   The TR tag node is specified.
1760  * @return The conversion result is returned.
1761  */
1762 static char *
1763 s_chtml10_start_tr_tag(void *pdoc, Node *UNUSED(node)) 
1764 {
1765   chtml10_t *chtml10 = GET_CHTML10(pdoc);
1766
1767   return chtml10->out;
1768 }
1769
1770
1771 /**
1772  * It is a handler who processes the TR tag.
1773  *
1774  * @param pdoc  [i/o] The pointer to the CHTML structure at the output
1775  *                     destination is specified.
1776  * @param node   [i]   The TR tag node is specified.
1777  * @return The conversion result is returned.
1778  */
1779 static char *
1780 s_chtml10_end_tr_tag(void *pdoc, Node *UNUSED(child)) 
1781 {
1782   chtml10_t    *chtml10;
1783   Doc          *doc;
1784   request_rec  *r;
1785
1786   chtml10 = GET_CHTML10(pdoc);
1787   doc     = chtml10->doc;
1788   r       = doc->r;
1789
1790   W10_L("<br>\r\n");
1791
1792   return chtml10->out;
1793 }
1794
1795
1796 /**
1797  * It is a handler who processes the FONT tag.
1798  *
1799  * @param pdoc  [i/o] The pointer to the CHTML structure at the output
1800  *                     destination is specified.
1801  * @param node   [i]   The FONT tag node is specified.
1802  * @return The conversion result is returned.
1803  */
1804 static char *
1805 s_chtml10_start_font_tag(void *pdoc, Node *UNUSED(node)) 
1806 {
1807   chtml10_t *chtml10 = GET_CHTML10(pdoc);
1808
1809   /* Ignore */
1810
1811   return chtml10->out;
1812 }
1813
1814
1815 /**
1816  * It is a handler who processes the FONT tag.
1817  *
1818  * @param pdoc  [i/o] The pointer to the CHTML structure at the output
1819  *                     destination is specified.
1820  * @param node   [i]   The FONT tag node is specified.
1821  * @return The conversion result is returned.
1822  */
1823 static char *
1824 s_chtml10_end_font_tag(void *pdoc, Node *UNUSED(child)) 
1825 {
1826   chtml10_t *chtml10 = GET_CHTML10(pdoc);
1827
1828   /* ignore */
1829
1830   return chtml10->out;
1831 }
1832
1833
1834 /**
1835  * It is a handler who processes the FORM tag.
1836  *
1837  * @param pdoc  [i/o] The pointer to the CHTML structure at the output
1838  *                     destination is specified.
1839  * @param node   [i]   The FORM tag node is specified.
1840  * @return The conversion result is returned.
1841  */
1842 static char *
1843 s_chtml10_start_form_tag(void *pdoc, Node *node) 
1844 {
1845   chtml10_t    *chtml10;
1846   Doc          *doc;
1847   request_rec  *r;
1848   Attr         *attr;
1849
1850   chtml10 = GET_CHTML10(pdoc);
1851   doc     = chtml10->doc;
1852   r       = doc->r;
1853
1854   W10_L("<form");
1855
1856   /*--------------------------------------------------------------------------*/
1857   /* Get Attributes                                                           */
1858   /*--------------------------------------------------------------------------*/
1859   for (attr = qs_get_attr(doc,node);
1860        attr;
1861        attr = qs_get_next_attr(doc,attr)) {
1862     char *name;
1863     char *value;
1864
1865     name  = qs_get_attr_name(doc,attr);
1866     value = qs_get_attr_value(doc,attr);
1867
1868     switch(*name) {
1869     case 'a':
1870     case 'A':
1871       if (strcasecmp(name, "action") == 0) {
1872         /*--------------------------------------------------------------------*/
1873         /* CHTML 1.0                                                          */
1874         /*--------------------------------------------------------------------*/
1875         value = chxj_encoding_parameter(r, value);
1876         value = chxj_add_cookie_parameter(r, value, chtml10->cookie);
1877   
1878         W10_L(" action=\"");
1879         W10_V(value);
1880         W10_L("\"");
1881       }
1882       break;
1883
1884     case 'm':
1885     case 'M':
1886       if (strcasecmp(name, "method") == 0) {
1887         /*--------------------------------------------------------------------*/
1888         /* CHTML 1.0                                                          */
1889         /*--------------------------------------------------------------------*/
1890         W10_L(" method=\"");
1891         W10_V(value);
1892         W10_L("\"");
1893       }
1894       break;
1895
1896     case 'u':
1897     case 'U':
1898       if (strcasecmp(name, "utn") == 0) {
1899         /*--------------------------------------------------------------------*/
1900         /* CHTML 3.0                                                          */
1901         /*--------------------------------------------------------------------*/
1902         /* ignore */
1903       }
1904       break;
1905
1906     default:
1907       break;
1908     }
1909   }
1910
1911   W10_L(">");
1912
1913   return chtml10->out;
1914 }
1915
1916
1917 /**
1918  * It is a handler who processes the FORM tag.
1919  *
1920  * @param pdoc  [i/o] The pointer to the CHTML structure at the output
1921  *                     destination is specified.
1922  * @param node   [i]   The FORM tag node is specified.
1923  * @return The conversion result is returned.
1924  */
1925 static char*
1926 s_chtml10_end_form_tag(void* pdoc, Node* UNUSED(child)) 
1927 {
1928   chtml10_t*   chtml10;
1929   Doc*         doc;
1930   request_rec* r;
1931
1932   chtml10 = GET_CHTML10(pdoc);
1933   doc     = chtml10->doc;
1934   r       = doc->r;
1935
1936   W10_L("</form>");
1937
1938   return chtml10->out;
1939 }
1940
1941
1942 /**
1943  * It is a handler who processes the INPUT tag.
1944  *
1945  * @param pdoc  [i/o] The pointer to the CHTML structure at the output
1946  *                     destination is specified.
1947  * @param node   [i]   The INPUT tag node is specified.
1948  * @return The conversion result is returned.
1949  */
1950 static char*
1951 s_chtml10_start_input_tag(void* pdoc, Node* node) 
1952 {
1953   chtml10_t*    chtml10;
1954   Doc*          doc;
1955   request_rec*  r;
1956   char*         max_length;
1957   char*         type;
1958   char*         name;
1959   char*         value;
1960   char*         istyle;
1961   char*         size;
1962   char*         checked;
1963   char*         accesskey;
1964
1965   chtml10     = GET_CHTML10(pdoc);
1966   doc         = chtml10->doc;
1967   r           = doc->r;
1968
1969   max_length  = NULL;
1970   type        = NULL;
1971   name        = NULL;
1972   value       = NULL;
1973   istyle      = NULL;
1974   size        = NULL;
1975   checked     = NULL;
1976   accesskey   = NULL;
1977
1978   W10_L("<input");
1979
1980   /*--------------------------------------------------------------------------*/
1981   /* Get Attributes                                                           */
1982   /*--------------------------------------------------------------------------*/
1983
1984   type       = qs_get_type_attr(doc, node, r);
1985   name       = qs_get_name_attr(doc, node, r);
1986   value      = qs_get_value_attr(doc,node,r);
1987   istyle     = qs_get_istyle_attr(doc,node,r);
1988   max_length = qs_get_maxlength_attr(doc,node,r);
1989   checked    = qs_get_checked_attr(doc,node,r);
1990   accesskey  = qs_get_accesskey_attr(doc, node, r);
1991   size       = qs_get_size_attr(doc, node, r);
1992
1993   if (type) {
1994     type = qs_trim_string(doc->buf.pool, type);
1995     if (type && (STRCASEEQ('t','T',"text",    type) ||
1996                  STRCASEEQ('p','P',"password",type) ||
1997                  STRCASEEQ('c','C',"checkbox",type) ||
1998                  STRCASEEQ('r','R',"radio",   type) ||
1999                  STRCASEEQ('h','H',"hidden",  type) ||
2000                  STRCASEEQ('s','S',"submit",  type) ||
2001                  STRCASEEQ('r','R',"reset",   type))) {
2002       W10_L(" type=\"");
2003       W10_V(type);
2004       W10_L("\"");
2005     }
2006   }
2007
2008   if (size && *size != 0) {
2009     W10_L(" size=\"");
2010     W10_V(size);
2011     W10_L("\"");
2012   }
2013
2014   if (name && *name != 0) {
2015     W10_L(" name=\"");
2016     W10_V(name);
2017     W10_L("\"");
2018   }
2019
2020   if (value && *value != 0) {
2021     W10_L(" value=\"");
2022     W10_V(value);
2023     W10_L("\"");
2024   }
2025
2026   if (accesskey && *accesskey != 0) {
2027     W10_L(" accesskey=\"");
2028     W10_V(accesskey);
2029     W10_L("\"");
2030   }
2031
2032   if (istyle) {
2033     /*------------------------------------------------------------------------*/
2034     /* CHTML 2.0                                                              */
2035     /*------------------------------------------------------------------------*/
2036     /* ignore */
2037   }
2038   /*--------------------------------------------------------------------------*/
2039   /* The figure is default for the password.                                  */
2040   /*--------------------------------------------------------------------------*/
2041   if (max_length && *max_length != 0) {
2042     W10_L(" maxlength=\"");
2043     W10_V(max_length);
2044     W10_L("\"");
2045   }
2046
2047   if (checked) {
2048     W10_L(" checked");
2049   }
2050
2051   W10_L(">");
2052   return chtml10->out;
2053 }
2054
2055
2056 /**
2057  * It is a handler who processes the INPUT tag.
2058  *
2059  * @param pdoc  [i/o] The pointer to the CHTML structure at the output
2060  *                     destination is specified.
2061  * @param node   [i]   The INPUT tag node is specified.
2062  * @return The conversion result is returned.
2063  */
2064 static char*
2065 s_chtml10_end_input_tag(void* pdoc, Node* UNUSED(child)) 
2066 {
2067   chtml10_t* chtml10 = GET_CHTML10(pdoc);
2068
2069   return chtml10->out;
2070 }
2071
2072
2073 /**
2074  * It is a handler who processes the CENTER tag.
2075  *
2076  * @param pdoc  [i/o] The pointer to the CHTML structure at the output
2077  *                     destination is specified.
2078  * @param node   [i]   The CENTER tag node is specified.
2079  * @return The conversion result is returned.
2080  */
2081 static char*
2082 s_chtml10_start_center_tag(void* pdoc, Node* UNUSED(node)) 
2083 {
2084   chtml10_t*   chtml10;
2085   Doc*         doc;
2086   request_rec* r;
2087
2088   chtml10 = GET_CHTML10(pdoc);
2089   doc     = chtml10->doc;
2090   r       = doc->r;
2091
2092   W10_L("<center>");
2093
2094   return chtml10->out;
2095 }
2096
2097
2098 /**
2099  * It is a handler who processes the CENTER tag.
2100  *
2101  * @param pdoc  [i/o] The pointer to the CHTML structure at the output
2102  *                     destination is specified.
2103  * @param node   [i]   The CENTER tag node is specified.
2104  * @return The conversion result is returned.
2105  */
2106 static char*
2107 s_chtml10_end_center_tag(void* pdoc, Node* UNUSED(child)) 
2108 {
2109   chtml10_t*    chtml10;
2110   Doc*          doc;
2111   request_rec*  r;
2112
2113   chtml10 = GET_CHTML10(pdoc);
2114   doc     = chtml10->doc;
2115   r       = doc->r;
2116
2117   W10_L("</center>");
2118
2119   return chtml10->out;
2120 }
2121
2122
2123 /**
2124  * It is a handler who processes the HR tag.
2125  *
2126  * @param pdoc  [i/o] The pointer to the CHTML structure at the output
2127  *                     destination is specified.
2128  * @param node   [i]   The HR tag node is specified.
2129  * @return The conversion result is returned.
2130  */
2131 static char*
2132 s_chtml10_start_hr_tag(void* pdoc, Node* node) 
2133 {
2134   chtml10_t*   chtml10;
2135   Doc*         doc;
2136   request_rec* r;
2137   Attr*        attr;
2138
2139   chtml10 = GET_CHTML10(pdoc);
2140   doc     = chtml10->doc;
2141   r       = doc->r;
2142
2143   W10_L("<hr");
2144  
2145   for (attr = qs_get_attr(doc,node);
2146        attr; 
2147        attr = qs_get_next_attr(doc,attr)) {
2148
2149     char* name;
2150     char* value;
2151
2152     name  = qs_get_attr_name (doc,attr);
2153     value = qs_get_attr_value(doc,attr);
2154
2155     switch(*name) {
2156     case 'a':
2157     case 'A':
2158       if (strcasecmp(name, "align") == 0) {
2159         /*--------------------------------------------------------------------*/
2160         /* CHTML 1.0                                                          */
2161         /*--------------------------------------------------------------------*/
2162         if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
2163           W10_L(" align=\"");
2164           W10_V(value);
2165           W10_L("\"");
2166         }
2167       }
2168       break;
2169
2170     case 's':
2171     case 'S':
2172       if (strcasecmp(name, "size") == 0) {
2173         /*--------------------------------------------------------------------*/
2174         /* CHTML 1.0                                                          */
2175         /*--------------------------------------------------------------------*/
2176         if (value && value[0] != '\0') {
2177           W10_L(" size=\"");
2178           W10_V(value);
2179           W10_L("\"");
2180         }
2181       }
2182       break;
2183
2184     case 'w':
2185     case 'W':
2186       if (strcasecmp(name, "width") == 0) {
2187         /*--------------------------------------------------------------------*/
2188         /* CHTML 1.0                                                          */
2189         /*--------------------------------------------------------------------*/
2190         if (value && value[0] != '\0') {
2191           W10_L(" width=\"");
2192           W10_V(value);
2193           W10_L("\"");
2194         }
2195       }
2196       break;
2197
2198     case 'n':
2199     case 'N':
2200       if (strcasecmp(name, "noshade") == 0) {
2201         /*--------------------------------------------------------------------*/
2202         /* CHTML 1.0                                                          */
2203         /*--------------------------------------------------------------------*/
2204         W10_L(" noshade");
2205       }
2206       break;
2207
2208     case 'c':
2209     case 'C':
2210       if (strcasecmp(name, "color") == 0) {
2211         /*--------------------------------------------------------------------*/
2212         /* CHTML 4.0                                                          */
2213         /*--------------------------------------------------------------------*/
2214         /* ignore */
2215       }
2216       break;
2217
2218     default:
2219       break;
2220     }
2221   }
2222   W10_L(">");
2223   return chtml10->out;
2224 }
2225
2226
2227 /**
2228  * It is a handler who processes the HR tag.
2229  *
2230  * @param pdoc  [i/o] The pointer to the CHTML structure at the output
2231  *                     destination is specified.
2232  * @param node   [i]   The HR tag node is specified.
2233  * @return The conversion result is returned.
2234  */
2235 static char*
2236 s_chtml10_end_hr_tag(void* pdoc, Node* UNUSED(child)) 
2237 {
2238   chtml10_t* chtml10;
2239
2240   chtml10 = GET_CHTML10(pdoc);
2241
2242   return chtml10->out;
2243 }
2244
2245
2246 /**
2247  * It is a handler who processes the IMG tag.
2248  *
2249  * @param pdoc  [i/o] The pointer to the CHTML structure at the output
2250  *                     destination is specified.
2251  * @param node   [i]   The IMG tag node is specified.
2252  * @return The conversion result is returned.
2253  */
2254 static char*
2255 s_chtml10_start_img_tag(void* pdoc, Node* node) 
2256 {
2257   chtml10_t*   chtml10;
2258   Doc*         doc;
2259   request_rec* r;
2260   Attr*        attr;
2261 #ifndef IMG_NOT_CONVERT_FILENAME
2262   device_table *spec;
2263 #endif
2264
2265   chtml10 = GET_CHTML10(pdoc);
2266 #ifndef IMG_NOT_CONVERT_FILENAME
2267   spec    = chtml10->spec;
2268 #endif
2269   doc     = chtml10->doc;
2270   r       = doc->r;
2271
2272   W10_L("<img");
2273   /*--------------------------------------------------------------------------*/
2274   /* Get Attributes                                                           */
2275   /*--------------------------------------------------------------------------*/
2276   for (attr = qs_get_attr(doc,node);
2277        attr;
2278        attr = qs_get_next_attr(doc,attr)) {
2279
2280     char* name;
2281     char* value;
2282
2283     name  = qs_get_attr_name (doc,attr);
2284     value = qs_get_attr_value(doc,attr);
2285
2286     switch(*name) {
2287     case 's':
2288     case 'S':
2289       if (strcasecmp(name, "src") == 0) {
2290         /*--------------------------------------------------------------------*/
2291         /* CHTML 1.0                                                          */
2292         /*--------------------------------------------------------------------*/
2293 #ifdef IMG_NOT_CONVERT_FILENAME
2294         value = chxj_encoding_parameter(r, value);
2295         value = chxj_add_cookie_parameter(r, value, chtml10->cookie);
2296         if (value) {
2297           value = apr_psprintf(doc->buf.pool, 
2298                                "%s%c%s=true", 
2299                                value, 
2300                                (strchr(value, '?')) ? '&' : '?',
2301                                CHXJ_COOKIE_NOUPDATE_PARAM);
2302         }
2303         W10_L(" src=\"");
2304         W10_V(value);
2305         W10_L("\"");
2306 #else
2307         value = chxj_img_conv(r, spec, value);
2308         value = chxj_encoding_parameter(r, value);
2309         value = chxj_add_cookie_parameter(r, value, chtml10->cookie);
2310         if (value) {
2311           value = apr_psprintf(doc->buf.pool,
2312                                "%s%c%s=true",
2313                                value,
2314                                (strchr(value, '?')) ? '&' : '?',
2315                                CHXJ_COOKIE_NOUPDATE_PARAM);
2316         }
2317         W10_L(" src=\"");
2318         W10_V(value);
2319         W10_L("\"");
2320 #endif
2321       }
2322       break;
2323
2324     case 'a':
2325     case 'A':
2326       if (strcasecmp(name, "align" ) == 0) {
2327         /*--------------------------------------------------------------------*/
2328         /* CHTML 1.0                                                          */
2329         /*--------------------------------------------------------------------*/
2330         /*--------------------------------------------------------------------*/
2331         /* CHTML 4.0                                                          */
2332         /*--------------------------------------------------------------------*/
2333         if (value && (STRCASEEQ('t','T',"top",   value) || 
2334                       STRCASEEQ('m','M',"middle",value) || 
2335                       STRCASEEQ('b','B',"bottom",value) || 
2336                       STRCASEEQ('l','L',"left",  value) ||
2337                       STRCASEEQ('r','R',"right", value))) {
2338           W10_L(" align=\"");
2339           W10_V(value);
2340           W10_L("\"");
2341         }
2342       }
2343       else if (strcasecmp(name, "alt"   ) == 0) {
2344         /*--------------------------------------------------------------------*/
2345         /* CHTML 1.0                                                          */
2346         /*--------------------------------------------------------------------*/
2347         if (value && value[0] != '\0') {
2348           W10_L(" alt=\"");
2349           W10_V(value);
2350           W10_L("\"");
2351         }
2352       }
2353       break;
2354
2355     case 'w':
2356     case 'W':
2357       if (strcasecmp(name, "width" ) == 0) {
2358         /*--------------------------------------------------------------------*/
2359         /* CHTML 1.0                                                          */
2360         /*--------------------------------------------------------------------*/
2361         if (value && value[0] != '\0') {
2362           W10_L(" width=\"");
2363           W10_V(value);
2364           W10_L("\"");
2365         }
2366       }
2367       break;
2368
2369     case 'h':
2370     case 'H':
2371       if (strcasecmp(name, "height") == 0) {
2372         /*--------------------------------------------------------------------*/
2373         /* CHTML 1.0                                                          */
2374         /*--------------------------------------------------------------------*/
2375         if (value && value[0] != '\0') {
2376           W10_L(" height=\"");
2377           W10_V(value);
2378           W10_L("\"");
2379         }
2380       }
2381       else
2382       if (strcasecmp(name, "hspace") == 0) {
2383         /*--------------------------------------------------------------------*/
2384         /* CHTML 1.0                                                          */
2385         /*--------------------------------------------------------------------*/
2386         if (value && value[0] != '\0') {
2387           W10_L(" hspace=\"");
2388           W10_V(value);
2389           W10_L("\"");
2390         }
2391       }
2392       break;
2393
2394     case 'v':
2395     case 'V':
2396       if (strcasecmp(name, "vspace") == 0) {
2397         /*--------------------------------------------------------------------*/
2398         /* CHTML 1.0                                                          */
2399         /*--------------------------------------------------------------------*/
2400         if (value && value[0] != '\0') {
2401           W10_L(" vspace=\"");
2402           W10_V(value);
2403           W10_L("\"");
2404         }
2405       }
2406       break;
2407
2408     default:
2409       break;
2410     }
2411   }
2412
2413   W10_L(">");
2414   return chtml10->out;
2415 }
2416
2417
2418 /**
2419  * It is a handler who processes the IMG tag.
2420  *
2421  * @param chtml10  [i/o] The pointer to the CHTML structure at the output
2422  *                     destination is specified.
2423  * @param node   [i]   The IMG tag node is specified.
2424  * @return The conversion result is returned.
2425  */
2426 static char *
2427 s_chtml10_end_img_tag(void *pdoc, Node *UNUSED(child)) 
2428 {
2429   chtml10_t *chtml10;
2430
2431   chtml10 = GET_CHTML10(pdoc);
2432
2433   return chtml10->out;
2434 }
2435
2436
2437 /**
2438  * It is a handler who processes the SELECT tag.
2439  *
2440  * @param pdoc  [i/o] The pointer to the CHTML structure at the output
2441  *                     destination is specified.
2442  * @param node   [i]   The SELECT tag node is specified.
2443  * @return The conversion result is returned.
2444  */
2445 static char *
2446 s_chtml10_start_select_tag(void *pdoc, Node *child)
2447 {
2448   chtml10_t    *chtml10;
2449   Doc          *doc;
2450   request_rec  *r;
2451   Attr         *attr;
2452
2453   char         *size;
2454   char         *name;
2455
2456   chtml10 = GET_CHTML10(pdoc);
2457   doc     = chtml10->doc;
2458   r       = doc->r;
2459
2460   size    = NULL;
2461   name    = NULL;
2462
2463   W10_L("<select");
2464   for (attr = qs_get_attr(doc,child);
2465        attr;
2466        attr = qs_get_next_attr(doc,attr)) {
2467     char *nm;
2468     char *val;
2469
2470     nm  = qs_get_attr_name (doc,attr);
2471     val = qs_get_attr_value(doc,attr);
2472
2473     switch(*nm) {
2474     case 's':
2475     case 'S':
2476       if (strcasecmp(nm, "size") == 0) {
2477         /*--------------------------------------------------------------------*/
2478         /* CHTML 1.0 version 2.0                                              */
2479         /*--------------------------------------------------------------------*/
2480         size = apr_pstrdup(doc->buf.pool, val);
2481       }
2482       break;
2483
2484     case 'n':
2485     case 'N':
2486       if (strcasecmp(nm, "name") == 0) {
2487         /*--------------------------------------------------------------------*/
2488         /* CHTML 1.0 version 2.0                                              */
2489         /*--------------------------------------------------------------------*/
2490         name = apr_pstrdup(doc->buf.pool, val);
2491       }
2492       break;
2493
2494     case 'm':
2495     case 'M':
2496       if (strcasecmp(nm, "multiple") == 0) {
2497         /*--------------------------------------------------------------------*/
2498         /* CHTML 1.0 version 2.0                                              */
2499         /*--------------------------------------------------------------------*/
2500         /* Ignore */
2501       }
2502       break;
2503
2504     default:
2505       break;
2506     }
2507   }
2508
2509   if (size && *size != 0) {
2510     W10_L(" size=\"");
2511     W10_V(size);
2512     W10_L("\"");
2513   }
2514
2515   if (name && *name != 0) {
2516     W10_L(" name=\"");
2517     W10_V(name);
2518     W10_L("\"");
2519   }
2520
2521   W10_L(">");
2522   return chtml10->out;
2523 }
2524
2525
2526 /**
2527  * It is a handler who processes the SELECT tag.
2528  *
2529  * @param pdoc  [i/o] The pointer to the CHTML structure at the output
2530  *                     destination is specified.
2531  * @param node   [i]   The SELECT tag node is specified.
2532  * @return The conversion result is returned.
2533  */
2534 static char *
2535 s_chtml10_end_select_tag(void *pdoc, Node *UNUSED(child))
2536 {
2537   chtml10_t *chtml10;
2538   Doc *doc;
2539   request_rec *r;
2540
2541   chtml10 = GET_CHTML10(pdoc);
2542   doc     = chtml10->doc;
2543   r       = doc->r;
2544
2545   W10_L("</select>");
2546   return chtml10->out;
2547 }
2548
2549
2550 /**
2551  * It is a handler who processes the OPTION tag.
2552  *
2553  * @param pdoc  [i/o] The pointer to the CHTML structure at the output
2554  *                     destination is specified.
2555  * @param node   [i]   The OPTION tag node is specified.
2556  * @return The conversion result is returned.
2557  */
2558 static char *
2559 s_chtml10_start_option_tag(void *pdoc, Node *child)
2560 {
2561   chtml10_t *chtml10;
2562   Doc *doc;
2563   request_rec *r;
2564   Attr *attr;
2565
2566   char *selected;
2567   char *value;
2568
2569   chtml10   = GET_CHTML10(pdoc);
2570   doc       = chtml10->doc;
2571   r         = doc->r;
2572
2573   selected  = NULL;
2574   value     = NULL;
2575
2576   W10_L("<option");
2577
2578   for (attr = qs_get_attr(doc,child);
2579        attr;
2580        attr = qs_get_next_attr(doc,attr)) {
2581     char *nm;
2582     char *val;
2583
2584     nm  = qs_get_attr_name (doc,attr);
2585     val = qs_get_attr_value(doc,attr);
2586
2587     switch(*nm) {
2588     case 's':
2589     case 'S':
2590       if (strcasecmp(nm, "selected") == 0) {
2591         /*--------------------------------------------------------------------*/
2592         /* CHTML 1.0 version 2.0                                              */
2593         /*--------------------------------------------------------------------*/
2594         selected = apr_pstrdup(doc->buf.pool, val);
2595       }
2596       break;
2597
2598     case 'v':
2599     case 'V':
2600       if (strcasecmp(nm, "value") == 0) {
2601         /*--------------------------------------------------------------------*/
2602         /* CHTML 1.0 version 2.0                                              */
2603         /*--------------------------------------------------------------------*/
2604         value = apr_pstrdup(doc->buf.pool, val);
2605       }
2606       break;
2607
2608     default:
2609       break;
2610     }
2611   }
2612
2613   if (value && *value != 0) {
2614     W10_L(" value=\"");
2615     W10_V(value);
2616     W10_L("\"");
2617   }
2618
2619   if (selected) {
2620     W10_L(" selected");
2621   }
2622
2623   W10_L(">");
2624   return chtml10->out;
2625 }
2626
2627
2628 /**
2629  * It is a handler who processes the OPTION tag.
2630  *
2631  * @param pdoc  [i/o] The pointer to the CHTML structure at the output
2632  *                     destination is specified.
2633  * @param node   [i]   The OPTION tag node is specified.
2634  * @return The conversion result is returned.
2635  */
2636 static char *
2637 s_chtml10_end_option_tag(void *pdoc, Node *UNUSED(child))
2638 {
2639   chtml10_t *chtml10;
2640  
2641   chtml10 = GET_CHTML10(pdoc);
2642
2643   /* Don't close */
2644
2645   return chtml10->out;
2646 }
2647
2648
2649 /**
2650  * It is a handler who processes the DIV tag.
2651  *
2652  * @param pdoc  [i/o] The pointer to the CHTML structure at the output
2653  *                     destination is specified.
2654  * @param node   [i]   The DIV tag node is specified.
2655  * @return The conversion result is returned.
2656  */
2657 static char *
2658 s_chtml10_start_div_tag(void *pdoc, Node *child)
2659 {
2660   chtml10_t *chtml10;
2661   Doc *doc;
2662   request_rec *r;
2663   Attr *attr;
2664
2665   char *align;
2666
2667   chtml10 = GET_CHTML10(pdoc);
2668   doc     = chtml10->doc;
2669   r       = doc->r;
2670
2671   align   = NULL;
2672
2673   W10_L("<div");
2674
2675   for (attr = qs_get_attr(doc,child);
2676        attr;
2677        attr = qs_get_next_attr(doc,attr)) {
2678
2679     char *nm;
2680     char *val;
2681
2682     nm  = qs_get_attr_name(doc,attr);
2683     val = qs_get_attr_value(doc,attr);
2684
2685     if (STRCASEEQ('a','A',"align", nm)) {
2686       /*----------------------------------------------------------------------*/
2687       /* CHTML 1.0 (W3C version 3.2)                                          */
2688       /*----------------------------------------------------------------------*/
2689       if (val && (STRCASEEQ('l','L',"left",val) || STRCASEEQ('r','R',"right",val) || STRCASEEQ('c','C',"center",val))) {
2690         align = apr_pstrdup(doc->buf.pool, val);
2691       }
2692     }
2693   }
2694
2695   if (align) {
2696     W10_L(" align=\"");
2697     W10_V(align);
2698     W10_L("\"");
2699   }
2700
2701   W10_L(">");
2702   return chtml10->out;
2703 }
2704
2705
2706 /**
2707  * It is a handler who processes the DIV tag.
2708  *
2709  * @param pdoc  [i/o] The pointer to the CHTML structure at the output
2710  *                     destination is specified.
2711  * @param node   [i]   The DIV tag node is specified.
2712  * @return The conversion result is returned.
2713  */
2714 static char *
2715 s_chtml10_end_div_tag(void *pdoc, Node *UNUSED(child))
2716 {
2717   chtml10_t *chtml10;
2718   Doc *doc;
2719   request_rec *r;
2720
2721   chtml10 = GET_CHTML10(pdoc);
2722   doc     = chtml10->doc;
2723   r       = doc->r;
2724
2725   W10_L("</div>");
2726   return chtml10->out;
2727 }
2728
2729
2730 /**
2731  * It is a handler who processes the CHXJ:IF tag.
2732  *
2733  * @param pdoc  [i/o] The pointer to the CHTML structure at the output
2734  *                     destination is specified.
2735  * @param node   [i]   The CHXJ:IF tag node is specified.
2736  * @return The conversion result is returned.
2737  */
2738 static char *
2739 s_chtml10_chxjif_tag(void *pdoc, Node *node)
2740 {
2741   chtml10_t *chtml10;
2742   Doc *doc;
2743   Node *child;
2744   request_rec *r;
2745
2746   chtml10 = GET_CHTML10(pdoc);
2747   doc     = chtml10->doc;
2748   r       = doc->r;
2749
2750   for (child = qs_get_child_node(doc, node);
2751        child;
2752        child = qs_get_next_node(doc, child)) {
2753     W10_V(child->otext);
2754     s_chtml10_chxjif_tag(chtml10, child);
2755   }
2756
2757   return chtml10->out;
2758 }
2759
2760
2761 /**
2762  * It is a handler who processes the PRE tag.
2763  *
2764  * @param pdoc  [i/o] The pointer to the XHTML structure at the output
2765  *                     destination is specified.
2766  * @param node   [i]   The PRE tag node is specified.
2767  * @return The conversion result is returned.
2768  */
2769 static char *
2770 s_chtml10_start_pre_tag(void *pdoc, Node *UNUSED(node)) 
2771 {
2772   Doc *doc;
2773   request_rec *r;
2774   chtml10_t *chtml10;
2775
2776   chtml10 = GET_CHTML10(pdoc);
2777   doc     = chtml10->doc;
2778   r       = doc->r;
2779
2780   chtml10->pre_flag++;
2781   W10_L("<pre>");
2782   return chtml10->out;
2783 }
2784
2785
2786 /**
2787  * It is a handler who processes the PRE tag.
2788  *
2789  * @param pdoc  [i/o] The pointer to the XHTML structure at the output
2790  *                     destination is specified.
2791  * @param node   [i]   The PRE tag node is specified.
2792  * @return The conversion result is returned.
2793  */
2794 static char *
2795 s_chtml10_end_pre_tag(void *pdoc, Node *UNUSED(child)) 
2796 {
2797   chtml10_t *chtml10;
2798   Doc *doc;
2799   request_rec *r;
2800
2801   chtml10 = GET_CHTML10(pdoc);
2802   doc     = chtml10->doc;
2803   r       = doc->r;
2804
2805   W10_L("</pre>");
2806   chtml10->pre_flag--;
2807
2808   return chtml10->out;
2809 }
2810
2811
2812 /**
2813  * It is a handler who processes the P tag.
2814  *
2815  * @param pdoc  [i/o] The pointer to the XHTML structure at the output
2816  *                     destination is specified.
2817  * @param node   [i]   The P tag node is specified.
2818  * @return The conversion result is returned.
2819  */
2820 static char *
2821 s_chtml10_start_p_tag(void *pdoc, Node *node) 
2822 {
2823   Doc *doc;
2824   request_rec *r;
2825   chtml10_t *chtml10;
2826   Attr *attr;
2827   char *align = NULL;
2828
2829   chtml10 = GET_CHTML10(pdoc);
2830   doc     = chtml10->doc;
2831   r       = doc->r;
2832
2833   W10_L("<p");
2834   for (attr = qs_get_attr(doc,node);
2835        attr;
2836        attr = qs_get_next_attr(doc,attr)) {
2837     char *nm  = qs_get_attr_name(doc,attr);
2838     char *val = qs_get_attr_value(doc,attr);
2839     if (STRCASEEQ('a','A',"align", nm)) {
2840       /*----------------------------------------------------------------------*/
2841       /* CHTML 1.0 (W3C version 3.2)                                          */
2842       /*----------------------------------------------------------------------*/
2843       if (val && (STRCASEEQ('l','L',"left",val) || STRCASEEQ('r','R',"right",val) || STRCASEEQ('c','C',"center",val))) {
2844         align = apr_pstrdup(doc->buf.pool, val);
2845         break;
2846       }
2847     }
2848   }
2849   if (align) {
2850     W10_L(" align=\"");
2851     W10_V(align);
2852     W10_L("\"");
2853   }
2854
2855   W10_L(">");
2856   return chtml10->out;
2857 }
2858
2859
2860 /**
2861  * It is a handler who processes the P tag.
2862  *
2863  * @param pdoc  [i/o] The pointer to the CHTML structure at the output
2864  *                     destination is specified.
2865  * @param node   [i]   The P tag node is specified.
2866  * @return The conversion result is returned.
2867  */
2868 static char *
2869 s_chtml10_end_p_tag(void *pdoc, Node *UNUSED(child)) 
2870 {
2871   Doc *doc;
2872   request_rec *r;
2873   chtml10_t *chtml10;
2874
2875   chtml10 = GET_CHTML10(pdoc);
2876   doc     = chtml10->doc;
2877   r       = doc->r;
2878
2879   W10_L("</p>");
2880   return chtml10->out;
2881 }
2882
2883
2884 /**
2885  * It is a handler who processes the TEXTARE tag.
2886  *
2887  * @param pdoc  [i/o] The pointer to the CHTML structure at the output
2888  *                     destination is specified.
2889  * @param node   [i]   The TEXTAREA tag node is specified.
2890  * @return The conversion result is returned.
2891  */
2892 static char *
2893 s_chtml10_start_textarea_tag(void *pdoc, Node *node) 
2894 {
2895   Doc *doc;
2896   request_rec *r;
2897   chtml10_t *chtml10;
2898   Attr *attr;
2899
2900   chtml10 = GET_CHTML10(pdoc);
2901   doc     = chtml10->doc;
2902   r       = doc->r;
2903
2904
2905   chtml10->textarea_flag++;
2906
2907   W10_L("<textarea");
2908
2909   for (attr = qs_get_attr(doc,node);
2910        attr;
2911        attr = qs_get_next_attr(doc,attr)) {
2912
2913     char *name;
2914     char *value;
2915
2916     name  = qs_get_attr_name (doc,attr);
2917     value = qs_get_attr_value(doc,attr);
2918
2919     switch(*name) {
2920     case 'a':
2921     case 'A':
2922       if (strcasecmp(name, "accesskey") == 0 && value && *value != 0) {
2923         W10_L(" accesskey=\"");
2924         W10_V(value);
2925         W10_L("\"");
2926       }
2927       break;
2928
2929     case 'n':
2930     case 'N':
2931       if (strcasecmp(name, "name") == 0 && value && *value != 0) {
2932         W10_L(" name=\"");
2933         W10_V(value);
2934         W10_L("\"");
2935       }
2936       break;
2937
2938     case 'r':
2939     case 'R':
2940       if (strcasecmp(name, "rows") == 0 && value && *value != 0) {
2941         W10_L(" rows=\"");
2942         W10_V(value);
2943         W10_L("\"");
2944       }
2945       break;
2946
2947     case 'c':
2948     case 'C':
2949       if (strcasecmp(name, "cols") == 0 && value && *value != 0) {
2950         W10_L(" cols=\"");
2951         W10_V(value);
2952         W10_L("\"");
2953       }
2954       break;
2955     
2956     default:
2957       break;
2958     }
2959   }
2960
2961   W10_L(">");
2962   return chtml10->out;
2963 }
2964
2965
2966 /**
2967  * It is a handler who processes the TEXTAREA tag.
2968  *
2969  * @param pdoc  [i/o] The pointer to the CHTML structure at the output
2970  *                     destination is specified.
2971  * @param node   [i]   The TEXTAREA tag node is specified.
2972  * @return The conversion result is returned.
2973  */
2974 static char *
2975 s_chtml10_end_textarea_tag(void *pdoc, Node *UNUSED(child)) 
2976 {
2977   Doc *doc;
2978   request_rec *r;
2979   chtml10_t *chtml10;
2980
2981   chtml10 = GET_CHTML10(pdoc);
2982   doc     = chtml10->doc;
2983   r       = doc->r;
2984
2985   W10_L("</textarea>");
2986   chtml10->textarea_flag--;
2987
2988   return chtml10->out;
2989 }
2990
2991
2992 static char *
2993 s_chtml10_text(void *pdoc, Node *child)
2994 {
2995   char *textval;
2996   char *tmp;
2997   char *tdst;
2998   char one_byte[2];
2999   int ii;
3000   int tdst_len;
3001   chtml10_t *chtml10;
3002   Doc *doc;
3003   request_rec *r;
3004
3005   chtml10 = GET_CHTML10(pdoc);
3006   doc     = chtml10->doc;
3007   r       = doc->r;
3008
3009   textval = qs_get_node_value(doc,child);
3010   if (strlen(textval) == 0) {
3011     return chtml10->out;
3012   }
3013   
3014   tmp = apr_palloc(r->pool, qs_get_node_size(doc,child)+1);
3015   memset(tmp, 0, qs_get_node_size(doc,child)+1);
3016   
3017   tdst     = qs_alloc_zero_byte_string(r);
3018   memset(one_byte, 0, sizeof(one_byte));
3019   tdst_len = 0;
3020   
3021   for (ii=0; ii<qs_get_node_size(doc,child); ii++) {
3022     char *out;
3023     int   rtn;
3024
3025     rtn = s_chtml10_search_emoji(chtml10, &textval[ii], &out);
3026     if (rtn) {
3027       tdst = qs_out_apr_pstrcat(r, tdst, out, &tdst_len);
3028       ii+=(rtn - 1);
3029       continue;
3030     }
3031   
3032     if (is_sjis_kanji(textval[ii])) {
3033       one_byte[0] = textval[ii+0];
3034       tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
3035       one_byte[0] = textval[ii+1];
3036       tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
3037       ii++;
3038     }
3039     else 
3040     if (chtml10->pre_flag) {
3041       one_byte[0] = textval[ii+0];
3042       tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
3043     }
3044     else 
3045     if (chtml10->textarea_flag) {
3046       one_byte[0] = textval[ii+0];
3047       tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
3048     }
3049     else 
3050     if (textval[ii] != '\r' && textval[ii] != '\n') {
3051       one_byte[0] = textval[ii+0];
3052       tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
3053     }
3054   }
3055
3056   W10_V(tdst);
3057   return chtml10->out;
3058 }
3059
3060
3061 /**
3062  * It is a handler who processes the BLOCKQUOTE tag.
3063  *
3064  * @param pdoc  [i/o] The pointer to the CHTML structure at the output
3065  *                     destination is specified.
3066  * @param node   [i]   The BLOCKQUOTE tag node is specified.
3067  * @return The conversion result is returned.
3068  */
3069 static char *
3070 s_chtml10_start_blockquote_tag(void *pdoc, Node *UNUSED(child))
3071 {
3072   chtml10_t *chtml10;
3073   Doc *doc;
3074   chtml10 = GET_CHTML10(pdoc);
3075   doc     = chtml10->doc;
3076   W10_L("<blockquote>");
3077   return chtml10->out;
3078 }
3079
3080
3081 /**
3082  * It is a handler who processes the BLOCKQUOTE tag.
3083  *
3084  * @param pdoc  [i/o] The pointer to the CHTML structure at the output
3085  *                     destination is specified.
3086  * @param node   [i]   The BLOCKQUOTE tag node is specified.
3087  * @return The conversion result is returned.
3088  */
3089 static char *
3090 s_chtml10_end_blockquote_tag(void *pdoc, Node *UNUSED(child))
3091 {
3092   chtml10_t *chtml10;
3093   Doc *doc;
3094
3095   chtml10 = GET_CHTML10(pdoc);
3096   doc     = chtml10->doc;
3097   W10_L("</blockquote>");
3098   return chtml10->out;
3099 }
3100
3101
3102 /**
3103  * It is a handler who processes the DIR tag.
3104  *
3105  * @param pdoc  [i/o] The pointer to the CHTML structure at the output
3106  *                     destination is specified.
3107  * @param node   [i]   The DIR tag node is specified.
3108  * @return The conversion result is returned.
3109  */
3110 static char *
3111 s_chtml10_start_dir_tag(void *pdoc, Node *UNUSED(child))
3112 {
3113   chtml10_t *chtml10;
3114   Doc *doc;
3115   chtml10 = GET_CHTML10(pdoc);
3116   doc     = chtml10->doc;
3117   W10_L("<dir>");
3118   return chtml10->out;
3119 }
3120
3121
3122 /**
3123  * It is a handler who processes the DIR tag.
3124  *
3125  * @param pdoc  [i/o] The pointer to the CHTML structure at the output
3126  *                     destination is specified.
3127  * @param node   [i]   The DIR tag node is specified.
3128  * @return The conversion result is returned.
3129  */
3130 static char *
3131 s_chtml10_end_dir_tag(void *pdoc, Node *UNUSED(child))
3132 {
3133   chtml10_t *chtml10;
3134   Doc *doc;
3135
3136   chtml10 = GET_CHTML10(pdoc);
3137   doc     = chtml10->doc;
3138   W10_L("</dir>");
3139   return chtml10->out;
3140 }
3141
3142
3143 /**
3144  * It is a handler who processes the DL tag.
3145  *
3146  * @param pdoc  [i/o] The pointer to the CHTML structure at the output
3147  *                     destination is specified.
3148  * @param node   [i]   The DL tag node is specified.
3149  * @return The conversion result is returned.
3150  */
3151 static char *
3152 s_chtml10_start_dl_tag(void *pdoc, Node *UNUSED(child))
3153 {
3154   chtml10_t *chtml10;
3155   Doc *doc;
3156   chtml10 = GET_CHTML10(pdoc);
3157   doc     = chtml10->doc;
3158   W10_L("<dl>");
3159   return chtml10->out;
3160 }
3161
3162
3163 /**
3164  * It is a handler who processes the DL tag.
3165  *
3166  * @param pdoc  [i/o] The pointer to the CHTML structure at the output
3167  *                     destination is specified.
3168  * @param node   [i]   The DL tag node is specified.
3169  * @return The conversion result is returned.
3170  */
3171 static char *
3172 s_chtml10_end_dl_tag(void *pdoc, Node *UNUSED(child))
3173 {
3174   chtml10_t *chtml10;
3175   Doc *doc;
3176   chtml10 = GET_CHTML10(pdoc);
3177   doc     = chtml10->doc;
3178   W10_L("</dl>");
3179   return chtml10->out;
3180 }
3181
3182
3183 /**
3184  * It is a handter who processes the DT tag.
3185  *
3186  * @param pdoc  [i/o] The pointer to the CHTML structure at the output
3187  *                     destination is specified.
3188  * @param node   [i]   The DT tag node is specified.
3189  * @return The conversion result is returned.
3190  */
3191 static char *
3192 s_chtml10_start_dt_tag(void *pdoc, Node *UNUSED(child))
3193 {
3194   chtml10_t *chtml10;
3195   Doc *doc;
3196   chtml10 = GET_CHTML10(pdoc);
3197   doc     = chtml10->doc;
3198   W10_L("<dt>");
3199   return chtml10->out;
3200 }
3201
3202
3203 /**
3204  * It is a handter who processes the DT tag.
3205  *
3206  * @param pdoc  [i/o] The pointer to the CHTML structure at the output
3207  *                     destination is specified.
3208  * @param node   [i]   The DT tag node is specified.
3209  * @return The conversion result is returned.
3210  */
3211 static char *
3212 s_chtml10_end_dt_tag(void *pdoc, Node *UNUSED(child))
3213 {
3214   chtml10_t *chtml10;
3215   chtml10 = GET_CHTML10(pdoc);
3216   return chtml10->out;
3217 }
3218
3219
3220 /**
3221  * It is a handder who processes the DD tag.
3222  *
3223  * @param pdoc  [i/o] The pointer to the CHTML structure at the output
3224  *                     destination is specified.
3225  * @param node   [i]   The DD tag node is specified.
3226  * @return The conversion result is returned.
3227  */
3228 static char *
3229 s_chtml10_start_dd_tag(void *pdoc, Node *UNUSED(child))
3230 {
3231   chtml10_t *chtml10;
3232   Doc *doc;
3233   chtml10 = GET_CHTML10(pdoc);
3234   doc     = chtml10->doc;
3235   W10_L("<dd>");
3236   return chtml10->out;
3237 }
3238
3239
3240 /**
3241  * It is a handder who processes the DD tag.
3242  *
3243  * @param pdoc  [i/o] The pointer to the CHTML structure at the output
3244  *                     destination is specified.
3245  * @param node   [i]   The DD tag node is specified.
3246  * @return The conversion result is returned.
3247  */
3248 static char *
3249 s_chtml10_end_dd_tag(void *pdoc, Node *UNUSED(child))
3250 {
3251   chtml10_t *chtml10;
3252   chtml10 = GET_CHTML10(pdoc);
3253   return chtml10->out;
3254 }
3255
3256
3257 /**
3258  * It is a hanmenuer who processes the MENU tag.
3259  *
3260  * @param pdoc  [i/o] The pointer to the CHTML structure at the output
3261  *                     destination is specified.
3262  * @param node   [i]   The MENU tag node is specified.
3263  * @return The conversion result is returned.
3264  */
3265 static char *
3266 s_chtml10_start_menu_tag(void *pdoc, Node *UNUSED(child))
3267 {
3268   chtml10_t *chtml10;
3269   Doc *doc;
3270   chtml10 = GET_CHTML10(pdoc);
3271   doc     = chtml10->doc;
3272   W10_L("<menu>");
3273   return chtml10->out;
3274 }
3275
3276
3277 /**
3278  * It is a hanmenuer who processes the MENU tag.
3279  *
3280  * @param pdoc  [i/o] The pointer to the CHTML structure at the output
3281  *                     destination is specified.
3282  * @param node   [i]   The MENU tag node is specified.
3283  * @return The conversion result is returned.
3284  */
3285 static char *
3286 s_chtml10_end_menu_tag(void *pdoc, Node *UNUSED(child))
3287 {
3288   chtml10_t *chtml10 = GET_CHTML10(pdoc);
3289   Doc *doc = chtml10->doc;
3290   W10_L("</menu>");
3291   return chtml10->out;
3292 }
3293
3294
3295 /**
3296  * It is a hanplaintexter who processes the PLAINTEXT tag.
3297  *
3298  * @param pdoc  [i/o] The pointer to the CHTML structure at the output
3299  *                     destination is specified.
3300  * @param node   [i]   The PLAINTEXT tag node is specified.
3301  * @return The conversion result is returned.
3302  */
3303 static char *
3304 s_chtml10_start_plaintext_tag(void *pdoc, Node *node)
3305 {
3306   chtml10_t *chtml10;
3307   Doc *doc;
3308
3309   chtml10 = GET_CHTML10(pdoc);
3310   doc     = chtml10->doc;
3311   W10_L("<plaintext>");
3312   s_chtml10_start_plaintext_tag_inner(pdoc,node);
3313   return chtml10->out;
3314 }
3315
3316 static char *
3317 s_chtml10_start_plaintext_tag_inner(void *pdoc, Node *node)
3318 {
3319   chtml10_t *chtml10;
3320   Doc *doc;
3321   Node *child;
3322   chtml10 = GET_CHTML10(pdoc);
3323   doc     = chtml10->doc;
3324   for (child = qs_get_child_node(doc, node);
3325        child;
3326        child = qs_get_next_node(doc, child)) {
3327     W10_V(child->otext);
3328     s_chtml10_start_plaintext_tag_inner(pdoc, child);
3329   }
3330   return chtml10->out;
3331 }
3332
3333
3334 /**
3335  * It is a hanplaintexter who processes the PLAINTEXT tag.
3336  *
3337  * @param pdoc  [i/o] The pointer to the CHTML structure at the output
3338  *                     destination is specified.
3339  * @param node   [i]   The PLAINTEXT tag node is specified.
3340  * @return The conversion result is returned.
3341  */
3342 static char *
3343 s_chtml10_end_plaintext_tag(void *pdoc, Node *UNUSED(child))
3344 {
3345   chtml10_t *chtml10 = GET_CHTML10(pdoc);
3346   return chtml10->out;
3347 }
3348 /*
3349  * vim:ts=2 et
3350  */