OSDN Git Service

* version up for freeBSD
[modchxj/mod_chxj.git] / src / chxj_chtml10.c
index 4ec887e..cc51397 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2005-2008 Atsushi Konno All rights reserved.
+ * Copyright (C) 2005-2011 Atsushi Konno All rights reserved.
  * Copyright (C) 2005 QSDN,Inc. All rights reserved.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
 #include "chxj_cookie.h"
 #include "chxj_encoding.h"
 #include "chxj_buffered_write.h"
-
-#define GET_CHTML10(X) ((chtml10_t*)(X))
-#define W10_L(X)          do { chtml10->out = BUFFERED_WRITE_LITERAL(chtml10->out, &doc->buf, (X)); } while(0)
-#define W10_V(X)          do { chtml10->out = (X) ? BUFFERED_WRITE_VALUE(chtml10->out, &doc->buf, (X))  \
+#include "chxj_str_util.h"
+#include "chxj_header_inf.h"
+#include "chxj_conv_z2h.h"
+
+#define GET_CHTML10(X) ((chtml10_t *)(X))
+#undef W_L
+#undef W_V
+#define W_L(X)          do { chtml10->out = BUFFERED_WRITE_LITERAL(chtml10->out, &doc->buf, (X)); } while(0)
+#define W_V(X)          do { chtml10->out = (X) ? BUFFERED_WRITE_VALUE(chtml10->out, &doc->buf, (X))  \
                                                   : BUFFERED_WRITE_LITERAL(chtml10->out, &doc->buf, ""); } while(0)
 
