OSDN Git Service

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