OSDN Git Service

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