OSDN Git Service

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