OSDN Git Service

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