-static char* s_chtml10_start_html_tag     (void* pdoc, Node* node);
-static char* s_chtml10_end_html_tag       (void* pdoc, Node* node);
-static char* s_chtml10_start_meta_tag     (void* pdoc, Node* node);
-static char* s_chtml10_end_meta_tag       (void* pdoc, Node* node);
-static char* s_chtml10_start_textarea_tag (void* pdoc, Node* node);
-static char* s_chtml10_end_textarea_tag   (void* pdoc, Node* node);
-static char* s_chtml10_start_p_tag        (void* pdoc, Node* node);
-static char* s_chtml10_end_p_tag          (void* pdoc, Node* node);
-static char* s_chtml10_start_pre_tag      (void* pdoc, Node* node);
-static char* s_chtml10_end_pre_tag        (void* pdoc, Node* node);
-static char* s_chtml10_start_ul_tag       (void* pdoc, Node* node);
-static char* s_chtml10_end_ul_tag         (void* pdoc, Node* node);
-static char* s_chtml10_start_li_tag       (void* pdoc, Node* node);
-static char* s_chtml10_end_li_tag         (void* pdoc, Node* node);
-static char* s_chtml10_start_ol_tag       (void* pdoc, Node* node);
-static char* s_chtml10_end_ol_tag         (void* pdoc, Node* node);
-static char* s_chtml10_start_h1_tag       (void* pdoc, Node* node);
-static char* s_chtml10_end_h1_tag         (void* pdoc, Node* node);
-static char* s_chtml10_start_h2_tag       (void* pdoc, Node* node);
-static char* s_chtml10_end_h2_tag         (void* pdoc, Node* node);
-static char* s_chtml10_start_h3_tag       (void* pdoc, Node* node);
-static char* s_chtml10_end_h3_tag         (void* pdoc, Node* node);
-static char* s_chtml10_start_h4_tag       (void* pdoc, Node* node);
-static char* s_chtml10_end_h4_tag         (void* pdoc, Node* node);
-static char* s_chtml10_start_h5_tag       (void* pdoc, Node* node);
-static char* s_chtml10_end_h5_tag         (void* pdoc, Node* node);
-static char* s_chtml10_start_h6_tag       (void* pdoc, Node* node);
-static char* s_chtml10_end_h6_tag         (void* pdoc, Node* node);
-static char* s_chtml10_start_head_tag     (void* pdoc, Node* node);
-static char* s_chtml10_end_head_tag       (void* pdoc, Node* node);
-static char* s_chtml10_start_title_tag    (void* pdoc, Node* node);
-static char* s_chtml10_end_title_tag      (void* pdoc, Node* node);
-static char* s_chtml10_start_base_tag     (void* pdoc, Node* node);
-static char* s_chtml10_end_base_tag       (void* pdoc, Node* node);
-static char* s_chtml10_start_body_tag     (void* pdoc, Node* node);
-static char* s_chtml10_end_body_tag       (void* pdoc, Node* node);
-static char* s_chtml10_start_a_tag        (void* pdoc, Node* node);
-static char* s_chtml10_end_a_tag          (void* pdoc, Node* node);
-static char* s_chtml10_start_br_tag       (void* pdoc, Node* node);
-static char* s_chtml10_end_br_tag         (void* pdoc, Node* node);
-static char* s_chtml10_start_tr_tag       (void* pdoc, Node* node);
-static char* s_chtml10_end_tr_tag         (void* pdoc, Node* node);
-static char* s_chtml10_start_font_tag     (void* pdoc, Node* node);
-static char* s_chtml10_end_font_tag       (void* pdoc, Node* node);
-static char* s_chtml10_start_input_tag    (void* pdoc, Node* node);
-static char* s_chtml10_end_input_tag      (void* pdoc, Node* node);
-static char* s_chtml10_start_form_tag     (void* pdoc, Node* node);
-static char* s_chtml10_end_form_tag       (void* pdoc, Node* node);
-static char* s_chtml10_start_center_tag   (void* pdoc, Node* node);
-static char* s_chtml10_end_center_tag     (void* pdoc, Node* node);
-static char* s_chtml10_start_hr_tag       (void* pdoc, Node* node);
-static char* s_chtml10_end_hr_tag         (void* pdoc, Node* node);
-static char* s_chtml10_start_img_tag      (void* pdoc, Node* node);
-static char* s_chtml10_end_img_tag        (void* pdoc, Node* node);
-static char* s_chtml10_start_select_tag   (void* pdoc, Node* node);
-static char* s_chtml10_end_select_tag     (void* pdoc, Node* node);
-static char* s_chtml10_start_option_tag   (void* pdoc, Node* node);
-static char* s_chtml10_end_option_tag     (void* pdoc, Node* node);
-static char* s_chtml10_start_div_tag      (void* pdoc, Node* node);
-static char* s_chtml10_end_div_tag        (void* pdoc, Node* node);
-static char* s_chtml10_start_blockquote_tag      (void* pdoc, Node* node);
-static char* s_chtml10_end_blockquote_tag        (void* pdoc, Node* node);
-static char* s_chtml10_start_dir_tag      (void* pdoc, Node* node);
-static char* s_chtml10_end_dir_tag        (void* pdoc, Node* node);
-static char* s_chtml10_start_dl_tag       (void* pdoc, Node* node);
-static char* s_chtml10_end_dl_tag         (void* pdoc, Node* node);
-static char* s_chtml10_start_dt_tag       (void* pdoc, Node* node);
-static char* s_chtml10_end_dt_tag         (void* pdoc, Node* node);
-static char* s_chtml10_start_dd_tag       (void* pdoc, Node* node);
-static char* s_chtml10_end_dd_tag         (void* pdoc, Node* node);
-
-static void  s_init_chtml10(chtml10_t* chtml, Doc* doc, request_rec* r, device_table* spec);
-
-static int   s_chtml10_search_emoji(chtml10_t* chtml, char* txt, char** rslt);
-static char* s_chtml10_chxjif_tag        (void* pdoc, Node* node);
-static char* s_chtml10_text              (void* pdoc, Node* node);
+#undef W_NLCODE
+#define W_NLCODE()     do { char *nlcode = TO_NLCODE(chtml10->conf); W_V(nlcode); } while (0)
+
+static char *s_chtml10_start_html_tag     (void *pdoc, Node *node);
+static char *s_chtml10_end_html_tag       (void *pdoc, Node *node);
+static char *s_chtml10_start_meta_tag     (void *pdoc, Node *node);
+static char *s_chtml10_end_meta_tag       (void *pdoc, Node *node);
+static char *s_chtml10_start_textarea_tag (void *pdoc, Node *node);
+static char *s_chtml10_end_textarea_tag   (void *pdoc, Node *node);
+static char *s_chtml10_start_p_tag        (void *pdoc, Node *node);
+static char *s_chtml10_end_p_tag          (void *pdoc, Node *node);
+static char *s_chtml10_start_pre_tag      (void *pdoc, Node *node);
+static char *s_chtml10_end_pre_tag        (void *pdoc, Node *node);
+static char *s_chtml10_start_ul_tag       (void *pdoc, Node *node);
+static char *s_chtml10_end_ul_tag         (void *pdoc, Node *node);
+static char *s_chtml10_start_li_tag       (void *pdoc, Node *node);
+static char *s_chtml10_end_li_tag         (void *pdoc, Node *node);
+static char *s_chtml10_start_ol_tag       (void *pdoc, Node *node);
+static char *s_chtml10_end_ol_tag         (void *pdoc, Node *node);
+static char *s_chtml10_start_h1_tag       (void *pdoc, Node *node);
+static char *s_chtml10_end_h1_tag         (void *pdoc, Node *node);
+static char *s_chtml10_start_h2_tag       (void *pdoc, Node *node);
+static char *s_chtml10_end_h2_tag         (void *pdoc, Node *node);
+static char *s_chtml10_start_h3_tag       (void *pdoc, Node *node);
+static char *s_chtml10_end_h3_tag         (void *pdoc, Node *node);
+static char *s_chtml10_start_h4_tag       (void *pdoc, Node *node);
+static char *s_chtml10_end_h4_tag         (void *pdoc, Node *node);
+static char *s_chtml10_start_h5_tag       (void *pdoc, Node *node);
+static char *s_chtml10_end_h5_tag         (void *pdoc, Node *node);
+static char *s_chtml10_start_h6_tag       (void *pdoc, Node *node);
+static char *s_chtml10_end_h6_tag         (void *pdoc, Node *node);
+static char *s_chtml10_start_head_tag     (void *pdoc, Node *node);
+static char *s_chtml10_end_head_tag       (void *pdoc, Node *node);
+static char *s_chtml10_start_title_tag    (void *pdoc, Node *node);
+static char *s_chtml10_end_title_tag      (void *pdoc, Node *node);
+static char *s_chtml10_start_base_tag     (void *pdoc, Node *node);
+static char *s_chtml10_end_base_tag       (void *pdoc, Node *node);
+static char *s_chtml10_start_body_tag     (void *pdoc, Node *node);
+static char *s_chtml10_end_body_tag       (void *pdoc, Node *node);
+static char *s_chtml10_start_a_tag        (void *pdoc, Node *node);
+static char *s_chtml10_end_a_tag          (void *pdoc, Node *node);
+static char *s_chtml10_start_br_tag       (void *pdoc, Node *node);
+static char *s_chtml10_end_br_tag         (void *pdoc, Node *node);
+static char *s_chtml10_start_tr_tag       (void *pdoc, Node *node);
+static char *s_chtml10_end_tr_tag         (void *pdoc, Node *node);
+static char *s_chtml10_start_font_tag     (void *pdoc, Node *node);
+static char *s_chtml10_end_font_tag       (void *pdoc, Node *node);
+static char *s_chtml10_start_input_tag    (void *pdoc, Node *node);
+static char *s_chtml10_end_input_tag      (void *pdoc, Node *node);
+static char *s_chtml10_start_form_tag     (void *pdoc, Node *node);
+static char *s_chtml10_end_form_tag       (void *pdoc, Node *node);
+static char *s_chtml10_start_center_tag   (void *pdoc, Node *node);
+static char *s_chtml10_end_center_tag     (void *pdoc, Node *node);
+static char *s_chtml10_start_hr_tag       (void *pdoc, Node *node);
+static char *s_chtml10_end_hr_tag         (void *pdoc, Node *node);
+static char *s_chtml10_start_img_tag      (void *pdoc, Node *node);
+static char *s_chtml10_end_img_tag        (void *pdoc, Node *node);
+static char *s_chtml10_start_select_tag   (void *pdoc, Node *node);
+static char *s_chtml10_end_select_tag     (void *pdoc, Node *node);
+static char *s_chtml10_start_option_tag   (void *pdoc, Node *node);
+static char *s_chtml10_end_option_tag     (void *pdoc, Node *node);
+static char *s_chtml10_start_div_tag      (void *pdoc, Node *node);
+static char *s_chtml10_end_div_tag        (void *pdoc, Node *node);
+static char *s_chtml10_start_blockquote_tag(void *pdoc, Node *node);
+static char *s_chtml10_end_blockquote_tag (void *pdoc, Node *node);
+static char *s_chtml10_start_dir_tag      (void *pdoc, Node *node);
+static char *s_chtml10_end_dir_tag        (void *pdoc, Node *node);
+static char *s_chtml10_start_dl_tag       (void *pdoc, Node *node);
+static char *s_chtml10_end_dl_tag         (void *pdoc, Node *node);
+static char *s_chtml10_start_dt_tag       (void *pdoc, Node *node);
+static char *s_chtml10_end_dt_tag         (void *pdoc, Node *node);
+static char *s_chtml10_start_dd_tag       (void *pdoc, Node *node);
+static char *s_chtml10_end_dd_tag         (void *pdoc, Node *node);
+static char *s_chtml10_start_menu_tag     (void *pdoc, Node *node);
+static char *s_chtml10_end_menu_tag       (void *pdoc, Node *node);
+static char *s_chtml10_start_plaintext_tag(void *pdoc, Node *node);
+static char *s_chtml10_start_plaintext_tag_inner(void  *pdoc, Node *node);
+static char *s_chtml10_end_plaintext_tag  (void *pdoc, Node *node);
+static char *s_chtml10_newline_mark       (void *pdoc, Node *node);
+
+static void  s_init_chtml10(chtml10_t *chtml, Doc *doc, request_rec *r, device_table *spec);
+
+static int   s_chtml10_search_emoji(chtml10_t *chtml, char *txt, char **rslt);
+static char *s_chtml10_chxjif_tag        (void *pdoc, Node *node);
+static char *s_chtml10_text              (void *pdoc, Node *node);
 
 tag_handler chtml10_handler[] = {
   /* tagHTML */
@@ -276,6 +290,11 @@ tag_handler chtml10_handler[] = {
     s_chtml10_chxjif_tag,
     NULL,
   },
+  /* tagCHXJRAW */
+  {
+    s_chtml10_chxjif_tag,
+    NULL,
+  },
   /* tagNOBR */
   {
     NULL,
@@ -351,6 +370,31 @@ tag_handler chtml10_handler[] = {
     s_chtml10_start_dd_tag,
     s_chtml10_end_dd_tag,
   },
+  /* tagMENU */
+  {
+    s_chtml10_start_menu_tag,
+    s_chtml10_end_menu_tag,
+  },
+  /* tagPLAINTEXT */
+  {
+    s_chtml10_start_plaintext_tag,
+    s_chtml10_end_plaintext_tag,
+  },
+  /* tagBLINK */
+  {
+    NULL,
+    NULL,
+  },
+  /* tagMARQUEE */
+  {
+    NULL,
+    NULL,
+  },
+  /* tagNLMARK */
+  {
+    s_chtml10_newline_mark,
+    NULL,
+  },
 };
 
 
@@ -363,19 +407,19 @@ tag_handler chtml10_handler[] = {
  * @param src   [i]   The character string before the converting is appointed.
  * @return The character string after the converting is returned.
  */
-char*
-chxj_exchange_chtml10(
-  request_rec*        r,
-  device_table*       spec,
-  const char*         src,
+char *
+chxj_convert_chtml10(
+  request_rec         *r,
+  device_table        *spec,
+  const char          *src,
   apr_size_t          srclen,
-  apr_size_t*         dstlen,
-  chxjconvrule_entryentryp,
+  apr_size_t          *dstlen,
+  chxjconvrule_entry  *entryp,
   cookie_t*           cookie
 )
 {
-  char*     dst;
-  char*     ss;
+  char      *dst;
+  char      *ss;
   chtml10_t chtml10;
   Doc       doc;
   apr_time_t t;
@@ -383,7 +427,7 @@ chxj_exchange_chtml10(
   dst = NULL;
 
   t = apr_time_now();
-  DBG(r, "start chxj_exchange_chtml10() cookie_id=[%s]", (cookie) ? cookie->cookie_id : "");
+  DBG(r, "REQ[%X] start %s() cookie_id=[%s]", TO_ADDR(r),__func__, (cookie) ? cookie->cookie_id : "");
 
   /*--------------------------------------------------------------------------*/
   /* If qrcode xml                                                            */
@@ -391,10 +435,11 @@ chxj_exchange_chtml10(
   *dstlen = srclen;
   dst = chxj_qr_code_blob_handler(r, src, (size_t*)dstlen);
   if (dst) {
-    DBG(r,"i found qrcode xml");
+    DBG(r, "REQ[%X] found qrcode xml", TO_ADDR(r));
+    DBG(r, "REQ[%X] end %s()",TO_ADDR(r),__func__);
     return dst;
   }
-  DBG(r,"not found qrcode xml");
+  DBG(r,"REQ[%X] not found qrcode xml", TO_ADDR(r));
 
   /*--------------------------------------------------------------------------*/
   /* The CHTML structure is initialized.                                      */
@@ -403,7 +448,7 @@ chxj_exchange_chtml10(
   chtml10.entryp    = entryp;
   chtml10.cookie    = cookie;
 
-  chxj_set_content_type(r, "text/html; charset=Windows-31J");
+  chxj_set_content_type(r, chxj_header_inf_set_content_type(r, "text/html; charset=Windows-31J"));
 
   /*--------------------------------------------------------------------------*/
   /* The character string of the input is analyzed.                           */
@@ -425,7 +470,7 @@ chxj_exchange_chtml10(
   /*--------------------------------------------------------------------------*/
   /* It converts it from CHTML to CHTML.                                      */
   /*--------------------------------------------------------------------------*/
-  chxj_node_exchange(spec,r,(void*)&chtml10, &doc, qs_get_root(&doc), 0);
+  chxj_node_convert(spec,r,(void *)&chtml10, &doc, qs_get_root(&doc), 0);
   chtml10.out = chxj_buffered_write_flush(chtml10.out, &doc.buf);
   dst = apr_pstrdup(r->pool, chtml10.out);
   chxj_buffered_write_terminate(&doc.buf);
@@ -433,6 +478,7 @@ chxj_exchange_chtml10(
   qs_all_free(&doc,QX_LOGMARK);
 
   if (!dst) {
+    DBG(r, "REQ[%X] end %s()",TO_ADDR(r),__func__);
     return apr_pstrdup(r->pool,ss);
   }
 
@@ -445,7 +491,8 @@ chxj_exchange_chtml10(
   chxj_dump_out("[dst] CHTML -> CHTML1.0", dst, *dstlen);
 #endif
 
-  DBG(r, "end   chxj_exchange_chtml10() cookie_id=[%s] time=[%lld]", (cookie) ? cookie->cookie_id : "", apr_time_now() - t);
+  DBG(r, "REQ[%X] cookie_id=[%s] time=[%" APR_TIME_T_FMT "]", TO_ADDR(r),(cookie) ? cookie->cookie_id : "", apr_time_now() - t);
+  DBG(r, "REQ[%X] end %s()",TO_ADDR(r),__func__);
 
   return dst;
 }
@@ -463,10 +510,10 @@ chxj_exchange_chtml10(
  */
 static void
 s_init_chtml10(
-  chtml10_t*    chtml10, 
-  Doc*          doc, 
-  request_rec*  r, 
-  device_tablespec)
+  chtml10_t     *chtml10, 
+  Doc           *doc, 
+  request_rec   *r, 
+  device_table  *spec)
 {
   memset(doc,     0, sizeof(Doc));
   memset(chtml10, 0, sizeof(chtml10_t));
@@ -474,7 +521,7 @@ s_init_chtml10(
   doc->r      = r;
   chtml10->doc  = doc;
   chtml10->spec = spec;
-  chtml10->out  = qs_alloc_zero_byte_string(r);
+  chtml10->out  = qs_alloc_zero_byte_string(r->pool);
   chtml10->conf = chxj_get_module_config(r->per_dir_config, &chxj_module);
   chtml10->doc->parse_mode = PARSE_MODE_CHTML;
 }
@@ -492,11 +539,11 @@ s_init_chtml10(
  * @return When corresponding EMOJI exists, it returns it excluding 0. 
  */
 static int
-s_chtml10_search_emoji(chtml10_t* chtml10, char* txt, char** rslt)
+s_chtml10_search_emoji(chtml10_t *chtml10, char *txt, char **rslt)
 {
-  emoji_t*      ee;
-  request_rec*  r;
-  device_tablespec;
+  emoji_t       *ee;
+  request_rec   *r;
+  device_table  *spec;
   int           len;
 
   spec = chtml10->spec;
@@ -505,7 +552,7 @@ s_chtml10_search_emoji(chtml10_t* chtml10, char* txt, char** rslt)
   r = chtml10->doc->r;
 
   if (!spec) {
-    DBG(r,"spec is NULL");
+    DBG(r,"REQ[%X] spec is NULL", TO_ADDR(r));
   }
 
   for (ee = chtml10->conf->emoji;
@@ -513,7 +560,7 @@ s_chtml10_search_emoji(chtml10_t* chtml10, char* txt, char** rslt)
        ee = ee->next) {
 
     if (!ee->imode) {
-      DBG(r,"emoji->imode is NULL");
+      DBG(r,"REQ[%X] emoji->imode is NULL", TO_ADDR(r));
       continue;
     }
 
@@ -522,20 +569,77 @@ s_chtml10_search_emoji(chtml10_t* chtml10, char* txt, char** rslt)
     &&  strlen(ee->imode->string) > 0
     &&  *ee->imode->string == *txt
     &&  strncasecmp(ee->imode->string, txt, strlen(ee->imode->string)) == 0) {
-      if (!spec || !spec->emoji_type) {
-        *rslt = apr_palloc(r->pool, 3);
-        (*rslt)[0] = ee->imode->hex1byte & 0xff;
-        (*rslt)[1] = ee->imode->hex2byte & 0xff;
-        (*rslt)[2] = 0;
-        return strlen(ee->imode->string);
-      }
-
-      return 0;
+      *rslt = apr_palloc(r->pool, 3);
+      (*rslt)[0] = ee->imode->hex1byte & 0xff;
+      (*rslt)[1] = ee->imode->hex2byte & 0xff;
+      (*rslt)[2] = 0;
+      return strlen(ee->imode->string);
     }
   }
   return 0;
 }
 
+char *
+chxj_chtml10_emoji_only_converter(request_rec *r, device_table *spec, const char *src, apr_size_t len)
+{
+  apr_size_t ii;
+  Doc __doc;
+  Doc *doc;
+  chtml10_t __chtml10;
+  chtml10_t *chtml10;
+  char one_byte[2];
+  char two_byte[3];
+  apr_pool_t *pool;
+
+  chtml10 = &__chtml10;
+  doc     = &__doc;
+
+  DBG(r, "REQ[%X] start %s()", TO_ADDR(r),__func__);
+  memset(doc,     0, sizeof(Doc));
+  memset(chtml10, 0, sizeof(chtml10_t));
+
+  doc->r        = r;
+  chtml10->doc  = doc;
+  chtml10->spec = spec;
+  chtml10->out  = qs_alloc_zero_byte_string(r->pool);
+  chtml10->conf = chxj_get_module_config(r->per_dir_config, &chxj_module);
+  chtml10->doc->parse_mode = PARSE_MODE_CHTML;
+
+  apr_pool_create(&pool, r->pool);
+
+  chxj_buffered_write_init(pool, &doc->buf);
+
+  for (ii=0; ii<len; ii++) {
+    char *out;
+    int   rtn;
+
+    rtn = s_chtml10_search_emoji(chtml10, (char *)&src[ii], &out);
+    if (rtn) {
+      W_V(out);
+      ii+=(rtn - 1);
+      continue;
+    }
+  
+    if (is_sjis_kanji(src[ii])) {
+      two_byte[0] = src[ii+0];
+      two_byte[1] = src[ii+1];
+      two_byte[2] = 0;
+      W_V(two_byte);
+      ii++;
+    }
+    else {
+      one_byte[0] = src[ii+0];
+      one_byte[1] = 0;
+      W_V(one_byte);
+    }
+  }
+
+  chtml10->out = chxj_buffered_write_flush(chtml10->out, &doc->buf);
+
+  DBG(r, "REQ[%X] end %s()", TO_ADDR(r),__func__);
+  return chtml10->out;
+}
+
 
 /**
  * It is a handler who processes the HTML tag.
@@ -545,12 +649,12 @@ s_chtml10_search_emoji(chtml10_t* chtml10, char* txt, char** rslt)
  * @param node   [i]   The HTML tag node is specified.
  * @return The conversion result is returned.
  */
-static char*
-s_chtml10_start_html_tag(void* pdoc, Node* UNUSED(node)) 
+static char *
+s_chtml10_start_html_tag(void *pdoc, Node *UNUSED(node)) 
 {
-  Doc*          doc;
-  request_rec*  r;
-  chtml10_t*    chtml10;
+  Doc           *doc;
+  request_rec   *r;
+  chtml10_t     *chtml10;
 
   chtml10 = GET_CHTML10(pdoc);
   doc     = chtml10->doc;
@@ -559,8 +663,7 @@ s_chtml10_start_html_tag(void* pdoc, Node* UNUSED(node))
   /*--------------------------------------------------------------------------*/
   /* start HTML tag                                                           */
   /*--------------------------------------------------------------------------*/
-  W10_L("<html>");
-
+  W_L("<html>");
   return chtml10->out;
 }
 
@@ -573,20 +676,19 @@ s_chtml10_start_html_tag(void* pdoc, Node* UNUSED(node))
  * @param node   [i]   The HTML tag node is specified.
  * @return The conversion result is returned.
  */
-static char*
-s_chtml10_end_html_tag(void* pdoc, Node* UNUSED(child)) 
+static char *
+s_chtml10_end_html_tag(void *pdoc, Node *UNUSED(child)) 
 {
-  Doc*          doc;
-  request_rec*  r;
-  chtml10_t*    chtml10;
+  Doc           *doc;
+  request_rec   *r;
+  chtml10_t     *chtml10;
 
   
   chtml10 = GET_CHTML10(pdoc);
   doc     = chtml10->doc;
   r       = doc->r;
 
-  W10_L("</html>");
-
+  W_L("</html>");
   return chtml10->out;
 }
 
@@ -599,12 +701,10 @@ s_chtml10_end_html_tag(void* pdoc, Node* UNUSED(child))
  * @param node   [i]   The META tag node is specified.
  * @return The conversion result is returned.
  */
-static char*
-s_chtml10_start_meta_tag(void* pdoc, Node* UNUSED(node)) 
+static char *
+s_chtml10_start_meta_tag(void *pdoc, Node *UNUSED(node)) 
 {
-  chtml10_t* chtml10;
-
-  chtml10 = GET_CHTML10(pdoc);
+  chtml10_t *chtml10 = GET_CHTML10(pdoc);
 
   /* ignore */
 
@@ -620,12 +720,10 @@ s_chtml10_start_meta_tag(void* pdoc, Node* UNUSED(node))
  * @param node   [i]   The META tag node is specified.
  * @return The conversion result is returned.
  */
-static char*
-s_chtml10_end_meta_tag(void* pdoc, Node* UNUSED(child)) 
+static char *
+s_chtml10_end_meta_tag(void *pdoc, Node *UNUSED(child)) 
 {
-  chtml10_t* chtml10;
-
-  chtml10 = GET_CHTML10(pdoc);
+  chtml10_t *chtml10 = GET_CHTML10(pdoc);
 
   return chtml10->out;
 }
@@ -639,18 +737,18 @@ s_chtml10_end_meta_tag(void* pdoc, Node* UNUSED(child))
  * @param node   [i]   The HEAD tag node is specified.
  * @return The conversion result is returned.
  */
-static char*
-s_chtml10_start_head_tag(void* pdoc, Node* UNUSED(node)) 
+static char *
+s_chtml10_start_head_tag(void *pdoc, Node *UNUSED(node)) 
 {
-  Doc*          doc;
-  request_rec*  r;
-  chtml10_t*    chtml10;
+  Doc           *doc;
+  request_rec   *r;
+  chtml10_t     *chtml10;
 
   chtml10 = GET_CHTML10(pdoc);
   doc     = chtml10->doc;
   r       = doc->r;
 
-  W10_L("<head>");
+  W_L("<head>");
 
   return chtml10->out;
 }
@@ -664,18 +762,18 @@ s_chtml10_start_head_tag(void* pdoc, Node* UNUSED(node))
  * @param node   [i]   The HEAD tag node is specified.
  * @return The conversion result is returned.
  */
-static char*
-s_chtml10_end_head_tag(void* pdoc, Node* UNUSED(child)) 
+static char *
+s_chtml10_end_head_tag(void *pdoc, Node *UNUSED(child)) 
 {
-  Doc*          doc;
-  request_rec*  r;
-  chtml10_t*    chtml10;
+  Doc           *doc;
+  request_rec   *r;
+  chtml10_t     *chtml10;
 
   chtml10 = GET_CHTML10(pdoc);
   doc     = chtml10->doc;
   r       = doc->r;
 
-  W10_L("</head>");
+  W_L("</head>");
 
   return chtml10->out;
 }
@@ -689,18 +787,18 @@ s_chtml10_end_head_tag(void* pdoc, Node* UNUSED(child))
  * @param node   [i]   The OL tag node is specified.
  * @return The conversion result is returned.
  */
-static char*
-s_chtml10_start_ol_tag(void* pdoc, Node* UNUSED(node)) 
+static char *
+s_chtml10_start_ol_tag(void *pdoc, Node *UNUSED(node)) 
 {
-  Doc*          doc;
-  request_rec*  r;
-  chtml10_t*    chtml10;
+  Doc           *doc;
+  request_rec   *r;
+  chtml10_t     *chtml10;
 
   chtml10 = GET_CHTML10(pdoc);
   doc     = chtml10->doc;
   r       = doc->r;
 
-  W10_L("<ol>\r\n");
+  W_L("<ol>");
 
   return chtml10->out;
 }
@@ -714,18 +812,18 @@ s_chtml10_start_ol_tag(void* pdoc, Node* UNUSED(node))
  * @param node   [i]   The OL tag node is specified.
  * @return The conversion result is returned.
  */
-static char*
-s_chtml10_end_ol_tag(void* pdoc, Node* UNUSED(child)) 
+static char *
+s_chtml10_end_ol_tag(void *pdoc, Node *UNUSED(child)) 
 {
-  Doc*          doc;
-  request_rec*  r;
-  chtml10_t*    chtml10;
+  Doc           *doc;
+  request_rec   *r;
+  chtml10_t     *chtml10;
 
   chtml10 = GET_CHTML10(pdoc);
   doc     = chtml10->doc;
   r       = doc->r;
 
-  W10_L("</ol>\r\n");
+  W_L("</ol>");
 
   return chtml10->out;
 }
@@ -739,18 +837,18 @@ s_chtml10_end_ol_tag(void* pdoc, Node* UNUSED(child))
  * @param node   [i]   The UL tag node is specified.
  * @return The conversion result is returned.
  */
-static char*
-s_chtml10_start_ul_tag(void* pdoc, Node* UNUSED(node)) 
+static char *
+s_chtml10_start_ul_tag(void *pdoc, Node *UNUSED(node)) 
 {
-  Doc*          doc;
-  request_rec*  r;
-  chtml10_t*    chtml10;
+  Doc           *doc;
+  request_rec   *r;
+  chtml10_t     *chtml10;
 
   chtml10    = GET_CHTML10(pdoc);
   doc        = chtml10->doc;
   r          = doc->r;
 
-  W10_L("<ul>\r\n");
+  W_L("<ul>");
 
   return chtml10->out;
 }
@@ -764,18 +862,18 @@ s_chtml10_start_ul_tag(void* pdoc, Node* UNUSED(node))
  * @param node   [i]   The UL tag node is specified.
  * @return The conversion result is returned.
  */
-static char*
-s_chtml10_end_ul_tag(void* pdoc, Node* UNUSED(child)) 
+static char *
+s_chtml10_end_ul_tag(void *pdoc, Node *UNUSED(child)) 
 {
-  Doc*          doc;
-  request_rec*  r;
-  chtml10_t*    chtml10;
+  Doc           *doc;
+  request_rec   *r;
+  chtml10_t     *chtml10;
 
   chtml10 = GET_CHTML10(pdoc);
   doc     = chtml10->doc;
   r       = doc->r;
 
-  W10_L("</ul>\r\n");
+  W_L("</ul>");
 
   return chtml10->out;
 }
@@ -789,18 +887,18 @@ s_chtml10_end_ul_tag(void* pdoc, Node* UNUSED(child))
  * @param node   [i]   The LI tag node is specified.
  * @return The conversion result is returned.
  */
-static char*
-s_chtml10_start_li_tag(void* pdoc, Node* UNUSED(node)) 
+static char *
+s_chtml10_start_li_tag(void *pdoc, Node *UNUSED(node)) 
 {
-  Doc*          doc;
-  request_rec*  r;
-  chtml10_t*    chtml10;
+  Doc           *doc;
+  request_rec   *r;
+  chtml10_t     *chtml10;
 
   chtml10 = GET_CHTML10(pdoc);
   doc     = chtml10->doc;
   r       = doc->r;
 
-  W10_L("<li>");
+  W_L("<li>");
 
   return chtml10->out;
 }
@@ -814,11 +912,10 @@ s_chtml10_start_li_tag(void* pdoc, Node* UNUSED(node))
  * @param node   [i]   The LI tag node is specified.
  * @return The conversion result is returned.
  */
-static char*
-s_chtml10_end_li_tag(void* pdoc, Node* UNUSED(child)) 
+static char *
+s_chtml10_end_li_tag(void *pdoc, Node *UNUSED(child)) 
 {
-  chtml10_t*    chtml10;
-  chtml10 = GET_CHTML10(pdoc);
+  chtml10_t  *chtml10 = GET_CHTML10(pdoc);
   return chtml10->out;
 }
 
@@ -831,36 +928,34 @@ s_chtml10_end_li_tag(void* pdoc, Node* UNUSED(child))
  * @param node   [i]   The H1 tag node is specified.
  * @return The conversion result is returned.
  */
-static char*
-s_chtml10_start_h1_tag(void* pdoc, Node* node) 
+static char *
+s_chtml10_start_h1_tag(void *pdoc, Node *node) 
 {
-  Doc*          doc;
-  request_rec*  r;
-  Attr*         attr;
-  chtml10_t*    chtml10;
+  Doc           *doc;
+  request_rec   *r;
+  Attr          *attr;
+  chtml10_t     *chtml10;
 
   chtml10 = GET_CHTML10(pdoc);
   doc     = chtml10->doc;
   r       = doc->r;
 
-  W10_L("<h1");
+  W_L("<h1");
   for (attr = qs_get_attr(doc,node);
        attr;
        attr = qs_get_next_attr(doc,attr)) {
-    char* name;
-    char* value;
-    name  = qs_get_attr_name(doc,attr);
-    value = qs_get_attr_value(doc,attr);
+    char *name  = qs_get_attr_name(doc,attr);
+    char *value = qs_get_attr_value(doc,attr);
     if (STRCASEEQ('a','A',"align", name)) {
       if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
-        W10_L(" align=\"");
-        W10_V(value);
-        W10_L("\"");
+        W_L(" align=\"");
+        W_V(value);
+        W_L("\"");
         break;
       }
     }
   }
-  W10_L(">");
+  W_L(">");
 
   return chtml10->out;
 }
@@ -874,18 +969,18 @@ s_chtml10_start_h1_tag(void* pdoc, Node* node)
  * @param node   [i]   The H1 tag node is specified.
  * @return The conversion result is returned.
  */
-static char*
-s_chtml10_end_h1_tag(void* pdoc, Node* UNUSED(child)) 
+static char *
+s_chtml10_end_h1_tag(void *pdoc, Node *UNUSED(child)) 
 {
-  Doc*          doc;
-  request_rec*  r;
-  chtml10_t*    chtml10;
+  Doc           *doc;
+  request_rec   *r;
+  chtml10_t     *chtml10;
 
   chtml10 = GET_CHTML10(pdoc);
   doc     = chtml10->doc;
   r       = doc->r;
 
-  W10_L("</h1>");
+  W_L("</h1>");
 
   return chtml10->out;
 }
@@ -899,36 +994,32 @@ s_chtml10_end_h1_tag(void* pdoc, Node* UNUSED(child))
  * @param node   [i]   The H2 tag node is specified.
  * @return The conversion result is returned.
  */
-static char*
+static char *
 s_chtml10_start_h2_tag(void *pdoc, Node *node) 
 {
   Doc           *doc;
   Attr          *attr;
-  request_rec   *r;
   chtml10_t     *chtml10;
 
   chtml10 = GET_CHTML10(pdoc);
   doc     = chtml10->doc;
-  r       = doc->r;
 
-  W10_L("<h2");
+  W_L("<h2");
   for (attr = qs_get_attr(doc,node);
        attr;
        attr = qs_get_next_attr(doc,attr)) {
-    char* name;
-    char* value;
-    name  = qs_get_attr_name(doc,attr);
-    value = qs_get_attr_value(doc,attr);
+    char *name  = qs_get_attr_name(doc,attr);
+    char *value = qs_get_attr_value(doc,attr);
     if (STRCASEEQ('a','A',"align", name)) {
       if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
-        W10_L(" align=\"");
-        W10_V(value);
-        W10_L("\"");
+        W_L(" align=\"");
+        W_V(value);
+        W_L("\"");
         break;
       }
     }
   }
-  W10_L(">");
+  W_L(">");
 
   return chtml10->out;
 }
@@ -942,18 +1033,18 @@ s_chtml10_start_h2_tag(void *pdoc, Node *node)
  * @param node   [i]   The H2 tag node is specified.
  * @return The conversion result is returned.
  */
-static char*
-s_chtml10_end_h2_tag(void* pdoc, Node* UNUSED(child)) 
+static char *
+s_chtml10_end_h2_tag(void *pdoc, Node *UNUSED(child)) 
 {
-  Doc*          doc;
-  request_rec*  r;
-  chtml10_t*    chtml10;
+  Doc           *doc;
+  request_rec   *r;
+  chtml10_t     *chtml10;
 
   chtml10 = GET_CHTML10(pdoc);
   doc     = chtml10->doc;
   r       = doc->r;
 
-  W10_L("</h2>");
+  W_L("</h2>");
 
   return chtml10->out;
 }
@@ -979,24 +1070,22 @@ s_chtml10_start_h3_tag(void *pdoc, Node *node)
   doc     = chtml10->doc;
   r       = doc->r;
 
-  W10_L("<h3");
+  W_L("<h3");
   for (attr = qs_get_attr(doc,node);
        attr;
        attr = qs_get_next_attr(doc,attr)) {
-    char* name;
-    char* value;
-    name  = qs_get_attr_name(doc,attr);
-    value = qs_get_attr_value(doc,attr);
+    char *name  = qs_get_attr_name(doc,attr);
+    char *value = qs_get_attr_value(doc,attr);
     if (STRCASEEQ('a','A',"align", name)) {
       if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
-        W10_L(" align=\"");
-        W10_V(value);
-        W10_L("\"");
+        W_L(" align=\"");
+        W_V(value);
+        W_L("\"");
         break;
       }
     }
   }
-  W10_L(">");
+  W_L(">");
 
   return chtml10->out;
 }
@@ -1010,18 +1099,18 @@ s_chtml10_start_h3_tag(void *pdoc, Node *node)
  * @param node   [i]   The H3 tag node is specified.
  * @return The conversion result is returned.
  */
-static char*
-s_chtml10_end_h3_tag(void* pdoc, Node* UNUSED(child)) 
+static char *
+s_chtml10_end_h3_tag(void *pdoc, Node *UNUSED(child)) 
 {
-  chtml10_t*    chtml10;
-  Doc*          doc;
-  request_rec*  r;
+  chtml10_t     *chtml10;
+  Doc           *doc;
+  request_rec   *r;
 
   chtml10 = GET_CHTML10(pdoc);
   doc     = chtml10->doc;
   r       = doc->r;
 
-  W10_L("</h3>");
+  W_L("</h3>");
 
   return chtml10->out;
 }
@@ -1041,30 +1130,26 @@ s_chtml10_start_h4_tag(void *pdoc, Node *node)
   chtml10_t     *chtml10;
   Attr          *attr;
   Doc           *doc;
-  request_rec   *r;
 
   chtml10 = GET_CHTML10(pdoc);
   doc     = chtml10->doc;
-  r       = doc->r;
 
-  W10_L("<h4");
+  W_L("<h4");
   for (attr = qs_get_attr(doc,node);
        attr;
        attr = qs_get_next_attr(doc,attr)) {
-    char* name;
-    char* value;
-    name  = qs_get_attr_name(doc,attr);
-    value = qs_get_attr_value(doc,attr);
+    char *name  = qs_get_attr_name(doc,attr);
+    char *value = qs_get_attr_value(doc,attr);
     if (STRCASEEQ('a','A',"align", name)) {
       if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
-        W10_L(" align=\"");
-        W10_V(value);
-        W10_L("\"");
+        W_L(" align=\"");
+        W_V(value);
+        W_L("\"");
         break;
       }
     }
   }
-  W10_L(">");
+  W_L(">");
 
   return chtml10->out;
 }
@@ -1078,18 +1163,16 @@ s_chtml10_start_h4_tag(void *pdoc, Node *node)
  * @param node   [i]   The H4 tag node is specified.
  * @return The conversion result is returned.
  */
-static char*
-s_chtml10_end_h4_tag(void* pdoc, Node* UNUSED(child)) 
+static char *
+s_chtml10_end_h4_tag(void *pdoc, Node *UNUSED(child)) 
 {
-  Doc*          doc;
-  request_rec*  r;
-  chtml10_t*    chtml10;
+  Doc           *doc;
+  chtml10_t     *chtml10;
 
   chtml10  = GET_CHTML10(pdoc);
   doc      = chtml10->doc;
-  r        = doc->r;
 
-  W10_L("</h4>");
+  W_L("</h4>");
 
   return chtml10->out;
 }
@@ -1106,7 +1189,7 @@ s_chtml10_end_h4_tag(void* pdoc, Node* UNUSED(child))
 static char *
 s_chtml10_start_h5_tag(void *pdoc, Node *node) 
 {
-  Doc           *doc;
+  Doc          *doc;
   request_rec  *r;
   chtml10_t    *chtml10;
   Attr         *attr;
@@ -1115,24 +1198,22 @@ s_chtml10_start_h5_tag(void *pdoc, Node *node)
   doc     = chtml10->doc;
   r       = doc->r;
 
-  W10_L("<h5");
+  W_L("<h5");
   for (attr = qs_get_attr(doc,node);
        attr;
        attr = qs_get_next_attr(doc,attr)) {
-    char* name;
-    char* value;
-    name  = qs_get_attr_name(doc,attr);
-    value = qs_get_attr_value(doc,attr);
+    char *name  = qs_get_attr_name(doc,attr);
+    char *value = qs_get_attr_value(doc,attr);
     if (STRCASEEQ('a','A',"align", name)) {
       if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
-        W10_L(" align=\"");
-        W10_V(value);
-        W10_L("\"");
+        W_L(" align=\"");
+        W_V(value);
+        W_L("\"");
         break;
       }
     }
   }
-  W10_L(">");
+  W_L(">");
 
   return chtml10->out;
 }
@@ -1146,18 +1227,16 @@ s_chtml10_start_h5_tag(void *pdoc, Node *node)
  * @param node   [i]   The H5 tag node is specified.
  * @return The conversion result is returned.
  */
-static char*
-s_chtml10_end_h5_tag(void* pdoc, Node* UNUSED(child)) 
+static char *
+s_chtml10_end_h5_tag(void *pdoc, Node *UNUSED(child)) 
 {
-  Doc*          doc;
-  request_rec*  r;
-  chtml10_t*    chtml10;
+  Doc           *doc;
+  chtml10_t     *chtml10;
 
   chtml10 = GET_CHTML10(pdoc);
   doc     = chtml10->doc;
-  r       = doc->r;
 
-  W10_L("</h5>");
+  W_L("</h5>");
 
   return chtml10->out;
 }
@@ -1175,32 +1254,28 @@ static char *
 s_chtml10_start_h6_tag(void *pdoc, Node *node)
 {
   Doc           *doc;
-  request_rec   *r;
   chtml10_t     *chtml10;
   Attr          *attr;
 
   chtml10 = GET_CHTML10(pdoc);
   doc     = chtml10->doc;
-  r       = doc->r;
 
-  W10_L("<h6");
+  W_L("<h6");
   for (attr = qs_get_attr(doc,node);
        attr;
        attr = qs_get_next_attr(doc,attr)) {
-    char* name;
-    char* value;
-    name  = qs_get_attr_name(doc,attr);
-    value = qs_get_attr_value(doc,attr);
+    char *name  = qs_get_attr_name(doc,attr);
+    char *value = qs_get_attr_value(doc,attr);
     if (STRCASEEQ('a','A',"align", name)) {
       if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
-        W10_L(" align=\"");
-        W10_V(value);
-        W10_L("\"");
+        W_L(" align=\"");
+        W_V(value);
+        W_L("\"");
         break;
       }
     }
   }
-  W10_L(">");
+  W_L(">");
 
   return chtml10->out;
 }
@@ -1217,15 +1292,13 @@ s_chtml10_start_h6_tag(void *pdoc, Node *node)
 static char *
 s_chtml10_end_h6_tag(void *pdoc, Node *UNUSED(child)) 
 {
-  Doc*          doc;
-  request_rec*  r;
-  chtml10_t*    chtml10;
+  Doc           *doc;
+  chtml10_t     *chtml10;
 
   chtml10 = GET_CHTML10(pdoc);
   doc     = chtml10->doc;
-  r       = doc->r;
 
-  W10_L("</h6>");
+  W_L("</h6>");
 
   return chtml10->out;
 }
@@ -1239,18 +1312,16 @@ s_chtml10_end_h6_tag(void *pdoc, Node *UNUSED(child))
  * @param node   [i]   The TITLE tag node is specified.
  * @return The conversion result is returned.
  */
-static char*
-s_chtml10_start_title_tag(void* pdoc, Node* UNUSED(node)) 
+static char *
+s_chtml10_start_title_tag(void *pdoc, Node *UNUSED(node)) 
 {
-  Doc*         doc;
-  request_rec* r;
-  chtml10_t*   chtml10;
+  Doc          *doc;
+  chtml10_t    *chtml10;
 
   chtml10 = GET_CHTML10(pdoc);
   doc     = chtml10->doc;
-  r       = doc->r;
 
-  W10_L("<title>");
+  W_L("<title>");
 
   return chtml10->out;
 }
@@ -1264,18 +1335,16 @@ s_chtml10_start_title_tag(void* pdoc, Node* UNUSED(node))
  * @param node   [i]   The TITLE tag node is specified.
  * @return The conversion result is returned.
  */
-static char*
-s_chtml10_end_title_tag(void* pdoc, Node* UNUSED(child)) 
+static char *
+s_chtml10_end_title_tag(void *pdoc, Node *UNUSED(child)) 
 {
-  Doc*          doc;
-  request_rec*  r;
-  chtml10_t*    chtml10;
+  Doc           *doc;
+  chtml10_t     *chtml10;
 
   chtml10 = GET_CHTML10(pdoc);
   doc     = chtml10->doc;
-  r       = doc->r;
 
-  W10_L("</title>");
+  W_L("</title>");
 
   return chtml10->out;
 }
@@ -1289,40 +1358,33 @@ s_chtml10_end_title_tag(void* pdoc, Node* UNUSED(child))
  * @param node   [i]   The BASE tag node is specified.
  * @return The conversion result is returned.
  */
-static char*
-s_chtml10_start_base_tag(void* pdoc, Node* node) 
+static char *
+s_chtml10_start_base_tag(void *pdoc, Node *node) 
 {
-  Attr*         attr;
-  chtml10_t*    chtml10;
-  Doc*          doc;
-  request_rec*  r;
+  Attr          *attr;
+  chtml10_t     *chtml10;
+  Doc           *doc;
 
   chtml10 = GET_CHTML10(pdoc);
   doc     = chtml10->doc;
-  r       = doc->r;
   
-  W10_L("<base");
-
+  W_L("<base");
   /*--------------------------------------------------------------------------*/
   /* Get Attributes                                                           */
   /*--------------------------------------------------------------------------*/
   for (attr = qs_get_attr(doc,node);
        attr;
        attr = qs_get_next_attr(doc,attr)) {
-    char* name;
-    char* value;
-
-    name  = qs_get_attr_name(doc,attr);
-    value = qs_get_attr_value(doc,attr);
-
+    char *name  = qs_get_attr_name(doc,attr);
+    char *value = qs_get_attr_value(doc,attr);
     if (STRCASEEQ('h','H',"href", name)) {
-      W10_L(" href=\"");
-      W10_V(value);
-      W10_L("\"");
+      W_L(" href=\"");
+      W_V(value);
+      W_L("\"");
     }
   }
 
-  W10_L(">");
+  W_L(">");
 
   return chtml10->out;
 }
@@ -1336,10 +1398,10 @@ s_chtml10_start_base_tag(void* pdoc, Node* node)
  * @param node   [i]   The BASE tag node is specified.
  * @return The conversion result is returned.
  */
-static char*
-s_chtml10_end_base_tag(void* pdoc, Node* UNUSED(child)) 
+static char *
+s_chtml10_end_base_tag(void *pdoc, Node *UNUSED(child)) 
 {
-  chtml10_tchtml10 = GET_CHTML10(pdoc);
+  chtml10_t *chtml10 = GET_CHTML10(pdoc);
 
   return chtml10->out;
 }
@@ -1353,32 +1415,24 @@ s_chtml10_end_base_tag(void* pdoc, Node* UNUSED(child))
  * @param node   [i]   The BODY tag node is specified.
  * @return The conversion result is returned.
  */
-static char*
-s_chtml10_start_body_tag(void* pdoc, Node* node) 
+static char *
+s_chtml10_start_body_tag(void *pdoc, Node *node) 
 {
-  chtml10_t*   chtml10;
-  Doc*         doc;
-  request_rec* r;
-  Attr*        attr;
+  chtml10_t    *chtml10;
+  Doc          *doc;
+  Attr         *attr;
 
   chtml10 = GET_CHTML10(pdoc);
   doc     = chtml10->doc;
-  r       = doc->r;
-
-
-  W10_L("<body");
 
+  W_L("<body");
   /*--------------------------------------------------------------------------*/
   /* Get Attributes                                                           */
   /*--------------------------------------------------------------------------*/
   for (attr = qs_get_attr(doc,node);
        attr;
        attr = qs_get_next_attr(doc,attr)) {
-
-    char* name;
-
-    name  = qs_get_attr_name(doc,attr);
-
+    char *name  = qs_get_attr_name(doc,attr);
     switch(*name) {
     case 'a':
     case 'A':
@@ -1435,7 +1489,7 @@ s_chtml10_start_body_tag(void* pdoc, Node* node)
     }
   }
 
-  W10_L(">");
+  W_L(">");
 
   return chtml10->out;
 }
@@ -1449,18 +1503,16 @@ s_chtml10_start_body_tag(void* pdoc, Node* node)
  * @param node   [i]   The BODY tag node is specified.
  * @return The conversion result is returned.
  */
-static char*
-s_chtml10_end_body_tag(void* pdoc, Node* UNUSED(child)) 
+static char *
+s_chtml10_end_body_tag(void *pdoc, Node *UNUSED(child)) 
 {
-  Doc*          doc;
-  request_rec*  r;
-  chtml10_t*    chtml10;
+  Doc           *doc;
+  chtml10_t     *chtml10;
 
   chtml10 = GET_CHTML10(pdoc);
   doc     = chtml10->doc;
-  r       = doc->r;
 
-  W10_L("</body>");
+  W_L("</body>");
 
   return chtml10->out;
 }
@@ -1486,7 +1538,7 @@ s_chtml10_start_a_tag(void *pdoc, Node *node)
   doc     = chtml10->doc;
   r       = doc->r;
 
-  W10_L("<a");
+  W_L("<a");
 
   /*--------------------------------------------------------------------------*/
   /* Get Attributes                                                           */
@@ -1494,13 +1546,8 @@ s_chtml10_start_a_tag(void *pdoc, Node *node)
   for (attr = qs_get_attr(doc,node);
        attr; 
        attr = qs_get_next_attr(doc,attr)) {
-
-    char *name;
-    char *value;
-
-    name  = qs_get_attr_name(doc,attr);
-    value = qs_get_attr_value(doc,attr);
-
+    char *name  = qs_get_attr_name(doc,attr);
+    char *value = qs_get_attr_value(doc,attr);
     switch(*name) {
     case 'n':
     case 'N':
@@ -1508,9 +1555,9 @@ s_chtml10_start_a_tag(void *pdoc, Node *node)
         /*--------------------------------------------------------------------*/
         /* CHTML1.0                                                           */
         /*--------------------------------------------------------------------*/
-        W10_L(" name=\"");
-        W10_V(value);
-        W10_L("\"");
+        W_L(" name=\"");
+        W_V(value);
+        W_L("\"");
       }
       break;
 
@@ -1521,10 +1568,12 @@ s_chtml10_start_a_tag(void *pdoc, Node *node)
         /* CHTML1.0                                                           */
         /*--------------------------------------------------------------------*/
         value = chxj_encoding_parameter(r, value);
-        value = chxj_add_cookie_parameter(r, value, chtml10->cookie);
-        W10_L(" href=\"");
-        W10_V(value);
-        W10_L("\"");
+        if (! chxj_starts_with(value, "mailto:") && ! chxj_starts_with(value, "tel:")) {
+          value = chxj_add_cookie_parameter(r, value, chtml10->cookie);
+        }
+        W_L(" href=\"");
+        W_V(value);
+        W_L("\"");
       }
       break;
 
@@ -1534,9 +1583,9 @@ s_chtml10_start_a_tag(void *pdoc, Node *node)
         /*--------------------------------------------------------------------*/
         /* CHTML1.0                                                           */
         /*--------------------------------------------------------------------*/
-        W10_L(" accesskey=\"");
-        W10_V(value);
-        W10_L("\"");
+        W_L(" accesskey=\"");
+        W_V(value);
+        W_L("\"");
       }
       break;
 
@@ -1633,7 +1682,7 @@ s_chtml10_start_a_tag(void *pdoc, Node *node)
     }
   }
 
