OSDN Git Service

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