OSDN Git Service

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