-  W10_L(">");
+  W_L(">");
   return chtml10->out;
 }
 
@@ -1657,7 +1706,8 @@ s_chtml10_end_a_tag(void *pdoc, Node *UNUSED(child))
   doc     = chtml10->doc;
   r       = doc->r;
 
-  W10_L("</a>");
+  W_L("</a>");
+
   return chtml10->out;
 }
 
@@ -1682,7 +1732,7 @@ s_chtml10_start_br_tag(void *pdoc, Node *node)
   doc     = chtml10->doc;
   r       = doc->r;
 
-  W10_L("<br");
+  W_L("<br");
 
   /*--------------------------------------------------------------------------*/
   /* Get Attributes                                                           */
@@ -1690,21 +1740,18 @@ s_chtml10_start_br_tag(void *pdoc, Node *node)
   for (attr = qs_get_attr(doc,node);
        attr;
        attr = qs_get_next_attr(doc,attr)) {
-    char *name;
-    char *value;
-
-    name  = qs_get_attr_name(doc,attr);
-    value = qs_get_attr_value(doc,attr);
-
+    char *name  = qs_get_attr_name(doc,attr);
+    char *value = qs_get_attr_value(doc,attr);
     if (STRCASEEQ('c','C',"clear",name)) {
       if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('a','A',"all",value))) {
-        W10_L(" clear=\"");
-        W10_V(value);
-        W10_L("\"");
+        W_L(" clear=\"");
+        W_V(value);
+        W_L("\"");
       }
     }
   }
-  W10_L(">");
+  W_L(">");
+
   return chtml10->out;
 }
 
@@ -1762,7 +1809,7 @@ s_chtml10_end_tr_tag(void *pdoc, Node *UNUSED(child))
   doc     = chtml10->doc;
   r       = doc->r;
 
-  W10_L("<br>\r\n");
+  W_L("<br>");
 
   return chtml10->out;
 }
@@ -1821,12 +1868,14 @@ s_chtml10_start_form_tag(void *pdoc, Node *node)
   Doc          *doc;
   request_rec  *r;
   Attr         *attr;
+  char         *new_hidden_tag = NULL;
+  char         *attr_value = NULL;
+  char         *attr_method = NULL;
 
   chtml10 = GET_CHTML10(pdoc);
   doc     = chtml10->doc;
   r       = doc->r;
 
-  W10_L("<form");
 
   /*--------------------------------------------------------------------------*/
   /* Get Attributes                                                           */
@@ -1834,12 +1883,8 @@ s_chtml10_start_form_tag(void *pdoc, Node *node)
   for (attr = qs_get_attr(doc,node);
        attr;
        attr = qs_get_next_attr(doc,attr)) {
-    char *name;
-    char *value;
-
-    name  = qs_get_attr_name(doc,attr);
-    value = qs_get_attr_value(doc,attr);
-
+    char *name  = qs_get_attr_name(doc,attr);
+    char *value = qs_get_attr_value(doc,attr);
     switch(*name) {
     case 'a':
     case 'A':
@@ -1847,12 +1892,8 @@ s_chtml10_start_form_tag(void *pdoc, Node *node)
         /*--------------------------------------------------------------------*/
         /* CHTML 1.0                                                          */
         /*--------------------------------------------------------------------*/
-        value = chxj_encoding_parameter(r, value);
-        value = chxj_add_cookie_parameter(r, value, chtml10->cookie);
-  
-        W10_L(" action=\"");
-        W10_V(value);
-        W10_L("\"");
+        attr_value = chxj_encoding_parameter(r, value);
+        attr_value = chxj_add_cookie_parameter(r, attr_value, chtml10->cookie);
       }
       break;
 
@@ -1862,9 +1903,7 @@ s_chtml10_start_form_tag(void *pdoc, Node *node)
         /*--------------------------------------------------------------------*/
         /* CHTML 1.0                                                          */
         /*--------------------------------------------------------------------*/
-        W10_L(" method=\"");
-        W10_V(value);
-        W10_L("\"");
+        attr_method = apr_pstrdup(doc->pool, value);
       }
       break;
 
@@ -1883,7 +1922,36 @@ s_chtml10_start_form_tag(void *pdoc, Node *node)
     }
   }
 
-  W10_L(">");
+  int post_flag = (attr_method && strcasecmp(attr_method, "post") == 0) ? 1 : 0;
+
+  W_L("<form");
+  if (attr_value) {
+    char *q;
+    char *new_query_string = NULL;
+    q = strchr(attr_value, '?');
+    if (q) {
+      new_hidden_tag = chxj_form_action_to_hidden_tag(r, doc->pool, attr_value, 0, post_flag, &new_query_string, CHXJ_TRUE, CHXJ_FALSE, chtml10->entryp);
+      if (new_hidden_tag || new_query_string) {
+        *q = 0;
+      }
+    }
+    W_L(" action=\"");
+    W_V(attr_value);
+    if (new_query_string) {
+      W_L("?");
+      W_V(new_query_string);
+    }
+    W_L("\"");
+  }
+  if (attr_method) {
+    W_L(" method=\"");
+    W_V(attr_method);
+    W_L("\"");
+  }
+  W_L(">");
+  if (new_hidden_tag) {
+    W_V(new_hidden_tag);
+  }
 
   return chtml10->out;
 }
@@ -1897,18 +1965,18 @@ s_chtml10_start_form_tag(void *pdoc, Node *node)
  * @param node   [i]   The FORM tag node is specified.
  * @return The conversion result is returned.
  */
-static char*
-s_chtml10_end_form_tag(void* pdoc, Node* UNUSED(child)) 
+static char *
+s_chtml10_end_form_tag(void *pdoc, Node *UNUSED(child)) 
 {
-  chtml10_t*   chtml10;
-  Doc*         doc;
-  request_recr;
+  chtml10_t    *chtml10;
+  Doc          *doc;
+  request_rec  *r;
 
   chtml10 = GET_CHTML10(pdoc);
   doc     = chtml10->doc;
   r       = doc->r;
 
-  W10_L("</form>");
+  W_L("</form>");
 
   return chtml10->out;
 }
@@ -1922,20 +1990,20 @@ s_chtml10_end_form_tag(void* pdoc, Node* UNUSED(child))
  * @param node   [i]   The INPUT tag node is specified.
  * @return The conversion result is returned.
  */
-static char*
-s_chtml10_start_input_tag(void* pdoc, Node* node) 
+static char *
+s_chtml10_start_input_tag(void *pdoc, Node *node) 
 {
-  chtml10_t*    chtml10;
-  Doc*          doc;
-  request_rec*  r;
-  char*         max_length;
-  char*         type;
-  char*         name;
-  char*         value;
-  char*         istyle;
-  char*         size;
-  char*         checked;
-  char*         accesskey;
+  chtml10_t     *chtml10;
+  Doc           *doc;
+  request_rec   *r;
+  char          *max_length;
+  char          *type;
+  char          *name;
+  char          *value;
+  char          *istyle;
+  char          *size;
+  char          *checked;
+  char          *accesskey;
 
   chtml10     = GET_CHTML10(pdoc);
   doc         = chtml10->doc;
@@ -1950,49 +2018,63 @@ s_chtml10_start_input_tag(void* pdoc, Node* node)
   checked     = NULL;
   accesskey   = NULL;
 
-  W10_L("<input");
+  W_L("<input");
 
   /*--------------------------------------------------------------------------*/
   /* Get Attributes                                                           */
   /*--------------------------------------------------------------------------*/
 
-  type       = qs_get_type_attr(doc, node, r);
-  name       = qs_get_name_attr(doc, node, r);
-  value      = qs_get_value_attr(doc,node,r);
-  istyle     = qs_get_istyle_attr(doc,node,r);
-  max_length = qs_get_maxlength_attr(doc,node,r);
-  checked    = qs_get_checked_attr(doc,node,r);
-  accesskey  = qs_get_accesskey_attr(doc, node, r);
-  size       = qs_get_size_attr(doc, node, r);
+  type       = qs_get_type_attr(doc, node, doc->buf.pool);
+  name       = qs_get_name_attr(doc, node, doc->buf.pool);
+  value      = qs_get_value_attr(doc,node,doc->buf.pool);
+  istyle     = qs_get_istyle_attr(doc,node,doc->buf.pool);
+  max_length = qs_get_maxlength_attr(doc,node,doc->buf.pool);
+  checked    = qs_get_checked_attr(doc,node,doc->buf.pool);
+  accesskey  = qs_get_accesskey_attr(doc, node, doc->buf.pool);
+  size       = qs_get_size_attr(doc, node, doc->buf.pool);
 
   if (type) {
-    W10_L(" type=\"");
-    W10_V(type);
-    W10_L("\"");
+    type = qs_trim_string(doc->buf.pool, type);
+    if (type && (STRCASEEQ('t','T',"text",    type) ||
+                 STRCASEEQ('p','P',"password",type) ||
+                 STRCASEEQ('c','C',"checkbox",type) ||
+                 STRCASEEQ('r','R',"radio",   type) ||
+                 STRCASEEQ('h','H',"hidden",  type) ||
+                 STRCASEEQ('s','S',"submit",  type) ||
+                 STRCASEEQ('r','R',"reset",   type))) {
+      W_L(" type=\"");
+      W_V(type);
+      W_L("\"");
+    }
   }
 
-  if (size) {
-    W10_L(" size=\"");
-    W10_V(size);
-    W10_L("\"");
+  if (size && *size != 0) {
+    W_L(" size=\"");
+    W_V(size);
+    W_L("\"");
   }
 
-  if (name) {
-    W10_L(" name=\"");
-    W10_V(name);
-    W10_L("\"");
+  if (name && *name != 0) {
+    W_L(" name=\"");
+    W_V(name);
+    W_L("\"");
   }
 
-  if (value) {
-    W10_L(" value=\"");
-    W10_V(value);
-    W10_L("\" ");
+  if (value && *value != 0) {
+    if (type && (STRCASEEQ('s','S',"submit",type) || STRCASEEQ('r','R',"reset",type))) {
+      apr_size_t value_len = strlen(value);
+      value = chxj_conv_z2h(r, value, &value_len, chtml10->entryp);
+    }
+
+    W_L(" value=\"");
+    W_V(chxj_add_slash_to_doublequote(doc->pool, value));
+    W_L("\"");
   }
 
-  if (accesskey) {
-    W10_L(" accesskey=\"");
-    W10_V(accesskey);
-    W10_L("\" ");
+  if (accesskey && *accesskey != 0) {
+    W_L(" accesskey=\"");
+    W_V(accesskey);
+    W_L("\"");
   }
 
   if (istyle) {
@@ -2004,17 +2086,17 @@ s_chtml10_start_input_tag(void* pdoc, Node* node)
   /*--------------------------------------------------------------------------*/
   /* The figure is default for the password.                                  */
   /*--------------------------------------------------------------------------*/
-  if (max_length) {
-    W10_L(" maxlength=\"");
-    W10_V(max_length);
-    W10_L("\"");
+  if (max_length && *max_length != 0) {
+    W_L(" maxlength=\"");
+    W_V(max_length);
+    W_L("\"");
   }
 
   if (checked) {
-    W10_L(" checked ");
+    W_L(" checked");
   }
 
-  W10_L(" >");
+  W_L(">");
   return chtml10->out;
 }
 
@@ -2027,10 +2109,10 @@ s_chtml10_start_input_tag(void* pdoc, Node* node)
  * @param node   [i]   The INPUT tag node is specified.
  * @return The conversion result is returned.
  */
-static char*
-s_chtml10_end_input_tag(void* pdoc, Node* UNUSED(child)) 
+static char *
+s_chtml10_end_input_tag(void *pdoc, Node *UNUSED(child)) 
 {
-  chtml10_tchtml10 = GET_CHTML10(pdoc);
+  chtml10_t *chtml10 = GET_CHTML10(pdoc);
 
   return chtml10->out;
 }
@@ -2044,18 +2126,18 @@ s_chtml10_end_input_tag(void* pdoc, Node* UNUSED(child))
  * @param node   [i]   The CENTER tag node is specified.
  * @return The conversion result is returned.
  */
-static char*
-s_chtml10_start_center_tag(void* pdoc, Node* UNUSED(node)) 
+static char *
+s_chtml10_start_center_tag(void *pdoc, Node *UNUSED(node)) 
 {
-  chtml10_t*   chtml10;
-  Doc*         doc;
-  request_recr;
+  chtml10_t    *chtml10;
+  Doc          *doc;
+  request_rec  *r;
 
   chtml10 = GET_CHTML10(pdoc);
   doc     = chtml10->doc;
   r       = doc->r;
 
-  W10_L("<center>");
+  W_L("<center>");
 
   return chtml10->out;
 }
@@ -2069,18 +2151,18 @@ s_chtml10_start_center_tag(void* pdoc, Node* UNUSED(node))
  * @param node   [i]   The CENTER tag node is specified.
  * @return The conversion result is returned.
  */
-static char*
-s_chtml10_end_center_tag(void* pdoc, Node* UNUSED(child)) 
+static char *
+s_chtml10_end_center_tag(void *pdoc, Node *UNUSED(child)) 
 {
-  chtml10_t*    chtml10;
-  Doc*          doc;
-  request_rec*  r;
+  chtml10_t     *chtml10;
+  Doc           *doc;
+  request_rec   *r;
 
   chtml10 = GET_CHTML10(pdoc);
   doc     = chtml10->doc;
   r       = doc->r;
 
-  W10_L("</center>");
+  W_L("</center>");
 
   return chtml10->out;
 }
@@ -2094,30 +2176,25 @@ s_chtml10_end_center_tag(void* pdoc, Node* UNUSED(child))
  * @param node   [i]   The HR tag node is specified.
  * @return The conversion result is returned.
  */
-static char*
-s_chtml10_start_hr_tag(void* pdoc, Node* node) 
+static char *
+s_chtml10_start_hr_tag(void *pdoc, Node *node) 
 {
-  chtml10_t*   chtml10;
-  Doc*         doc;
-  request_recr;
-  Attr*        attr;
+  chtml10_t    *chtml10;
+  Doc          *doc;
+  request_rec  *r;
+  Attr         *attr;
 
   chtml10 = GET_CHTML10(pdoc);
   doc     = chtml10->doc;
   r       = doc->r;
 
-  W10_L("<hr");
+  W_L("<hr");
  
   for (attr = qs_get_attr(doc,node);
        attr; 
        attr = qs_get_next_attr(doc,attr)) {
-
-    char* name;
-    char* value;
-
-    name  = qs_get_attr_name (doc,attr);
-    value = qs_get_attr_value(doc,attr);
-
+    char *name  = qs_get_attr_name (doc,attr);
+    char *value = qs_get_attr_value(doc,attr);
     switch(*name) {
     case 'a':
     case 'A':
@@ -2126,9 +2203,9 @@ s_chtml10_start_hr_tag(void* pdoc, Node* node)
         /* CHTML 1.0                                                          */
         /*--------------------------------------------------------------------*/
         if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
-          W10_L(" align=\"");
-          W10_V(value);
-          W10_L("\"");
+          W_L(" align=\"");
+          W_V(value);
+          W_L("\"");
         }
       }
       break;
@@ -2140,9 +2217,9 @@ s_chtml10_start_hr_tag(void* pdoc, Node* node)
         /* CHTML 1.0                                                          */
         /*--------------------------------------------------------------------*/
         if (value && value[0] != '\0') {
-          W10_L(" size=\"");
-          W10_V(value);
-          W10_L("\"");
+          W_L(" size=\"");
+          W_V(value);
+          W_L("\"");
         }
       }
       break;
@@ -2154,9 +2231,9 @@ s_chtml10_start_hr_tag(void* pdoc, Node* node)
         /* CHTML 1.0                                                          */
         /*--------------------------------------------------------------------*/
         if (value && value[0] != '\0') {
-          W10_L(" width=\"");
-          W10_V(value);
-          W10_L("\"");
+          W_L(" width=\"");
+          W_V(value);
+          W_L("\"");
         }
       }
       break;
@@ -2167,7 +2244,7 @@ s_chtml10_start_hr_tag(void* pdoc, Node* node)
         /*--------------------------------------------------------------------*/
         /* CHTML 1.0                                                          */
         /*--------------------------------------------------------------------*/
-        W10_L(" noshade");
+        W_L(" noshade");
       }
       break;
 
@@ -2185,7 +2262,7 @@ s_chtml10_start_hr_tag(void* pdoc, Node* node)
       break;
     }
   }
-  W10_L(">");
+  W_L(">");
   return chtml10->out;
 }
 
@@ -2198,12 +2275,11 @@ s_chtml10_start_hr_tag(void* pdoc, Node* node)
  * @param node   [i]   The HR tag node is specified.
  * @return The conversion result is returned.
  */
-static char*
-s_chtml10_end_hr_tag(void* pdoc, Node* UNUSED(child)) 
+static char *
+s_chtml10_end_hr_tag(void *pdoc, Node *UNUSED(child)) 
 {
-  chtml10_t* chtml10;
+  chtml10_t *chtml10 = GET_CHTML10(pdoc);
 
-  chtml10 = GET_CHTML10(pdoc);
 
   return chtml10->out;
 }
@@ -2217,13 +2293,13 @@ s_chtml10_end_hr_tag(void* pdoc, Node* UNUSED(child))
  * @param node   [i]   The IMG tag node is specified.
  * @return The conversion result is returned.
  */
-static char*
-s_chtml10_start_img_tag(void* pdoc, Node* node) 
+static char *
+s_chtml10_start_img_tag(void *pdoc, Node *node) 
 {
-  chtml10_t*   chtml10;
-  Doc*         doc;
-  request_recr;
-  Attr*        attr;
+  chtml10_t    *chtml10;
+  Doc          *doc;
+  request_rec  *r;
+  Attr         *attr;
 #ifndef IMG_NOT_CONVERT_FILENAME
   device_table *spec;
 #endif
@@ -2235,20 +2311,15 @@ s_chtml10_start_img_tag(void* pdoc, Node* node)
   doc     = chtml10->doc;
   r       = doc->r;
 
-  W10_L("<img");
+  W_L("<img");
   /*--------------------------------------------------------------------------*/
   /* Get Attributes                                                           */
   /*--------------------------------------------------------------------------*/
   for (attr = qs_get_attr(doc,node);
        attr;
        attr = qs_get_next_attr(doc,attr)) {
-
-    char* name;
-    char* value;
-
-    name  = qs_get_attr_name (doc,attr);
-    value = qs_get_attr_value(doc,attr);
-
+    char *name  = qs_get_attr_name (doc,attr);
+    char *value = qs_get_attr_value(doc,attr);
     switch(*name) {
     case 's':
     case 'S':
@@ -2259,30 +2330,18 @@ s_chtml10_start_img_tag(void* pdoc, Node* node)
 #ifdef IMG_NOT_CONVERT_FILENAME
         value = chxj_encoding_parameter(r, value);
         value = chxj_add_cookie_parameter(r, value, chtml10->cookie);
-        if (value) {
-          value = apr_psprintf(r->pool, 
-                               "%s%c%s=true", 
-                               value, 
-                               (strchr(value, '?')) ? '&' : '?',
-                               CHXJ_COOKIE_NOUPDATE_PARAM);
-        }
-        W10_L(" src=\"");
-        W10_V(value);
-        W10_L("\"");
+        value = chxj_add_cookie_no_update_parameter(r, value);
+        W_L(" src=\"");
+        W_V(value);
+        W_L("\"");
 #else
         value = chxj_img_conv(r, spec, value);
         value = chxj_encoding_parameter(r, value);
         value = chxj_add_cookie_parameter(r, value, chtml10->cookie);
-        if (value) {
-          value = apr_psprintf(r->pool,
-                               "%s%c%s=true",
-                               value,
-                               (strchr(value, '?')) ? '&' : '?',
-                               CHXJ_COOKIE_NOUPDATE_PARAM);
-        }
-        W10_L(" src=\"");
-        W10_V(value);
-        W10_L("\"");
+        value = chxj_add_cookie_no_update_parameter(r, value);
+        W_L(" src=\"");
+        W_V(value);
+        W_L("\"");
 #endif
       }
       break;
@@ -2296,18 +2355,32 @@ s_chtml10_start_img_tag(void* pdoc, Node* node)
         /*--------------------------------------------------------------------*/
         /* CHTML 4.0                                                          */
         /*--------------------------------------------------------------------*/
-        W10_L(" align=\"");
-        W10_V(value);
-        W10_L("\"");
+        if (value) {
+          if (STRCASEEQ('t','T',"top",   value) ||
+              STRCASEEQ('m','M',"middle",value) ||
+              STRCASEEQ('b','B',"bottom",value) ||
+              STRCASEEQ('l','L',"left",  value) ||
+              STRCASEEQ('r','R',"right", value)) {
+            W_L(" align=\"");
+            W_V(value);
+            W_L("\"");
+          }
+          else if (STRCASEEQ('c','C',"center",  value)) {
+            W_L(" align=\"");
+            W_L("middle");
+            W_L("\"");
+          }
+        }
       }
-      else
-      if (strcasecmp(name, "alt"   ) == 0) {
+      else if (strcasecmp(name, "alt"   ) == 0) {
         /*--------------------------------------------------------------------*/
         /* CHTML 1.0                                                          */
         /*--------------------------------------------------------------------*/
-        W10_L(" alt=\"");
-        W10_V(value);
-        W10_L("\"");
+        if (value && value[0] != '\0') {
+          W_L(" alt=\"");
+          W_V(value);
+          W_L("\"");
+        }
       }
       break;
 
@@ -2317,9 +2390,11 @@ s_chtml10_start_img_tag(void* pdoc, Node* node)
         /*--------------------------------------------------------------------*/
         /* CHTML 1.0                                                          */
         /*--------------------------------------------------------------------*/
-        W10_L(" width=\"");
-        W10_V(value);
-        W10_L("\"");
+        if (value && value[0] != '\0') {
+          W_L(" width=\"");
+          W_V(value);
+          W_L("\"");
+        }
       }
       break;
 
@@ -2329,18 +2404,22 @@ s_chtml10_start_img_tag(void* pdoc, Node* node)
         /*--------------------------------------------------------------------*/
         /* CHTML 1.0                                                          */
         /*--------------------------------------------------------------------*/
-        W10_L(" height=\"");
-        W10_V(value);
-        W10_L("\"");
+        if (value && value[0] != '\0') {
+          W_L(" height=\"");
+          W_V(value);
+          W_L("\"");
+        }
       }
       else
       if (strcasecmp(name, "hspace") == 0) {
         /*--------------------------------------------------------------------*/
         /* CHTML 1.0                                                          */
         /*--------------------------------------------------------------------*/
-        W10_L(" hspace=\"");
-        W10_V(value);
-        W10_L("\"");
+        if (value && value[0] != '\0') {
+          W_L(" hspace=\"");
+          W_V(value);
+          W_L("\"");
+        }
       }
       break;
 
@@ -2350,9 +2429,11 @@ s_chtml10_start_img_tag(void* pdoc, Node* node)
         /*--------------------------------------------------------------------*/
         /* CHTML 1.0                                                          */
         /*--------------------------------------------------------------------*/
-        W10_L(" vspace=\"");
-        W10_V(value);
-        W10_L("\"");
+        if (value && value[0] != '\0') {
+          W_L(" vspace=\"");
+          W_V(value);
+          W_L("\"");
+        }
       }
       break;
 
@@ -2361,7 +2442,7 @@ s_chtml10_start_img_tag(void* pdoc, Node* node)
     }
   }
 
-  W10_L(">");
+  W_L(">");
   return chtml10->out;
 }
 
@@ -2377,9 +2458,7 @@ s_chtml10_start_img_tag(void* pdoc, Node* node)
 static char *
 s_chtml10_end_img_tag(void *pdoc, Node *UNUSED(child)) 
 {
-  chtml10_t *chtml10;
-
-  chtml10 = GET_CHTML10(pdoc);
+  chtml10_t *chtml10 = GET_CHTML10(pdoc);
 
   return chtml10->out;
 }
@@ -2411,16 +2490,12 @@ s_chtml10_start_select_tag(void *pdoc, Node *child)
   size    = NULL;
   name    = NULL;
 
-  W10_L("<select");
+  W_L("<select");
   for (attr = qs_get_attr(doc,child);
        attr;
        attr = qs_get_next_attr(doc,attr)) {
-    char *nm;
-    char *val;
-
-    nm  = qs_get_attr_name (doc,attr);
-    val = qs_get_attr_value(doc,attr);
-
+    char *nm  = qs_get_attr_name (doc,attr);
+    char *val = qs_get_attr_value(doc,attr);
     switch(*nm) {
     case 's':
     case 'S':
@@ -2457,19 +2532,19 @@ s_chtml10_start_select_tag(void *pdoc, Node *child)
     }
   }
 
-  if (size) {
-    W10_L(" size=\"");
-    W10_V(size);
-    W10_L("\"");
+  if (size && *size != 0) {
+    W_L(" size=\"");
+    W_V(size);
+    W_L("\"");
   }
 
-  if (name) {
-    W10_L(" name=\"");
-    W10_V(name);
-    W10_L("\"");
+  if (name && *name != 0) {
+    W_L(" name=\"");
+    W_V(name);
+    W_L("\"");
   }
 
-  W10_L(">\r\n");
+  W_L(">");
   return chtml10->out;
 }
 
@@ -2485,15 +2560,15 @@ s_chtml10_start_select_tag(void *pdoc, Node *child)
 static char *
 s_chtml10_end_select_tag(void *pdoc, Node *UNUSED(child))
 {
-  chtml10_t *chtml10;
-  Doc *doc;
+  chtml10_t   *chtml10;
+  Doc         *doc;
   request_rec *r;
 
   chtml10 = GET_CHTML10(pdoc);
   doc     = chtml10->doc;
   r       = doc->r;
 
-  W10_L("</select>\r\n");
+  W_L("</select>");
   return chtml10->out;
 }
 
@@ -2509,13 +2584,12 @@ s_chtml10_end_select_tag(void *pdoc, Node *UNUSED(child))
 static char *
 s_chtml10_start_option_tag(void *pdoc, Node *child)
 {
-  chtml10_t *chtml10;
-  Doc *doc;
+  chtml10_t   *chtml10;
+  Doc         *doc;
   request_rec *r;
-  Attr *attr;
-
-  char *selected;
-  char *value;
+  Attr        *attr;
+  char        *selected;
+  char        *value;
 
   chtml10   = GET_CHTML10(pdoc);
   doc       = chtml10->doc;
@@ -2524,17 +2598,13 @@ s_chtml10_start_option_tag(void *pdoc, Node *child)
   selected  = NULL;
   value     = NULL;
 
-  W10_L("<option");
+  W_L("<option");
 
   for (attr = qs_get_attr(doc,child);
        attr;
        attr = qs_get_next_attr(doc,attr)) {
-    char *nm;
-    char *val;
-
-    nm  = qs_get_attr_name (doc,attr);
-    val = qs_get_attr_value(doc,attr);
-
+    char *nm  = qs_get_attr_name (doc,attr);
+    char *val = qs_get_attr_value(doc,attr);
     switch(*nm) {
     case 's':
     case 'S':
@@ -2562,19 +2632,16 @@ s_chtml10_start_option_tag(void *pdoc, Node *child)
   }
 
   if (value) {
-    W10_L(" value=\"");
-    W10_V(value);
-    W10_L("\"");
-  }
-  else {
-    W10_L(" value=\"\"");
+    W_L(" value=\"");
+    W_V(value);
+    W_L("\"");
   }
 
   if (selected) {
-    W10_L(" selected ");
+    W_L(" selected");
   }
 
-  W10_L(">");
+  W_L(">");
   return chtml10->out;
 }
 
@@ -2590,9 +2657,7 @@ s_chtml10_start_option_tag(void *pdoc, Node *child)
 static char *
 s_chtml10_end_option_tag(void *pdoc, Node *UNUSED(child))
 {
-  chtml10_t *chtml10;
-  chtml10 = GET_CHTML10(pdoc);
+  chtml10_t *chtml10 = GET_CHTML10(pdoc);
 
   /* Don't close */
 
@@ -2611,12 +2676,11 @@ s_chtml10_end_option_tag(void *pdoc, Node *UNUSED(child))
 static char *
 s_chtml10_start_div_tag(void *pdoc, Node *child)
 {
-  chtml10_t *chtml10;
-  Doc *doc;
+  chtml10_t   *chtml10;
+  Doc         *doc;
   request_rec *r;
-  Attr *attr;
-
-  char *align;
+  Attr        *attr;
+  char        *align;
 
   chtml10 = GET_CHTML10(pdoc);
   doc     = chtml10->doc;
@@ -2624,18 +2688,12 @@ s_chtml10_start_div_tag(void *pdoc, Node *child)
 
   align   = NULL;
 
-  W10_L("<div");
-
+  W_L("<div");
   for (attr = qs_get_attr(doc,child);
        attr;
        attr = qs_get_next_attr(doc,attr)) {
-
-    char *nm;
-    char *val;
-
-    nm  = qs_get_attr_name(doc,attr);
-    val = qs_get_attr_value(doc,attr);
-
+    char *nm  = qs_get_attr_name(doc,attr);
+    char *val = qs_get_attr_value(doc,attr);
     if (STRCASEEQ('a','A',"align", nm)) {
       /*----------------------------------------------------------------------*/
       /* CHTML 1.0 (W3C version 3.2)                                          */
@@ -2647,12 +2705,12 @@ s_chtml10_start_div_tag(void *pdoc, Node *child)
   }
 
   if (align) {
-    W10_L(" align=\"");
-    W10_V(align);
-    W10_L("\"");
+    W_L(" align=\"");
+    W_V(align);
+    W_L("\"");
   }
 
-  W10_L(">");
+  W_L(">");
   return chtml10->out;
 }
 
@@ -2668,15 +2726,15 @@ s_chtml10_start_div_tag(void *pdoc, Node *child)
 static char *
 s_chtml10_end_div_tag(void *pdoc, Node *UNUSED(child))
 {
-  chtml10_t *chtml10;
-  Doc *doc;
+  chtml10_t   *chtml10;
+  Doc         *doc;
   request_rec *r;
 
   chtml10 = GET_CHTML10(pdoc);
   doc     = chtml10->doc;
   r       = doc->r;
 
-  W10_L("</div>");
+  W_L("</div>");
   return chtml10->out;
 }
 
@@ -2692,9 +2750,9 @@ s_chtml10_end_div_tag(void *pdoc, Node *UNUSED(child))
 static char *
 s_chtml10_chxjif_tag(void *pdoc, Node *node)
 {
-  chtml10_t *chtml10;
-  Doc *doc;
-  Node *child;
+  chtml10_t   *chtml10;
+  Doc         *doc;
+  Node        *child;
   request_rec *r;
 
   chtml10 = GET_CHTML10(pdoc);
@@ -2704,7 +2762,7 @@ s_chtml10_chxjif_tag(void *pdoc, Node *node)
   for (child = qs_get_child_node(doc, node);
        child;
        child = qs_get_next_node(doc, child)) {
-    W10_V(child->otext);
+    W_V(child->otext);
     s_chtml10_chxjif_tag(chtml10, child);
   }
 
@@ -2723,16 +2781,16 @@ s_chtml10_chxjif_tag(void *pdoc, Node *node)
 static char *
 s_chtml10_start_pre_tag(void *pdoc, Node *UNUSED(node)) 
 {
-  Doc *doc;
+  Doc         *doc;
   request_rec *r;
-  chtml10_t *chtml10;
+  chtml10_t   *chtml10;
 
   chtml10 = GET_CHTML10(pdoc);
   doc     = chtml10->doc;
   r       = doc->r;
 
   chtml10->pre_flag++;
-  W10_L("<pre>");
+  W_L("<pre>");
   return chtml10->out;
 }
 
@@ -2748,15 +2806,15 @@ s_chtml10_start_pre_tag(void *pdoc, Node *UNUSED(node))
 static char *
 s_chtml10_end_pre_tag(void *pdoc, Node *UNUSED(child)) 
 {
-  chtml10_t *chtml10;
-  Doc *doc;
+  chtml10_t   *chtml10;
+  Doc         *doc;
   request_rec *r;
 
   chtml10 = GET_CHTML10(pdoc);
   doc     = chtml10->doc;
   r       = doc->r;
 
-  W10_L("</pre>");
+  W_L("</pre>");
   chtml10->pre_flag--;
 
   return chtml10->out;
@@ -2772,17 +2830,41 @@ s_chtml10_end_pre_tag(void *pdoc, Node *UNUSED(child))
  * @return The conversion result is returned.
  */
 static char *
-s_chtml10_start_p_tag(void *pdoc, Node *UNUSED(node)
+s_chtml10_start_p_tag(void *pdoc, Node *node
 {
-  Doc *doc;
+  Doc         *doc;
   request_rec *r;
-  chtml10_t *chtml10;
+  chtml10_t   *chtml10;
+  Attr        *attr;
+  char        *align = NULL;
 
   chtml10 = GET_CHTML10(pdoc);
   doc     = chtml10->doc;
   r       = doc->r;
 
-  W10_L("<p>");
+  W_L("<p");
+  for (attr = qs_get_attr(doc,node);
+       attr;
+       attr = qs_get_next_attr(doc,attr)) {
+    char *nm  = qs_get_attr_name(doc,attr);
+    char *val = qs_get_attr_value(doc,attr);
+    if (STRCASEEQ('a','A',"align", nm)) {
+      /*----------------------------------------------------------------------*/
+      /* CHTML 1.0 (W3C version 3.2)                                          */
+      /*----------------------------------------------------------------------*/
+      if (val && (STRCASEEQ('l','L',"left",val) || STRCASEEQ('r','R',"right",val) || STRCASEEQ('c','C',"center",val))) {
+        align = apr_pstrdup(doc->buf.pool, val);
+        break;
+      }
+    }
+  }
+  if (align) {
+    W_L(" align=\"");
+    W_V(align);
+    W_L("\"");
+  }
+
+  W_L(">");
   return chtml10->out;
 }
 
@@ -2798,15 +2880,15 @@ s_chtml10_start_p_tag(void *pdoc, Node *UNUSED(node))
 static char *
 s_chtml10_end_p_tag(void *pdoc, Node *UNUSED(child)) 
 {
-  Doc *doc;
+  Doc         *doc;
   request_rec *r;
-  chtml10_t *chtml10;
+  chtml10_t   *chtml10;
 
   chtml10 = GET_CHTML10(pdoc);
   doc     = chtml10->doc;
   r       = doc->r;
 
-  W10_L("</p>");
+  W_L("</p>");
   return chtml10->out;
 }
 
@@ -2822,10 +2904,10 @@ s_chtml10_end_p_tag(void *pdoc, Node *UNUSED(child))
 static char *
 s_chtml10_start_textarea_tag(void *pdoc, Node *node) 
 {
-  Doc *doc;
+  Doc         *doc;
   request_rec *r;
-  chtml10_t *chtml10;
-  Attr *attr;
+  chtml10_t   *chtml10;
+  Attr        *attr;
 
   chtml10 = GET_CHTML10(pdoc);
   doc     = chtml10->doc;
@@ -2834,43 +2916,47 @@ s_chtml10_start_textarea_tag(void *pdoc, Node *node)
 
   chtml10->textarea_flag++;
 
-  W10_L("<textarea ");
+  W_L("<textarea");
 
   for (attr = qs_get_attr(doc,node);
        attr;
        attr = qs_get_next_attr(doc,attr)) {
-
-    char *name;
-    char *value;
-
-    name  = qs_get_attr_name (doc,attr);
-    value = qs_get_attr_value(doc,attr);
-
+    char *name  = qs_get_attr_name (doc,attr);
+    char *value = qs_get_attr_value(doc,attr);
     switch(*name) {
+    case 'a':
+    case 'A':
+      if (strcasecmp(name, "accesskey") == 0 && value && *value != 0) {
+        W_L(" accesskey=\"");
+        W_V(value);
+        W_L("\"");
+      }
+      break;
+
     case 'n':
     case 'N':
-      if (strcasecmp(name, "name") == 0) {
-        W10_L(" name=\"");
-        W10_V(value);
-        W10_L("\"");
+      if (strcasecmp(name, "name") == 0 && value && *value != 0) {
+        W_L(" name=\"");
+        W_V(value);
+        W_L("\"");
       }
       break;
 
     case 'r':
     case 'R':
-      if (strcasecmp(name, "rows") == 0) {
-        W10_L(" rows=\"");
-        W10_V(value);
-        W10_L("\"");
+      if (strcasecmp(name, "rows") == 0 && value && *value != 0) {
+        W_L(" rows=\"");
+        W_V(value);
+        W_L("\"");
       }
       break;
 
     case 'c':
     case 'C':
-      if (strcasecmp(name, "cols") == 0) {
-        W10_L(" cols=\"");
-        W10_V(value);
-        W10_L("\"");
+      if (strcasecmp(name, "cols") == 0 && value && *value != 0) {
+        W_L(" cols=\"");
+        W_V(value);
+        W_L("\"");
       }
       break;
     
@@ -2878,8 +2964,7 @@ s_chtml10_start_textarea_tag(void *pdoc, Node *node)
       break;
     }
   }
-
-  W10_L(">\r\n");
+  W_L(">");
   return chtml10->out;
 }
 
@@ -2895,15 +2980,15 @@ s_chtml10_start_textarea_tag(void *pdoc, Node *node)
 static char *
 s_chtml10_end_textarea_tag(void *pdoc, Node *UNUSED(child)) 
 {
-  Doc *doc;
+  Doc         *doc;
   request_rec *r;
-  chtml10_t *chtml10;
+  chtml10_t   *chtml10;
 
   chtml10 = GET_CHTML10(pdoc);
   doc     = chtml10->doc;
   r       = doc->r;
 
-  W10_L("</textarea>\r\n");
+  W_L("</textarea>");
   chtml10->textarea_flag--;
 
   return chtml10->out;
@@ -2913,35 +2998,35 @@ s_chtml10_end_textarea_tag(void *pdoc, Node *UNUSED(child))
 static char *
 s_chtml10_text(void *pdoc, Node *child)
 {
-  char *textval;
-  char *tmp;
-  char *tdst;
-  char one_byte[2];
-  int ii;
-  int tdst_len;
-  chtml10_t *chtml10;
-  Doc *doc;
+  char        *textval;
+  char        *tmp;
+  char        *tdst;
+  char        one_byte[2];
+  int         ii;
+  int         tdst_len;
+  chtml10_t   *chtml10;
+  Doc         *doc;
   request_rec *r;
+  apr_size_t  z2h_input_len;
 
   chtml10 = GET_CHTML10(pdoc);
   doc     = chtml10->doc;
   r       = doc->r;
-  
-  textval = qs_get_node_value(doc,child);
-  textval = qs_trim_string(r, textval);
 
-  if (strlen(textval) == 0)
+  textval = qs_get_node_value(doc,child);
+  if (strlen(textval) == 0) {
     return chtml10->out;
+  }
   
   tmp = apr_palloc(r->pool, qs_get_node_size(doc,child)+1);
   memset(tmp, 0, qs_get_node_size(doc,child)+1);
   
-  tdst     = qs_alloc_zero_byte_string(r);
+  tdst     = qs_alloc_zero_byte_string(doc->buf.pool);
   memset(one_byte, 0, sizeof(one_byte));
   tdst_len = 0;
   
   for (ii=0; ii<qs_get_node_size(doc,child); ii++) {
-    charout;
+    char *out;
     int   rtn;
 
     rtn = s_chtml10_search_emoji(chtml10, &textval[ii], &out);
@@ -2975,7 +3060,10 @@ s_chtml10_text(void *pdoc, Node *child)
     }
   }
 
-  W10_V(tdst);
+  z2h_input_len = strlen(tdst);
+  tdst = chxj_conv_z2h(r, tdst, &z2h_input_len, chtml10->entryp);
+
+  W_V(tdst);
   return chtml10->out;
 }
 
@@ -2995,7 +3083,7 @@ s_chtml10_start_blockquote_tag(void *pdoc, Node *UNUSED(child))
   Doc *doc;
   chtml10 = GET_CHTML10(pdoc);
   doc     = chtml10->doc;
-  W10_L("<blockquote>");
+  W_L("<blockquote>");
   return chtml10->out;
 }
 
@@ -3016,7 +3104,7 @@ s_chtml10_end_blockquote_tag(void *pdoc, Node *UNUSED(child))
 
   chtml10 = GET_CHTML10(pdoc);
   doc     = chtml10->doc;
-  W10_L("</blockquote>");
+  W_L("</blockquote>");
   return chtml10->out;
 }
 
@@ -3036,7 +3124,7 @@ s_chtml10_start_dir_tag(void *pdoc, Node *UNUSED(child))
   Doc *doc;
   chtml10 = GET_CHTML10(pdoc);
   doc     = chtml10->doc;
-  W10_L("<dir>");
+  W_L("<dir>");
   return chtml10->out;
 }
 
@@ -3057,7 +3145,7 @@ s_chtml10_end_dir_tag(void *pdoc, Node *UNUSED(child))
 
   chtml10 = GET_CHTML10(pdoc);
   doc     = chtml10->doc;
-  W10_L("</dir>");
+  W_L("</dir>");
   return chtml10->out;
 }
 
@@ -3077,7 +3165,7 @@ s_chtml10_start_dl_tag(void *pdoc, Node *UNUSED(child))
   Doc *doc;
   chtml10 = GET_CHTML10(pdoc);
   doc     = chtml10->doc;
-  W10_L("<dl>");
+  W_L("<dl>");
   return chtml10->out;
 }
 
@@ -3097,7 +3185,7 @@ s_chtml10_end_dl_tag(void *pdoc, Node *UNUSED(child))
   Doc *doc;
   chtml10 = GET_CHTML10(pdoc);
   doc     = chtml10->doc;
-  W10_L("</dl>");
+  W_L("</dl>");
   return chtml10->out;
 }
 
@@ -3117,7 +3205,7 @@ s_chtml10_start_dt_tag(void *pdoc, Node *UNUSED(child))
   Doc *doc;
   chtml10 = GET_CHTML10(pdoc);
   doc     = chtml10->doc;
-  W10_L("<dt>");
+  W_L("<dt>");
   return chtml10->out;
 }
 
@@ -3133,8 +3221,8 @@ s_chtml10_start_dt_tag(void *pdoc, Node *UNUSED(child))
 static char *
 s_chtml10_end_dt_tag(void *pdoc, Node *UNUSED(child))
 {
-  chtml10_t *chtml10;
-  chtml10 = GET_CHTML10(pdoc);
+  chtml10_t *chtml10 = GET_CHTML10(pdoc);
+  
   return chtml10->out;
 }
 
@@ -3154,7 +3242,7 @@ s_chtml10_start_dd_tag(void *pdoc, Node *UNUSED(child))
   Doc *doc;
   chtml10 = GET_CHTML10(pdoc);
   doc     = chtml10->doc;
-  W10_L("<dd>");
+  W_L("<dd>");
   return chtml10->out;
 }
 
@@ -3170,8 +3258,113 @@ s_chtml10_start_dd_tag(void *pdoc, Node *UNUSED(child))
 static char *
 s_chtml10_end_dd_tag(void *pdoc, Node *UNUSED(child))
 {
+  chtml10_t *chtml10 = GET_CHTML10(pdoc);
+  return chtml10->out;
+}
+
+
+/**
+ * It is a hanmenuer who processes the MENU tag.
+ *
+ * @param pdoc  [i/o] The pointer to the CHTML structure at the output
+ *                     destination is specified.
+ * @param node   [i]   The MENU tag node is specified.
+ * @return The conversion result is returned.
+ */
+static char *
+s_chtml10_start_menu_tag(void *pdoc, Node *UNUSED(child))
+{
+  chtml10_t *chtml10;
+  Doc *doc;
+  chtml10 = GET_CHTML10(pdoc);
+  doc     = chtml10->doc;
+  W_L("<menu>");
+  return chtml10->out;
+}
+
+
+/**
+ * It is a hanmenuer who processes the MENU tag.
+ *
+ * @param pdoc  [i/o] The pointer to the CHTML structure at the output
+ *                     destination is specified.
+ * @param node   [i]   The MENU tag node is specified.
+ * @return The conversion result is returned.
+ */
+static char *
+s_chtml10_end_menu_tag(void *pdoc, Node *UNUSED(child))
+{
+  chtml10_t *chtml10 = GET_CHTML10(pdoc);
+  Doc *doc = chtml10->doc;
+  W_L("</menu>");
+  return chtml10->out;
+}
+
+
+/**
+ * It is a handler who processes the PLAINTEXT tag.
+ *
+ * @param pdoc  [i/o] The pointer to the CHTML structure at the output
+ *                     destination is specified.
+ * @param node   [i]   The PLAINTEXT tag node is specified.
+ * @return The conversion result is returned.
+ */
+static char *
+s_chtml10_start_plaintext_tag(void *pdoc, Node *node)
+{
+  chtml10_t *chtml10;
+  Doc *doc;
+
+  chtml10 = GET_CHTML10(pdoc);
+  doc     = chtml10->doc;
+  W_L("<plaintext>");
+  s_chtml10_start_plaintext_tag_inner(pdoc,node);
+  return chtml10->out;
+}
+
+static char *
+s_chtml10_start_plaintext_tag_inner(void *pdoc, Node *node)
+{
   chtml10_t *chtml10;
+  Doc *doc;
+  Node *child;
   chtml10 = GET_CHTML10(pdoc);
+  doc     = chtml10->doc;
+  for (child = qs_get_child_node(doc, node);
+       child;
+       child = qs_get_next_node(doc, child)) {
+    W_V(child->otext);
+    s_chtml10_start_plaintext_tag_inner(pdoc, child);
+  }
+  return chtml10->out;
+}
+
+
+/**
+ * It is a handler who processes the PLAINTEXT tag.
+ *
+ * @param pdoc  [i/o] The pointer to the CHTML structure at the output
+ *                     destination is specified.
+ * @param node   [i]   The PLAINTEXT tag node is specified.
+ * @return The conversion result is returned.
+ */
+static char *
+s_chtml10_end_plaintext_tag(void *pdoc, Node *UNUSED(child))
+{
+  chtml10_t *chtml10 = GET_CHTML10(pdoc);
+  return chtml10->out;
+}
+
+
+/**
+ * It is handler who processes the New Line Code.
+ */
+static char *
+s_chtml10_newline_mark(void *pdoc, Node *UNUSED(node))
+{
+  chtml10_t *chtml10 = GET_CHTML10(pdoc);
+  Doc *doc = chtml10->doc;
+  W_NLCODE();
   return chtml10->out;
 }
 /*