OSDN Git Service

* Added test code of the <ol> tag for SoftBank HTML converter.
[modchxj/mod_chxj.git] / src / chxj_chtml30.c
index 47f9379..6feb851 100644 (file)
 #include "chxj_encoding.h"
 
 #define GET_CHTML30(X) ((chtml30_t*)(X))
-#define W30_L(X)          do { chtml30->out = BUFFERED_WRITE_LITERAL(chtml30->out, &doc->buf, (X)); } while(0)
-#define W30_V(X)          do { chtml30->out = (X) ? BUFFERED_WRITE_VALUE(chtml30->out, &doc->buf, (X))  \
-                                                  : BUFFERED_WRITE_LITERAL(chtml30->out, &doc->buf, ""); } while(0)
-
-static char* s_chtml30_start_html_tag     (void* pdoc, Node* node);
-static char* s_chtml30_end_html_tag       (void* pdoc, Node* node);
-static char* s_chtml30_start_meta_tag     (void* pdoc, Node* node);
-static char* s_chtml30_end_meta_tag       (void* pdoc, Node* node);
-static char* s_chtml30_start_textarea_tag (void* pdoc, Node* node);
-static char* s_chtml30_end_textarea_tag   (void* pdoc, Node* node);
-static char* s_chtml30_start_p_tag        (void* pdoc, Node* node);
-static char* s_chtml30_end_p_tag          (void* pdoc, Node* node);
-static char* s_chtml30_start_pre_tag      (void* pdoc, Node* node);
-static char* s_chtml30_end_pre_tag        (void* pdoc, Node* node);
-static char* s_chtml30_start_h1_tag       (void* pdoc, Node* node);
-static char* s_chtml30_end_h1_tag         (void* pdoc, Node* node);
-static char* s_chtml30_start_h2_tag       (void* pdoc, Node* node);
-static char* s_chtml30_end_h2_tag         (void* pdoc, Node* node);
-static char* s_chtml30_start_h3_tag       (void* pdoc, Node* node);
-static char* s_chtml30_end_h3_tag         (void* pdoc, Node* node);
-static char* s_chtml30_start_h4_tag       (void* pdoc, Node* node);
-static char* s_chtml30_end_h4_tag         (void* pdoc, Node* node);
-static char* s_chtml30_start_h5_tag       (void* pdoc, Node* node);
-static char* s_chtml30_end_h5_tag         (void* pdoc, Node* node);
-static char* s_chtml30_start_h6_tag       (void* pdoc, Node* node);
-static char* s_chtml30_end_h6_tag         (void* pdoc, Node* node);
-static char* s_chtml30_start_ul_tag       (void* pdoc, Node* node);
-static char* s_chtml30_end_ul_tag         (void* pdoc, Node* node);
-static char* s_chtml30_start_ol_tag       (void* pdoc, Node* node);
-static char* s_chtml30_end_ol_tag         (void* pdoc, Node* node);
-static char* s_chtml30_start_li_tag       (void* pdoc, Node* node);
-static char* s_chtml30_end_li_tag         (void* pdoc, Node* node);
-static char* s_chtml30_start_head_tag     (void* pdoc, Node* node);
-static char* s_chtml30_end_head_tag       (void* pdoc, Node* node);
-static char* s_chtml30_start_title_tag    (void* pdoc, Node* node);
-static char* s_chtml30_end_title_tag      (void* pdoc, Node* node);
-static char* s_chtml30_start_base_tag     (void* pdoc, Node* node);
-static char* s_chtml30_end_base_tag       (void* pdoc, Node* node);
-static char* s_chtml30_start_body_tag     (void* pdoc, Node* node);
-static char* s_chtml30_end_body_tag       (void* pdoc, Node* node);
-static char* s_chtml30_start_a_tag        (void* pdoc, Node* node);
-static char* s_chtml30_end_a_tag          (void* pdoc, Node* node);
-static char* s_chtml30_start_br_tag       (void* pdoc, Node* node);
-static char* s_chtml30_end_br_tag         (void* pdoc, Node* node);
-static char* s_chtml30_start_tr_tag       (void* pdoc, Node* node);
-static char* s_chtml30_end_tr_tag         (void* pdoc, Node* node);
-static char* s_chtml30_start_font_tag     (void* pdoc, Node* node);
-static char* s_chtml30_end_font_tag       (void* pdoc, Node* node);
-static char* s_chtml30_start_form_tag     (void* pdoc, Node* node);
-static char* s_chtml30_end_form_tag       (void* pdoc, Node* node);
-static char* s_chtml30_start_input_tag    (void* pdoc, Node* node);
-static char* s_chtml30_end_input_tag      (void* pdoc, Node* node);
-static char* s_chtml30_start_center_tag   (void* pdoc, Node* node);
-static char* s_chtml30_end_center_tag     (void* pdoc, Node* node);
-static char* s_chtml30_start_hr_tag       (void* pdoc, Node* node);
-static char* s_chtml30_end_hr_tag         (void* pdoc, Node* node);
-static char* s_chtml30_start_img_tag      (void* pdoc, Node* node);
-static char* s_chtml30_end_img_tag        (void* pdoc, Node* node);
-static char* s_chtml30_start_select_tag   (void* pdoc, Node* node);
-static char* s_chtml30_end_select_tag     (void* pdoc, Node* node);
-static char* s_chtml30_start_option_tag   (void* pdoc, Node* node);
-static char* s_chtml30_end_option_tag     (void* pdoc, Node* node);
-static char* s_chtml30_start_div_tag      (void* pdoc, Node* node);
-static char* s_chtml30_end_div_tag        (void* pdoc, Node* node);
-static char* s_chtml30_chxjif_tag         (void* pdoc, Node* node); 
-static char* s_chtml30_text_tag           (void* pdoc, Node* node);
-
-static void  s_init_chtml30(chtml30_t* chtml, Doc* doc, request_rec* r, device_table* spec);
-
-static int   s_chtml30_search_emoji(chtml30_t* chtml, char* txt, char** rslt);
+#undef W_L
+#undef W_V
+#define W_L(X)          do { chtml30->out = BUFFERED_WRITE_LITERAL(chtml30->out, &doc->buf, (X)); } while(0)
+#define W_V(X)          do { chtml30->out = (X) ? BUFFERED_WRITE_VALUE(chtml30->out, &doc->buf, (X))  \
+                                                : BUFFERED_WRITE_LITERAL(chtml30->out, &doc->buf, ""); } while(0)
+extern tag_handler chtml20_handler[];
+
+static char *s_chtml30_start_html_tag     (void *pdoc, Node *node);
+static char *s_chtml30_end_html_tag       (void *pdoc, Node *node);
+static char *s_chtml30_start_meta_tag     (void *pdoc, Node *node);
+static char *s_chtml30_end_meta_tag       (void *pdoc, Node *node);
+static char *s_chtml30_start_textarea_tag (void *pdoc, Node *node);
+static char *s_chtml30_end_textarea_tag   (void *pdoc, Node *node);
+static char *s_chtml30_start_p_tag        (void *pdoc, Node *node);
+static char *s_chtml30_end_p_tag          (void *pdoc, Node *node);
+static char *s_chtml30_start_pre_tag      (void *pdoc, Node *node);
+static char *s_chtml30_end_pre_tag        (void *pdoc, Node *node);
+static char *s_chtml30_start_h1_tag       (void *pdoc, Node *node);
+static char *s_chtml30_end_h1_tag         (void *pdoc, Node *node);
+static char *s_chtml30_start_h2_tag       (void *pdoc, Node *node);
+static char *s_chtml30_end_h2_tag         (void *pdoc, Node *node);
+static char *s_chtml30_start_h3_tag       (void *pdoc, Node *node);
+static char *s_chtml30_end_h3_tag         (void *pdoc, Node *node);
+static char *s_chtml30_start_h4_tag       (void *pdoc, Node *node);
+static char *s_chtml30_end_h4_tag         (void *pdoc, Node *node);
+static char *s_chtml30_start_h5_tag       (void *pdoc, Node *node);
+static char *s_chtml30_end_h5_tag         (void *pdoc, Node *node);
+static char *s_chtml30_start_h6_tag       (void *pdoc, Node *node);
+static char *s_chtml30_end_h6_tag         (void *pdoc, Node *node);
+static char *s_chtml30_start_ul_tag       (void *pdoc, Node *node);
+static char *s_chtml30_end_ul_tag         (void *pdoc, Node *node);
+static char *s_chtml30_start_ol_tag       (void *pdoc, Node *node);
+static char *s_chtml30_end_ol_tag         (void *pdoc, Node *node);
+static char *s_chtml30_start_li_tag       (void *pdoc, Node *node);
+static char *s_chtml30_end_li_tag         (void *pdoc, Node *node);
+static char *s_chtml30_start_head_tag     (void *pdoc, Node *node);
+static char *s_chtml30_end_head_tag       (void *pdoc, Node *node);
+static char *s_chtml30_start_title_tag    (void *pdoc, Node *node);
+static char *s_chtml30_end_title_tag      (void *pdoc, Node *node);
+static char *s_chtml30_start_base_tag     (void *pdoc, Node *node);
+static char *s_chtml30_end_base_tag       (void *pdoc, Node *node);
+static char *s_chtml30_start_body_tag     (void *pdoc, Node *node);
+static char *s_chtml30_end_body_tag       (void *pdoc, Node *node);
+static char *s_chtml30_start_a_tag        (void *pdoc, Node *node);
+static char *s_chtml30_end_a_tag          (void *pdoc, Node *node);
+static char *s_chtml30_start_br_tag       (void *pdoc, Node *node);
+static char *s_chtml30_end_br_tag         (void *pdoc, Node *node);
+static char *s_chtml30_start_tr_tag       (void *pdoc, Node *node);
+static char *s_chtml30_end_tr_tag         (void *pdoc, Node *node);
+static char *s_chtml30_start_font_tag     (void *pdoc, Node *node);
+static char *s_chtml30_end_font_tag       (void *pdoc, Node *node);
+static char *s_chtml30_start_form_tag     (void *pdoc, Node *node);
+static char *s_chtml30_end_form_tag       (void *pdoc, Node *node);
+static char *s_chtml30_start_input_tag    (void *pdoc, Node *node);
+static char *s_chtml30_end_input_tag      (void *pdoc, Node *node);
+static char *s_chtml30_start_center_tag   (void *pdoc, Node *node);
+static char *s_chtml30_end_center_tag     (void *pdoc, Node *node);
+static char *s_chtml30_start_hr_tag       (void *pdoc, Node *node);
+static char *s_chtml30_end_hr_tag         (void *pdoc, Node *node);
+static char *s_chtml30_start_img_tag      (void *pdoc, Node *node);
+static char *s_chtml30_end_img_tag        (void *pdoc, Node *node);
+static char *s_chtml30_start_select_tag   (void *pdoc, Node *node);
+static char *s_chtml30_end_select_tag     (void *pdoc, Node *node);
+static char *s_chtml30_start_option_tag   (void *pdoc, Node *node);
+static char *s_chtml30_end_option_tag     (void *pdoc, Node *node);
+static char *s_chtml30_start_div_tag      (void *pdoc, Node *node);
+static char *s_chtml30_end_div_tag        (void *pdoc, Node *node);
+static char *s_chtml30_chxjif_tag         (void *pdoc, Node *node); 
+static char *s_chtml30_text_tag           (void *pdoc, Node *node);
+static char *s_chtml30_start_blockquote_tag(void *pdoc, Node *node);
+static char *s_chtml30_end_blockquote_tag  (void *pdoc, Node *node);
+static char *s_chtml30_start_dir_tag(void *pdoc, Node *node);
+static char *s_chtml30_end_dir_tag  (void *pdoc, Node *node);
+static char *s_chtml30_start_dl_tag(void *pdoc, Node *node);
+static char *s_chtml30_end_dl_tag  (void *pdoc, Node *node);
+static char *s_chtml30_start_dt_tag(void *pdoc, Node *node);
+static char *s_chtml30_end_dt_tag  (void *pdoc, Node *node);
+static char *s_chtml30_start_dd_tag(void *pdoc, Node *node);
+static char *s_chtml30_end_dd_tag  (void *pdoc, Node *node);
+static char *s_chtml30_start_marquee_tag(void *pdoc, Node *node);
+static char *s_chtml30_end_marquee_tag  (void *pdoc, Node *node);
+static char *s_chtml30_start_blink_tag  (void *pdoc, Node *node);
+static char *s_chtml30_end_blink_tag    (void *pdoc, Node *node);
+static char *s_chtml30_start_menu_tag   (void *pdoc, Node *node);
+static char *s_chtml30_end_menu_tag     (void *pdoc, Node *node);
+static char *s_chtml30_start_plaintext_tag       (void *pdoc, Node *node);
+static char *s_chtml30_start_plaintext_tag_inner (void *pdoc, Node *node);
+static char *s_chtml30_end_plaintext_tag         (void *pdoc, Node *node);
+
+static void  s_init_chtml30(chtml30_t *chtml, Doc *doc, request_rec *r, device_table *spec);
+
+static int   s_chtml30_search_emoji(chtml30_t *chtml, char *txt, char **rslt);
 
 
 tag_handler chtml30_handler[] = {
@@ -309,8 +331,8 @@ tag_handler chtml30_handler[] = {
   },
   /* tagDT */
   {
-    NULL,
-    NULL,
+    s_chtml30_start_dt_tag,
+    s_chtml30_end_dt_tag,
   },
   /* tagLEGEND */
   {
@@ -324,43 +346,43 @@ tag_handler chtml30_handler[] = {
   },
   /* tagBLOCKQUOTE */
   {
-    NULL,
-    NULL,
+    s_chtml30_start_blockquote_tag,
+    s_chtml30_end_blockquote_tag,
   },
   /* tagDIR */
   {
-    NULL,
-    NULL,
+    s_chtml30_start_dir_tag,
+    s_chtml30_end_dir_tag,
   },
   /* tagDL */
   {
-    NULL,
-    NULL,
+    s_chtml30_start_dl_tag,
+    s_chtml30_end_dl_tag,
   },
   /* tagDD */
   {
-    NULL,
-    NULL,
+    s_chtml30_start_dd_tag,
+    s_chtml30_end_dd_tag,
   },
   /* tagMENU */
   {
-    NULL,
-    NULL,
+    s_chtml30_start_menu_tag,
+    s_chtml30_end_menu_tag,
   },
   /* tagPLAINTEXT */
   {
-    NULL,
-    NULL,
+    s_chtml30_start_plaintext_tag,
+    s_chtml30_end_plaintext_tag,
   },
   /* tagBLINK */
   {
-    NULL,
-    NULL,
+    s_chtml30_start_blink_tag,
+    s_chtml30_end_blink_tag,
   },
   /* tagMARQUEE */
   {
-    NULL,
-    NULL,
+    s_chtml30_start_marquee_tag,
+    s_chtml30_end_marquee_tag,
   },
 };
 
@@ -562,12 +584,7 @@ s_chtml30_start_html_tag(void* pdoc, Node* UNUSED(node))
   /*--------------------------------------------------------------------------*/
   /* start HTML tag                                                           */
   /*--------------------------------------------------------------------------*/
-#if 0
-  chtml30->out = apr_pstrcat(r->pool, chtml30->out, "<html>\n", NULL);
-#else
-  W30_L("<html>\n");
-#endif
-
+  W_L("<html>");
   return chtml30->out;
 }
 
@@ -591,12 +608,7 @@ s_chtml30_end_html_tag(void* pdoc, Node* UNUSED(child))
   doc     = chtml30->doc;
   r       = doc->r;
 
-#if 0
-  chtml30->out = apr_pstrcat(r->pool, chtml30->out, "</html>\n", NULL);
-#else
-  W30_L("</html>\n");
-#endif
-
+  W_L("</html>");
   return chtml30->out;
 }
 
@@ -626,7 +638,7 @@ s_chtml30_start_meta_tag(void* pdoc, Node* node)
   content_type_flag = 0;
   refresh_flag      = 0;
 
-  W30_L("<meta");
+  W_L("<meta");
 
   /*--------------------------------------------------------------------------*/
   /* Get Attributes                                                           */
@@ -644,13 +656,13 @@ s_chtml30_start_meta_tag(void* pdoc, Node* node)
     switch(*name) {
     case 'h':
     case 'H':
-      if (strcasecmp(name, "http-equiv") == 0) {
+      if (strcasecmp(name, "http-equiv") == 0 && value && *value) {
         /*----------------------------------------------------------------------*/
         /* CHTML 2.0                                                            */
         /*----------------------------------------------------------------------*/
-        W30_L(" http-equiv=\"");
-        W30_V(value);
-        W30_L("\"");
+        W_L(" http-equiv=\"");
+        W_V(value);
+        W_L("\"");
         if (STRCASEEQ('c','C',"content-type", value))
           content_type_flag = 1;
   
@@ -661,11 +673,11 @@ s_chtml30_start_meta_tag(void* pdoc, Node* node)
 
     case 'c':
     case 'C':
-      if (strcasecmp(name, "content") == 0) {
+      if (strcasecmp(name, "content") == 0 && value && *value) {
         if (content_type_flag) {
-          W30_L(" ");
-          W30_V(name);
-          W30_L("=\"text/html; charset=Windows-31J\"");
+          W_L(" ");
+          W_V(name);
+          W_L("=\"text/html; charset=Windows-31J\"");
         }
         else
         if (refresh_flag) {
@@ -682,21 +694,21 @@ s_chtml30_start_meta_tag(void* pdoc, Node* node)
             url++;
             url = chxj_encoding_parameter(r, url);
             url = chxj_add_cookie_parameter(r, url, chtml30->cookie);
-            W30_L(" ");
-            W30_V(name);
-            W30_L("=\"");
-            W30_V(sec);
-            W30_L(";");
-            W30_V(url);
-            W30_L("\"");
+            W_L(" ");
+            W_V(name);
+            W_L("=\"");
+            W_V(sec);
+            W_L(";");
+            W_V(url);
+            W_L("\"");
           }
         }
         else {
-          W30_L(" ");
-          W30_V(name);
-          W30_L("=\"");
-          W30_V(value);
-          W30_L("\"");
+          W_L(" ");
+          W_V(name);
+          W_L("=\"");
+          W_V(value);
+          W_L("\"");
         }
       }
       break;
@@ -706,7 +718,7 @@ s_chtml30_start_meta_tag(void* pdoc, Node* node)
     }
   }
 
-  W30_L(">");
+  W_L(">");
 
   return chtml30->out;
 }
@@ -750,7 +762,7 @@ s_chtml30_start_head_tag(void* pdoc, Node* UNUSED(node))
   doc     = chtml30->doc;
   r       = doc->r;
 
-  W30_L("<head>\r\n");
+  W_L("<head>");
 
   return chtml30->out;
 }
@@ -764,8 +776,8 @@ s_chtml30_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_chtml30_end_head_tag(void* pdoc, Node* UNUSED(node)) 
+static char *
+s_chtml30_end_head_tag(void *pdoc, Node *UNUSED(node)) 
 {
   chtml30_t*    chtml30;
   Doc*          doc;
@@ -775,7 +787,7 @@ s_chtml30_end_head_tag(void* pdoc, Node* UNUSED(node))
   doc     = chtml30->doc;
   r       = doc->r;
 
-  W30_L("</head>\r\n");
+  W_L("</head>");
 
   return chtml30->out;
 }
@@ -800,7 +812,7 @@ s_chtml30_start_title_tag(void* pdoc, Node* UNUSED(node))
   doc     = chtml30->doc;
   r       = doc->r;
 
-  W30_L("<title>");
+  W_L("<title>");
 
   return chtml30->out;
 }
@@ -825,7 +837,7 @@ s_chtml30_end_title_tag(void* pdoc, Node* UNUSED(child))
   doc     = chtml30->doc;
   r       = doc->r;
 
-  W30_L("</title>\r\n");
+  W_L("</title>");
 
   return chtml30->out;
 }
@@ -839,42 +851,34 @@ s_chtml30_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_chtml30_start_base_tag(void* pdoc, Node* node) 
+static char *
+s_chtml30_start_base_tag(void *pdoc, Node *node) 
 {
-  Attr*         attr;
-  chtml30_t*    chtml30;
-  Doc*          doc;
-  request_rec*  r;
+  Attr *attr;
+  chtml30_t *chtml30;
+  Doc *doc;
+  request_rec *r;
 
   chtml30 = GET_CHTML30(pdoc);
   doc     = chtml30->doc;
   r       = doc->r;
 
-  W30_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)) {
-      W30_L(" href=\"");
-      W30_V(value);
-      W30_L("\"");
+      W_L(" href=\"");
+      W_V(value);
+      W_L("\"");
     }
   }
-
-  W30_L(" >\r\n");
-
+  W_L(">");
   return chtml30->out;
 }
 
@@ -906,56 +910,51 @@ s_chtml30_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_chtml30_start_body_tag(void* pdoc, Node* node) 
+static char *
+s_chtml30_start_body_tag(void *pdoc, Node *node) 
 {
-  chtml30_t*    chtml30;
-  Doc*          doc;
-  request_rec*  r;
-  Attr*         attr;
+  chtml30_t *chtml30;
+  Doc *doc;
+  request_rec *r;
+  Attr *attr;
 
   chtml30 = GET_CHTML30(pdoc);
   doc     = chtml30->doc;
   r       = doc->r;
 
 
-  W30_L("<body");
-
+  W_L("<body");
   /*--------------------------------------------------------------------------*/
   /* 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);
-
-    if (STRCASEEQ('b','B', "bgcolor", name)) {
+    char *name   = qs_get_attr_name(doc,attr);
+    char *value  = qs_get_attr_value(doc,attr);
+    if (STRCASEEQ('b','B', "bgcolor", name) && value && *value) {
       /*----------------------------------------------------------------------*/
       /* CHTML 2.0                                                            */
       /*----------------------------------------------------------------------*/
-      W30_L(" bgcolor=\"");
-      W30_V(value);
-      W30_L("\"");
+      W_L(" bgcolor=\"");
+      W_V(value);
+      W_L("\"");
     }
-    else if (STRCASEEQ('t','T', "text", name)) {
+    else if (STRCASEEQ('t','T', "text", name) && value && *value) {
       /*----------------------------------------------------------------------*/
       /* CHTML 2.0                                                            */
       /*----------------------------------------------------------------------*/
-      W30_L(" text=\"");
-      W30_V(value);
-      W30_L("\"");
+      W_L(" text=\"");
+      W_V(value);
+      W_L("\"");
     }
-    else if (STRCASEEQ('l','L',"link", name)) {
+    else if (STRCASEEQ('l','L',"link", name) && value && *value) {
       /*----------------------------------------------------------------------*/
       /* CHTML 2.0                                                            */
       /*----------------------------------------------------------------------*/
-      W30_L(" link=\"");
-      W30_V(value);
-      W30_L("\"");
+      W_L(" link=\"");
+      W_V(value);
+      W_L("\"");
     }
     else if (STRCASEEQ('a','A',"alink", name)) {
       /*----------------------------------------------------------------------*/
@@ -970,9 +969,7 @@ s_chtml30_start_body_tag(void* pdoc, Node* node)
       /* ignore */
     }
   }
-
-  W30_L(">\r\n");
-
+  W_L(">");
   return chtml30->out;
 }
 
@@ -985,18 +982,18 @@ s_chtml30_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_chtml30_end_body_tag(void* pdoc, Node* UNUSED(child)) 
+static char *
+s_chtml30_end_body_tag(void *pdoc, Node *UNUSED(child)) 
 {
-  chtml30_t*    chtml30;
-  Doc*          doc;
-  request_rec*  r;
+  chtml30_t *chtml30;
+  Doc *doc;
+  request_rec *r;
 
   chtml30 = GET_CHTML30(pdoc);
   doc     = chtml30->doc;
   r       = doc->r;
 
-  W30_L("</body>\r\n");
+  W_L("</body>");
 
   return chtml30->out;
 }
@@ -1022,7 +1019,7 @@ s_chtml30_start_a_tag(void* pdoc, Node* node)
   doc     = chtml30->doc;
   r       = doc->r;
 
-  W30_L("<a");
+  W_L("<a");
 
   /*--------------------------------------------------------------------------*/
   /* Get Attributes                                                           */
@@ -1041,9 +1038,9 @@ s_chtml30_start_a_tag(void* pdoc, Node* node)
       /*----------------------------------------------------------------------*/
       /* CHTML1.0                                                             */
       /*----------------------------------------------------------------------*/
-      W30_L(" name=\"");
-      W30_V(value);
-      W30_L("\"");
+      W_L(" name=\"");
+      W_V(value);
+      W_L("\"");
     }
     else if (STRCASEEQ('h','H',"href", name)) {
       /*----------------------------------------------------------------------*/
@@ -1051,25 +1048,25 @@ s_chtml30_start_a_tag(void* pdoc, Node* node)
       /*----------------------------------------------------------------------*/
       value = chxj_encoding_parameter(r, value);
       value = chxj_add_cookie_parameter(r, value, chtml30->cookie);
-      W30_L(" href=\"");
-      W30_V(value);
-      W30_L("\"");
+      W_L(" href=\"");
+      W_V(value);
+      W_L("\"");
     }
     else if (STRCASEEQ('a','A',"accesskey", name)) {
       /*----------------------------------------------------------------------*/
       /* CHTML1.0                                                             */
       /*----------------------------------------------------------------------*/
-      W30_L(" accesskey=\"");
-      W30_V(value);
-      W30_L("\"");
+      W_L(" accesskey=\"");
+      W_V(value);
+      W_L("\"");
     }
     else if (STRCASEEQ('c','C',"cti", name)) {
       /*----------------------------------------------------------------------*/
       /* CHTML 2.0                                                            */
       /*----------------------------------------------------------------------*/
-      W30_L(" cti=\"");
-      W30_V(value);
-      W30_L("\"");
+      W_L(" cti=\"");
+      W_V(value);
+      W_L("\"");
     }
     else if (STRCASEEQ('i','I',"ijam", name)) {
       /*----------------------------------------------------------------------*/
@@ -1082,7 +1079,7 @@ s_chtml30_start_a_tag(void* pdoc, Node* node)
       /* CHTML 3.0                                                            */
       /* It is special only for CHTML.                                        */
       /*----------------------------------------------------------------------*/
-      W30_L(" utn ");
+      W_L(" utn ");
     }
     else if (STRCASEEQ('t','T',"telbook", name)) {
       /*----------------------------------------------------------------------*/
@@ -1128,7 +1125,7 @@ s_chtml30_start_a_tag(void* pdoc, Node* node)
     }
   }
 
-  W30_L(">");
+  W_L(">");
 
   return chtml30->out;
 }
@@ -1153,7 +1150,7 @@ s_chtml30_end_a_tag(void* pdoc, Node* UNUSED(child))
   doc     = chtml30->doc;
   r       = doc->r;
 
-  W30_L("</a>");
+  W_L("</a>");
 
   return chtml30->out;
 }
@@ -1167,19 +1164,39 @@ s_chtml30_end_a_tag(void* pdoc, Node* UNUSED(child))
  * @param node   [i]   The BR tag node is specified.
  * @return The conversion result is returned.
  */
-static char*
-s_chtml30_start_br_tag(void* pdoc, Node* UNUSED(node)) 
+static char *
+s_chtml30_start_br_tag(void *pdoc, Node *node)
 {
-  chtml30_t*    chtml30;
-  Doc*          doc;
-  request_rec*  r;
+  chtml30_t *chtml30;
+  Doc *doc;
+  request_rec *r;
+  Attr *attr;
 
   chtml30 = GET_CHTML30(pdoc);
   doc     = chtml30->doc;
   r       = doc->r;
+  W_L("<br");
+  /*--------------------------------------------------------------------------*/
+  /* Get Attributes                                                           */
+  /*--------------------------------------------------------------------------*/
+  for (attr = qs_get_attr(doc,node);
+       attr;
+       attr = qs_get_next_attr(doc,attr)) {
+    char *name;
+    char *value;
 
-  W30_L("<br>\r\n");
+    name  = qs_get_attr_name(doc,attr);
+    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))) {
+        W_L(" clear=\"");
+        W_V(value);
+        W_L("\"");
+      }
+    }
+  }
+  W_L(">");
   return chtml30->out;
 }
 
@@ -1192,13 +1209,10 @@ s_chtml30_start_br_tag(void* pdoc, Node* UNUSED(node))
  * @param node   [i]   The BR tag node is specified.
  * @return The conversion result is returned.
  */
-static char*
-s_chtml30_end_br_tag(void* pdoc, Node* UNUSED(child)) 
+static char *
+s_chtml30_end_br_tag(void *pdoc, Node *UNUSED(child)) 
 {
-  chtml30_t*    chtml30;
-
-  chtml30 = GET_CHTML30(pdoc);
-
+  chtml30_t *chtml30 = GET_CHTML30(pdoc);
   return chtml30->out;
 }
 
@@ -1241,7 +1255,7 @@ s_chtml30_end_tr_tag(void* pdoc, Node* UNUSED(child))
   doc     = chtml30->doc;
   r       = doc->r;
 
-  W30_L("<br>\r\n");
+  W_L("<br>");
 
   return chtml30->out;
 }
@@ -1267,7 +1281,7 @@ s_chtml30_start_font_tag(void* pdoc, Node* node)
   doc     = chtml30->doc;
   r       = doc->r;
 
-  W30_L("<font");
+  W_L("<font");
 
   /*--------------------------------------------------------------------------*/
   /* Get Attributes                                                           */
@@ -1283,9 +1297,9 @@ s_chtml30_start_font_tag(void* pdoc, Node* node)
     value = qs_get_attr_value(doc,attr);
 
     if (STRCASEEQ('c','C',"color", name)) {
-      W30_L(" color=\"");
-      W30_V(value);
-      W30_L("\"");
+      W_L(" color=\"");
+      W_V(value);
+      W_L("\"");
     }
     else if (STRCASEEQ('s','S',"size", name)) {
       /*----------------------------------------------------------------------*/
@@ -1295,7 +1309,7 @@ s_chtml30_start_font_tag(void* pdoc, Node* node)
     }
   }
 
-  W30_L(">");
+  W_L(">");
 
   return chtml30->out;
 }
@@ -1320,7 +1334,7 @@ s_chtml30_end_font_tag(void* pdoc, Node* UNUSED(child))
   doc     = chtml30->doc;
   r       = doc->r;
 
-  W30_L("</font>");
+  W_L("</font>");
 
   return chtml30->out;
 }
@@ -1334,62 +1348,54 @@ s_chtml30_end_font_tag(void* pdoc, Node* UNUSED(child))
  * @param node   [i]   The FORM tag node is specified.
  * @return The conversion result is returned.
  */
-static char*
-s_chtml30_start_form_tag(void* pdoc, Node* node) 
+static char *
+s_chtml30_start_form_tag(void *pdoc, Node *node) 
 {
-  chtml30_t*    chtml30;
-  Doc*          doc;
-  request_rec*  r;
-  Attr*         attr;
+  chtml30_t     *chtml30;
+  Doc           *doc;
+  request_rec   *r;
+  Attr          *attr;
 
   chtml30 = GET_CHTML30(pdoc);
   doc     = chtml30->doc;
   r       = doc->r;
 
-  W30_L("<form");
-
+  W_L("<form");
   /*--------------------------------------------------------------------------*/
   /* 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('a','A',"action", name)) {
       /*----------------------------------------------------------------------*/
       /* CHTML 1.0                                                            */
       /*----------------------------------------------------------------------*/
       value = chxj_encoding_parameter(r, value);
       value = chxj_add_cookie_parameter(r, value, chtml30->cookie);
-      W30_L(" action=\"");
-      W30_V(value);
-      W30_L("\"");
+      W_L(" action=\"");
+      W_V(value);
+      W_L("\"");
     }
     else if (STRCASEEQ('m','M',"method", name)) {
       /*----------------------------------------------------------------------*/
       /* CHTML 1.0                                                            */
       /*----------------------------------------------------------------------*/
-      W30_L(" method=\"");
-      W30_V(value);
-      W30_L("\"");
+      W_L(" method=\"");
+      W_V(value);
+      W_L("\"");
     }
     else if (STRCASEEQ('u','U',"utn", name)) {
       /*----------------------------------------------------------------------*/
       /* CHTML 3.0                                                            */
       /* It is special only for CHTML.                                        */
       /*----------------------------------------------------------------------*/
-      W30_L(" utn ");
+      W_L(" utn");
     }
   }
-
-  W30_L(">");
-
+  W_L(">");
   return chtml30->out;
 }
 
@@ -1413,7 +1419,7 @@ s_chtml30_end_form_tag(void* pdoc, Node* UNUSED(child))
   doc     = chtml30->doc;
   r       = doc->r;
 
-  W30_L("</form>");
+  W_L("</form>");
 
   return chtml30->out;
 }
@@ -1427,32 +1433,28 @@ s_chtml30_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_chtml30_start_input_tag(void* pdoc, Node* node) 
-{
-  chtml30_t*    chtml30;
-  Doc*          doc;
-  request_rec*  r;
-  char*         max_length  = NULL;
-  char*         type        = NULL;
-  char*         name        = NULL;
-  char*         value       = NULL;
-  char*         istyle      = NULL;
-  char*         size        = NULL;
-  char*         checked     = NULL;
-  char*         accesskey   = NULL;
+static char *
+s_chtml30_start_input_tag(void *pdoc, Node *node) 
+{
+  chtml30_t *chtml30;
+  Doc *doc;
+  request_rec *r;
+  char *max_length  = NULL;
+  char *type        = NULL;
+  char *name        = NULL;
+  char *value       = NULL;
+  char *istyle      = NULL;
+  char *size        = NULL;
+  char *checked     = NULL;
+  char *accesskey   = NULL;
 
   chtml30   = GET_CHTML30(pdoc);
   doc       = chtml30->doc;
   r         = doc->r;
-
-
-  W30_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);
@@ -1463,67 +1465,70 @@ s_chtml30_start_input_tag(void* pdoc, Node* node)
   size       = qs_get_size_attr(doc, node, r);
 
   if (type) {
-    W30_L(" type=\"");
-    W30_V(type);
-    W30_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) {
-    W30_L(" size=\"");
-    W30_V(size);
-    W30_L("\" ");
+  if (size && *size) {
+    W_L(" size=\"");
+    W_V(size);
+    W_L("\"");
   }
-
-  if (name) {
-    W30_L(" name=\"");
-    W30_V(name);
-    W30_L("\" ");
+  if (name && *name) {
+    W_L(" name=\"");
+    W_V(name);
+    W_L("\"");
   }
-
-  if (value) {
-    W30_L(" value=\"");
-    W30_V(value);
-    W30_L("\" ");
+  if (value && *value) {
+    W_L(" value=\"");
+    W_V(value);
+    W_L("\"");
   }
-
-  if (accesskey) {
-    W30_L(" accesskey=\"");
-    W30_V(accesskey);
-    W30_L("\" ");
+  if (accesskey && *accesskey) {
+    W_L(" accesskey=\"");
+    W_V(accesskey);
+    W_L("\"");
   }
-
-  if (istyle != NULL) {
+  if (istyle) {
     /*------------------------------------------------------------------------*/
     /* CHTML 2.0                                                              */
     /*------------------------------------------------------------------------*/
-    W30_L(" istyle=\"");
-    W30_V(istyle);
-    W30_L("\" ");
+    if (*istyle == '1' || *istyle == '2' || *istyle == '3' || *istyle == '4') {
+      W_L(" istyle=\"");
+      W_V(istyle);
+      W_L("\"");
+    }
   }
 
   /*--------------------------------------------------------------------------*/
   /* The figure is default for the password.                                  */
   /*--------------------------------------------------------------------------*/
-  if (max_length) {
-    if (chxj_chk_numeric(max_length) != 0)
+  if (max_length && *max_length) {
+    if (chxj_chk_numeric(max_length) != 0) {
       max_length = apr_psprintf(r->pool, "0");
-
-    if (istyle != NULL && strcasecmp(istyle, "1") == 0) {
+    }
+    if (istyle != NULL && *istyle == '1') {
       char *vv = apr_psprintf(doc->buf.pool, " maxlength=\"%d\"", chxj_atoi(max_length) * 2);
-      W30_V(vv);
+      W_V(vv);
     }
     else  {
       char *vv = apr_psprintf(doc->buf.pool, " maxlength=\"%d\"", chxj_atoi(max_length));
-      W30_V(vv);
+      W_V(vv);
     }
   }
-
   if (checked) {
-    W30_L(" checked ");
+    W_L(" checked");
   }
-
-  W30_L(" >");
-
+  W_L(">");
   return chtml30->out;
 }
 
@@ -1566,7 +1571,7 @@ s_chtml30_start_center_tag(void* pdoc, Node* UNUSED(node))
   doc     = chtml30->doc;
   r       = doc->r;
 
-  W30_L("<center>");
+  W_L("<center>");
 
   return chtml30->out;
 }
@@ -1591,7 +1596,7 @@ s_chtml30_end_center_tag(void* pdoc, Node* UNUSED(child))
   doc     = chtml30->doc;
   r       = doc->r;
 
-  W30_L("</center>");
+  W_L("</center>");
 
   return chtml30->out;
 }
@@ -1617,7 +1622,7 @@ s_chtml30_start_hr_tag(void* pdoc, Node* node)
   doc     = chtml30->doc;
   r       = doc->r;
 
-  W30_L("<hr ");
+  W_L("<hr");
  
   for (attr = qs_get_attr(doc,node);
        attr; 
@@ -1629,31 +1634,37 @@ s_chtml30_start_hr_tag(void* pdoc, Node* node)
       /*----------------------------------------------------------------------*/
       /* CHTML 1.0                                                            */
       /*----------------------------------------------------------------------*/
-      W30_L(" align=\"");
-      W30_V(value);
-      W30_L("\" ");
+      if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
+        W_L(" align=\"");
+        W_V(value);
+        W_L("\"");
+      }
     }
     else if (STRCASEEQ('s','S',"size", name)) {
       /*----------------------------------------------------------------------*/
       /* CHTML 1.0                                                            */
       /*----------------------------------------------------------------------*/
-      W30_L(" size=\"");
-      W30_V(value);
-      W30_L("\" ");
+      if (value && *value) {
+        W_L(" size=\"");
+        W_V(value);
+        W_L("\"");
+      }
     }
     else if (STRCASEEQ('w','W',"width", name)) {
       /*----------------------------------------------------------------------*/
       /* CHTML 1.0                                                            */
       /*----------------------------------------------------------------------*/
-      W30_L(" width=\"");
-      W30_V(value);
-      W30_L("\" ");
+      if (value && *value) {
+        W_L(" width=\"");
+        W_V(value);
+        W_L("\"");
+      }
     }
     else if (STRCASEEQ('n','N',"noshade", name)) {
       /*----------------------------------------------------------------------*/
       /* CHTML 1.0                                                            */
       /*----------------------------------------------------------------------*/
-      W30_L(" noshade ");
+      W_L(" noshade");
     }
     else if (STRCASEEQ('c','C',"color", name)) {
       /*----------------------------------------------------------------------*/
@@ -1663,7 +1674,7 @@ s_chtml30_start_hr_tag(void* pdoc, Node* node)
     }
   }
 
-  W30_L(" >");
+  W_L(">");
 
   return chtml30->out;
 }
@@ -1696,16 +1707,16 @@ s_chtml30_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_chtml30_start_img_tag(void* pdoc, Node* node) 
+static char *
+s_chtml30_start_img_tag(void *pdoc, Node *node) 
 {
 #ifndef IMG_NOT_CONVERT_FILENAME
   device_table *spec;
 #endif
-  chtml30_t*    chtml30;
-  Doc*          doc;
-  request_rec*  r;
-  Attr*         attr;
+  chtml30_t    *chtml30;
+  Doc          *doc;
+  request_rec  *r;
+  Attr         *attr;
 
   chtml30 = GET_CHTML30(pdoc);
   doc     = chtml30->doc;
@@ -1714,8 +1725,7 @@ s_chtml30_start_img_tag(void* pdoc, Node* node)
   spec    = chtml30->spec;
 #endif
 
-  W30_L("<img");
-
+  W_L("<img");
   /*--------------------------------------------------------------------------*/
   /* Get Attributes                                                           */
   /*--------------------------------------------------------------------------*/
@@ -1738,9 +1748,9 @@ s_chtml30_start_img_tag(void* pdoc, Node* node)
                              value,
                              (strchr(value, '?')) ? '&' : '?',
                              CHXJ_COOKIE_NOUPDATE_PARAM);
-        W30_L(" src=\"");
-        W30_V(value);
-        W30_L("\"");
+        W_L(" src=\"");
+        W_V(value);
+        W_L("\"");
       }
 
 #else
@@ -1754,60 +1764,66 @@ s_chtml30_start_img_tag(void* pdoc, Node* node)
                              (strchr(value, '?')) ? '&' : '?',
                              CHXJ_COOKIE_NOUPDATE_PARAM);
       }
-      W30_L(" src=\"");
-      W30_V(value);
-      W30_L("\"");
+      W_L(" src=\"");
+      W_V(value);
+      W_L("\"");
 #endif
     }
     else if (STRCASEEQ('a','A',"align", name)) {
       /*----------------------------------------------------------------------*/
       /* CHTML 1.0                                                            */
       /*----------------------------------------------------------------------*/
-      W30_L(" align=\"");
-      W30_V(value);
-      W30_L("\"");
+      if (value && (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('w','W',"width", name)) {
+    else if (STRCASEEQ('w','W',"width", name) && value && *value) {
       /*----------------------------------------------------------------------*/
       /* CHTML 1.0                                                            */
       /*----------------------------------------------------------------------*/
-      W30_L(" width=\"");
-      W30_V(value);
-      W30_L("\"");
+      W_L(" width=\"");
+      W_V(value);
+      W_L("\"");
     }
-    else if (STRCASEEQ('h','H', "height", name)) {
+    else if (STRCASEEQ('h','H', "height", name) && value && *value) {
       /*----------------------------------------------------------------------*/
       /* CHTML 1.0                                                            */
       /*----------------------------------------------------------------------*/
-      W30_L(" height=\"");
-      W30_V(value);
-      W30_L("\"");
+      W_L(" height=\"");
+      W_V(value);
+      W_L("\"");
     }
-    else if (STRCASEEQ('h','H',"hspace", name)) {
+    else if (STRCASEEQ('h','H',"hspace", name) && value && *value) {
       /*----------------------------------------------------------------------*/
       /* CHTML 1.0                                                            */
       /*----------------------------------------------------------------------*/
-      W30_L(" hspace=\"");
-      W30_V(value);
-      W30_L("\"");
+      W_L(" hspace=\"");
+      W_V(value);
+      W_L("\"");
     }
-    else if (STRCASEEQ('v','V',"vspace", name)) {
+    else if (STRCASEEQ('v','V',"vspace", name) && value && *value) {
       /*----------------------------------------------------------------------*/
       /* CHTML 1.0                                                            */
       /*----------------------------------------------------------------------*/
-      W30_L(" vspace=\"");
-      W30_V(value);
-      W30_L("\"");
+      W_L(" vspace=\"");
+      W_V(value);
+      W_L("\"");
     }
-    else if (STRCASEEQ('a','A',"alt",name)) {
+    else if (STRCASEEQ('a','A',"alt",name) && value && *value) {
       /*----------------------------------------------------------------------*/
       /* CHTML 1.0                                                            */
       /*----------------------------------------------------------------------*/
-      W30_L(" alt=\"");
-      W30_V(value);
-      W30_L("\"");
+      W_L(" alt=\"");
+      W_V(value);
+      W_L("\"");
     }
-    else if (STRCASEEQ('a','A',"align", name)) {
+    else if (STRCASEEQ('a','A',"align", name) && value && *value) {
       /*----------------------------------------------------------------------*/
       /* CHTML 4.0                                                            */
       /*----------------------------------------------------------------------*/
@@ -1815,7 +1831,7 @@ s_chtml30_start_img_tag(void* pdoc, Node* node)
     }
   }
 
-  W30_L(">");
+  W_L(">");
 
   return chtml30->out;
 }
@@ -1851,28 +1867,20 @@ s_chtml30_end_img_tag(void* pdoc, Node* UNUSED(child))
 static char*
 s_chtml30_start_select_tag(void* pdoc, Node* child)
 {
+  chtml30_t   *chtml30 = GET_CHTML30(pdoc);
+  Doc         *doc     = chtml30->doc;
+  char        *size    = NULL;
+  char        *name    = NULL;
+  char        *multiple    = NULL;
+  Attr        *attr;
 
-  char*         size;
-  char*         name;
-  Attr*         attr;
-  chtml30_t*    chtml30;
-  Doc*          doc;
-  request_rec*  r;
-
-  chtml30 = GET_CHTML30(pdoc);
-  doc     = chtml30->doc;
-  r       = doc->r;
-  size    = NULL;
-  name    = NULL;
-
-  W30_L("<select");
+  W_L("<select");
 
   for (attr = qs_get_attr(doc,child);
        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('s','S',"size", nm)) {
       /*----------------------------------------------------------------------*/
       /* CHTML 1.0 version 2.0                                                */
@@ -1889,24 +1897,23 @@ s_chtml30_start_select_tag(void* pdoc, Node* child)
       /*----------------------------------------------------------------------*/
       /* CHTML 1.0 version 2.0                                                */
       /*----------------------------------------------------------------------*/
-      /* not support */
+      multiple = apr_pstrdup(doc->buf.pool, val);
     }
   }
-
-  if (size) {
-    W30_L(" size=\"");
-    W30_V(size);
-    W30_L("\"");
+  if (size && *size) {
+    W_L(" size=\"");
+    W_V(size);
+    W_L("\"");
   }
-
-  if (name) {
-    W30_L(" name=\"");
-    W30_V(name);
-    W30_L("\"");
+  if (name && *name) {
+    W_L(" name=\"");
+    W_V(name);
+    W_L("\"");
   }
-
-  W30_L(">\n");
-
+  if (multiple) {
+    W_L(" multiple");
+  }
+  W_L(">");
   return chtml30->out;
 }
 
@@ -1929,9 +1936,7 @@ s_chtml30_end_select_tag(void* pdoc, Node* UNUSED(child))
   chtml30 = GET_CHTML30(pdoc);
   doc   = chtml30->doc;
   r     = doc->r;
-
-  W30_L("</select>\n");
-
+  W_L("</select>");
   return chtml30->out;
 }
 
@@ -1944,15 +1949,15 @@ s_chtml30_end_select_tag(void* pdoc, Node* UNUSED(child))
  * @param node   [i]   The OPTION tag node is specified.
  * @return The conversion result is returned.
  */
-static char*
-s_chtml30_start_option_tag(void* pdoc, Node* child)
+static char *
+s_chtml30_start_option_tag(void *pdoc, Node *child)
 {
-  Attr*         attr;
-  chtml30_t*    chtml30;
-  Doc*          doc;
-  request_rec*  r;
-  char*         selected;
-  char*         value;
+  Attr *attr;
+  chtml30_t *chtml30;
+  Doc *doc;
+  request_rec *r;
+  char *selected;
+  char *value;
 
   chtml30    = GET_CHTML30(pdoc);
   doc        = chtml30->doc;
@@ -1960,8 +1965,7 @@ s_chtml30_start_option_tag(void* pdoc, Node* child)
   selected   = NULL;
   value      = NULL;
 
-  W30_L("<option");
-
+  W_L("<option");
   for (attr = qs_get_attr(doc,child);
        attr;
        attr = qs_get_next_attr(doc,attr)) {
@@ -1981,21 +1985,15 @@ s_chtml30_start_option_tag(void* pdoc, Node* child)
       value = apr_pstrdup(doc->buf.pool, val);
     }
   }
-
-  if (value) {
-    W30_L(" value=\"");
-    W30_V(value);
-    W30_L("\"");
-  }
-  else {
-    W30_L(" value=\"\"");
+  if (value && *value) {
+    W_L(" value=\"");
+    W_V(value);
+    W_L("\"");
   }
-
   if (selected) {
-    W30_L(" selected");
+    W_L(" selected");
   }
-
-  W30_L(">");
+  W_L(">");
 
   return chtml30->out;
 }
@@ -2044,7 +2042,7 @@ s_chtml30_start_div_tag(void *pdoc, Node *child)
   r       = doc->r;
   align   = NULL;
 
-  W30_L("<div");
+  W_L("<div");
 
   for (attr = qs_get_attr(doc,child);
        attr;
@@ -2056,17 +2054,19 @@ s_chtml30_start_div_tag(void *pdoc, Node *child)
       /*----------------------------------------------------------------------*/
       /* CHTML 1.0 (W3C version 3.2)                                          */
       /*----------------------------------------------------------------------*/
-      align = apr_pstrdup(doc->buf.pool, val);
+      if (val && (STRCASEEQ('l','L',"left",val) || STRCASEEQ('r','R',"right",val) || STRCASEEQ('c','C',"center",val))) {
+        align = apr_pstrdup(doc->buf.pool, val);
+      }
     }
   }
 
   if (align) {
-    W30_L(" align=\"");
-    W30_V(align);
-    W30_L("\"");
+    W_L(" align=\"");
+    W_V(align);
+    W_L("\"");
   }
 
-  W30_L(">");
+  W_L(">");
 
   return chtml30->out;
 }
@@ -2091,7 +2091,7 @@ s_chtml30_end_div_tag(void* pdoc, Node* UNUSED(node))
   doc     = chtml30->doc;
   r       = doc->r;
 
-  W30_L("</div>\n");
+  W_L("</div>");
 
   return chtml30->out;
 }
@@ -2116,7 +2116,7 @@ s_chtml30_start_ul_tag(void* pdoc, Node* UNUSED(node))
   doc     = chtml30->doc;
   r       = doc->r;
 
-  W30_L("<ul>");
+  W_L("<ul>");
 
   return chtml30->out;
 }
@@ -2141,7 +2141,7 @@ s_chtml30_end_ul_tag(void *pdoc, Node *UNUSED(child))
   doc     = chtml30->doc;
   r       = doc->r;
 
-  W30_L("</ul>");
+  W_L("</ul>");
 
   return chtml30->out;
 }
@@ -2167,7 +2167,7 @@ s_chtml30_start_pre_tag(void *pdoc, Node *UNUSED(node))
   r       = doc->r;
 
   chtml30->pre_flag++;
-  W30_L("<pre>");
+  W_L("<pre>");
 
   return chtml30->out;
 }
@@ -2192,7 +2192,7 @@ s_chtml30_end_pre_tag(void *pdoc, Node *UNUSED(child))
   doc     = chtml30->doc;
   r       = doc->r;
 
-  W30_L("</pre>");
+  W_L("</pre>");
   chtml30->pre_flag--;
 
   return chtml30->out;
@@ -2208,17 +2208,40 @@ s_chtml30_end_pre_tag(void *pdoc, Node *UNUSED(child))
  * @return The conversion result is returned.
  */
 static char *
-s_chtml30_start_p_tag(void *pdoc, Node *UNUSED(node)
+s_chtml30_start_p_tag(void *pdoc, Node *node
 {
   chtml30_t     *chtml30;
   Doc           *doc;
   request_rec   *r;
+  Attr          *attr;
+  char          *align = NULL;
 
   chtml30 = GET_CHTML30(pdoc);
   doc     = chtml30->doc;
   r       = doc->r;
 
-  W30_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 chtml30->out;
 }
@@ -2243,7 +2266,7 @@ s_chtml30_end_p_tag(void* pdoc, Node* UNUSED(child))
   doc     = chtml30->doc;
   r       = doc->r;
 
-  W30_L("</p>");
+  W_L("</p>");
 
   return chtml30->out;
 }
@@ -2258,17 +2281,38 @@ s_chtml30_end_p_tag(void* pdoc, Node* UNUSED(child))
  * @return The conversion result is returned.
  */
 static char *
-s_chtml30_start_ol_tag(void *pdoc, Node *UNUSED(node)) 
+s_chtml30_start_ol_tag(void *pdoc, Node *node)
 {
   chtml30_t     *chtml30;
   Doc           *doc;
   request_rec   *r;
+  Attr          *attr;
 
   chtml30 = GET_CHTML30(pdoc);
   doc     = chtml30->doc;
   r       = doc->r;
 
-  W30_L("<ol>");
+  W_L("<ol");
+  /*--------------------------------------------------------------------------*/
+  /* Get Attributes                                                           */
+  /*--------------------------------------------------------------------------*/
+  for (attr = qs_get_attr(doc,node);
+       attr;
+       attr = qs_get_next_attr(doc,attr)) {
+    char *name = qs_get_attr_name(doc,attr);
+    char *value = qs_get_attr_value(doc,attr);
+    if (STRCASEEQ('t','T',"type",name) && value && (*value == '1' || *value == 'a' || *value == 'A')) {
+      W_L(" type=\"");
+      W_V(value);
+      W_L("\"");
+    }
+    else if (STRCASEEQ('s','S',"start",name) && value && *value) {
+      W_L(" start=\"");
+      W_V(value);
+      W_L("\"");
+    }
+  }
+  W_L(">");
 
   return chtml30->out;
 }
@@ -2293,7 +2337,7 @@ s_chtml30_end_ol_tag(void *pdoc, Node *UNUSED(node))
   doc     = chtml30->doc;
   r       = doc->r;
 
-  W30_L("</ol>");
+  W_L("</ol>");
 
   return chtml30->out;
 }
@@ -2307,18 +2351,39 @@ s_chtml30_end_ol_tag(void *pdoc, Node *UNUSED(node))
  * @param node   [i]   The LI tag node is specified.
  * @return The conversion result is returned.
  */
-static char*
-s_chtml30_start_li_tag(void* pdoc, Node* UNUSED(node)
+static char *
+s_chtml30_start_li_tag(void *pdoc, Node *node
 {
-  chtml30_t*    chtml30;
-  Doc*          doc;
-  request_rec*  r;
+  chtml30_t *chtml30;
+  Doc *doc;
+  request_rec *r;
+  Attr *attr;
 
   chtml30 = GET_CHTML30(pdoc);
   doc     = chtml30->doc;
   r       = doc->r;
 
-  W30_L("<li>");
+  W_L("<li");
+  /*--------------------------------------------------------------------------*/
+  /* Get Attributes                                                           */
+  /*--------------------------------------------------------------------------*/
+  for (attr = qs_get_attr(doc,node);
+       attr;
+       attr = qs_get_next_attr(doc,attr)) {
+    char *name = qs_get_attr_name(doc,attr);
+    char *value = qs_get_attr_value(doc,attr);
+    if (STRCASEEQ('t','T',"type",name) && value && (*value == '1' || *value == 'a' || *value == 'A')) {
+      W_L(" type=\"");
+      W_V(value);
+      W_L("\"");
+    }
+    else if (STRCASEEQ('v','V',"value", name) && value && *value) {
+      W_L(" value=\"");
+      W_V(value);
+      W_L("\"");
+    }
+  }
+  W_L(">");
 
   return chtml30->out;
 }
@@ -2336,15 +2401,7 @@ static char *
 s_chtml30_end_li_tag(void *pdoc, Node *UNUSED(child)) 
 {
   chtml30_t     *chtml30;
-  Doc           *doc;
-  request_rec   *r;
-
   chtml30 = GET_CHTML30(pdoc);
-  doc     = chtml30->doc;
-  r       = doc->r;
-
-  W30_L("</li>");
-
   return chtml30->out;
 }
 
@@ -2358,17 +2415,35 @@ s_chtml30_end_li_tag(void *pdoc, Node *UNUSED(child))
  * @return The conversion result is returned.
  */
 static char *
-s_chtml30_start_h1_tag(void *pdoc, Node *UNUSED(node)) 
+s_chtml30_start_h1_tag(void *pdoc, Node *node)
 {
   chtml30_t     *chtml30;
   Doc           *doc;
   request_rec   *r;
+  Attr          *attr;
 
   chtml30 = GET_CHTML30(pdoc);
   doc     = chtml30->doc;
   r       = doc->r;
 
-  W30_L("<h1>\r\n");
+  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);
+    if (STRCASEEQ('a','A',"align", name)) {
+      if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
+        W_L(" align=\"");
+        W_V(value);
+        W_L("\"");
+        break;
+      }
+    }
+  }
+  W_L(">");
 
   return chtml30->out;
 }
@@ -2393,7 +2468,7 @@ s_chtml30_end_h1_tag(void* pdoc, Node* UNUSED(child))
   doc     = chtml30->doc;
   r       = doc->r;
 
-  W30_L("</h1>\r\n");
+  W_L("</h1>");
 
   return chtml30->out;
 }
@@ -2407,19 +2482,36 @@ s_chtml30_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*
-s_chtml30_start_h2_tag(void* pdoc, Node* UNUSED(node)) 
+static char *
+s_chtml30_start_h2_tag(void *pdoc, Node *node)
 {
-  chtml30_t*    chtml30;
-  Doc*          doc;
-  request_rec*  r;
+  chtml30_t     *chtml30;
+  Doc           *doc;
+  request_rec   *r;
+  Attr          *attr;
 
   chtml30 = GET_CHTML30(pdoc);
   doc     = chtml30->doc;
   r       = doc->r;
 
-  W30_L("<h2>\r\n");
-
+  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);
+    if (STRCASEEQ('a','A',"align", name)) {
+      if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
+        W_L(" align=\"");
+        W_V(value);
+        W_L("\"");
+        break;
+      }
+    }
+  }
+  W_L(">");
   return chtml30->out;
 }
 
@@ -2432,18 +2524,18 @@ s_chtml30_start_h2_tag(void* pdoc, Node* UNUSED(node))
  * @param node   [i]   The H2 tag node is specified.
  * @return The conversion result is returned.
  */
-static char*
-s_chtml30_end_h2_tag(void* pdoc, Node* UNUSED(child)) 
+static char *
+s_chtml30_end_h2_tag(void *pdoc, Node *UNUSED(child)) 
 {
-  chtml30_t*    chtml30;
-  Doc*          doc;
-  request_rec*  r;
+  chtml30_t *chtml30;
+  Doc *doc;
+  request_rec *r;
 
   chtml30 = GET_CHTML30(pdoc);
   doc     = chtml30->doc;
   r       = doc->r;
 
-  W30_L("</h2>\r\n");
+  W_L("</h2>");
 
   return chtml30->out;
 }
@@ -2457,18 +2549,36 @@ s_chtml30_end_h2_tag(void* pdoc, Node* UNUSED(child))
  * @param node   [i]   The H3 tag node is specified.
  * @return The conversion result is returned.
  */
-static char*
-s_chtml30_start_h3_tag(void* pdoc, Node* UNUSED(node)) 
+static char *
+s_chtml30_start_h3_tag(void *pdoc, Node *node)
 {
-  chtml30_t*    chtml30;
-  Doc*          doc;
-  request_rec*  r;
-
+  chtml30_t *chtml30;
+  Doc *doc;
+  request_rec   *r;
+  Attr          *attr;
+
   chtml30 = GET_CHTML30(pdoc);
   doc     = chtml30->doc;
   r       = doc->r;
 
-  W30_L("<h3>\r\n");
+  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);
+    if (STRCASEEQ('a','A',"align", name)) {
+      if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
+        W_L(" align=\"");
+        W_V(value);
+        W_L("\"");
+        break;
+      }
+    }
+  }
+  W_L(">");
 
   return chtml30->out;
 }
@@ -2482,18 +2592,18 @@ s_chtml30_start_h3_tag(void* pdoc, Node* UNUSED(node))
  * @param node   [i]   The H3 tag node is specified.
  * @return The conversion result is returned.
  */
-static char*
-s_chtml30_end_h3_tag(void* pdoc, Node* UNUSED(child)) 
+static char *
+s_chtml30_end_h3_tag(void *pdoc, Node *UNUSED(child))
 {
-  chtml30_t*    chtml30;
-  Doc*          doc;
-  request_rec*  r;
+  chtml30_t *chtml30;
+  Doc *doc;
+  request_rec *r;
 
   chtml30 = GET_CHTML30(pdoc);
   doc   = chtml30->doc;
   r     = doc->r;
 
-  W30_L("</h3>\r\n");
+  W_L("</h3>");
 
   return chtml30->out;
 }
@@ -2507,19 +2617,36 @@ s_chtml30_end_h3_tag(void* pdoc, Node* UNUSED(child))
  * @param node   [i]   The H4 tag node is specified.
  * @return The conversion result is returned.
  */
-static char*
-s_chtml30_start_h4_tag(void* pdoc, Node* UNUSED(node)) 
+static char *
+s_chtml30_start_h4_tag(void *pdoc, Node *node)
 {
-  chtml30_t*    chtml30;
-  Doc*          doc;
-  request_rec*  r;
+  chtml30_t *chtml30;
+  Doc *doc;
+  request_rec *r;
+  Attr *attr;
 
   chtml30 = GET_CHTML30(pdoc);
   doc     = chtml30->doc;
   r       = doc->r;
 
-  W30_L("<h4>\r\n");
-
+  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);
+    if (STRCASEEQ('a','A',"align", name)) {
+      if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
+        W_L(" align=\"");
+        W_V(value);
+        W_L("\"");
+        break;
+      }
+    }
+  }
+  W_L(">");
   return chtml30->out;
 }
 
@@ -2532,18 +2659,18 @@ s_chtml30_start_h4_tag(void* pdoc, Node* UNUSED(node))
  * @param node   [i]   The H4 tag node is specified.
  * @return The conversion result is returned.
  */
-static char*
-s_chtml30_end_h4_tag(void* pdoc, Node* UNUSED(child)) 
+static char *
+s_chtml30_end_h4_tag(void *pdoc, Node *UNUSED(child)) 
 {
-  chtml30_t*    chtml30;
-  Doc*          doc;
-  request_rec*  r;
+  chtml30_t *chtml30;
+  Doc *doc;
+  request_rec *r;
 
   chtml30 = GET_CHTML30(pdoc);
   doc     = chtml30->doc;
   r       = doc->r;
 
-  W30_L("</h4>\r\n");
+  W_L("</h4>");
 
   return chtml30->out;
 }
@@ -2557,19 +2684,36 @@ s_chtml30_end_h4_tag(void* pdoc, Node* UNUSED(child))
  * @param node   [i]   The H5 tag node is specified.
  * @return The conversion result is returned.
  */
-static char*
-s_chtml30_start_h5_tag(void* pdoc, Node* UNUSED(node)) 
+static char *
+s_chtml30_start_h5_tag(void *pdoc, Node *node)
 {
-  chtml30_t*    chtml30;
-  Doc*          doc;
-  request_rec*  r;
+  chtml30_t *chtml30;
+  Doc *doc;
+  request_rec *r;
+  Attr *attr;
 
   chtml30 = GET_CHTML30(pdoc);
   doc     = chtml30->doc;
   r       = doc->r;
 
-  W30_L("<h5>\r\n");
-
+  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);
+    if (STRCASEEQ('a','A',"align", name)) {
+      if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
+        W_L(" align=\"");
+        W_V(value);
+        W_L("\"");
+        break;
+      }
+    }
+  }
+  W_L(">");
   return chtml30->out;
 }
 
@@ -2593,7 +2737,7 @@ s_chtml30_end_h5_tag(void* pdoc, Node* UNUSED(child))
   doc     = chtml30->doc;
   r       = doc->r;
 
-  W30_L("</h5>\r\n");
+  W_L("</h5>");
 
   return chtml30->out;
 }
@@ -2607,19 +2751,36 @@ s_chtml30_end_h5_tag(void* pdoc, Node* UNUSED(child))
  * @param node   [i]   The H6 tag node is specified.
  * @return The conversion result is returned.
  */
-static char*
-s_chtml30_start_h6_tag(void* pdoc, Node* UNUSED(node)) 
+static char *
+s_chtml30_start_h6_tag(void *pdoc, Node *node)
 {
-  chtml30_t*    chtml30;
-  Doc*          doc;
-  request_rec*  r;
+  chtml30_t *chtml30;
+  Doc *doc;
+  request_rec *r;
+  Attr *attr;
 
   chtml30 = GET_CHTML30(pdoc);
   doc     = chtml30->doc;
   r       = doc->r;
 
-  W30_L("<h6>\r\n");
-
+  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);
+    if (STRCASEEQ('a','A',"align", name)) {
+      if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
+        W_L(" align=\"");
+        W_V(value);
+        W_L("\"");
+        break;
+      }
+    }
+  }
+  W_L(">");
   return chtml30->out;
 }
 
@@ -2643,7 +2804,7 @@ s_chtml30_end_h6_tag(void* pdoc, Node* UNUSED(child))
   doc     = chtml30->doc;
   r       = doc->r;
 
-  W30_L("</h6>\r\n");
+  W_L("</h6>");
 
   return chtml30->out;
 }
@@ -2671,33 +2832,41 @@ s_chtml30_start_textarea_tag(void* pdoc, Node* node)
 
   chtml30->textarea_flag++;
 
-  W30_L("<textarea ");
-
+  W_L("<textarea");
   for (attr = qs_get_attr(doc,node);
        attr;
        attr = qs_get_next_attr(doc,attr)) {
 
     char* name  = qs_get_attr_name(doc,attr);
     char* value = qs_get_attr_value(doc,attr);
-
-    if (STRCASEEQ('n','N',"name", name)) {
-      W30_L(" name=\"");
-      W30_V(value);
-      W30_L("\"");
+    if (STRCASEEQ('a','A',"accesskey",name) && value && *value != 0) {
+      W_L(" accesskey=\"");
+      W_V(value);
+      W_L("\"");
     }
-    else if (STRCASEEQ('r','R',"rows", name)) {
-      W30_L(" rows=\"");
-      W30_V(value);
-      W30_L("\"");
+    else if (STRCASEEQ('i','I',"istyle", name) && value && (*value == '1' || *value == '2' || *value == '3' || *value == '4')) {
+      W_L(" istyle=\"");
+      W_V(value);
+      W_L("\"");
     }
-    else if (STRCASEEQ('c','C',"cols", name)) {
-      W30_L(" cols=\"");
-      W30_V(value);
-      W30_L("\"");
+    else if (STRCASEEQ('n','N',"name", name) && value && *value) {
+      W_L(" name=\"");
+      W_V(value);
+      W_L("\"");
+    }
+    else if (STRCASEEQ('r','R',"rows", name) && value && *value) {
+      W_L(" rows=\"");
+      W_V(value);
+      W_L("\"");
+    }
+    else if (STRCASEEQ('c','C',"cols", name) && value && *value) {
+      W_L(" cols=\"");
+      W_V(value);
+      W_L("\"");
     }
   }
 
-  W30_L(">\r\n");
+  W_L(">");
 
   return chtml30->out;
 }
@@ -2722,7 +2891,7 @@ s_chtml30_end_textarea_tag(void* pdoc, Node* UNUSED(child))
   doc     = chtml30->doc;
   r       = doc->r;
 
-  W30_L("</textarea>\r\n");
+  W_L("</textarea>");
   chtml30->textarea_flag--;
 
   return chtml30->out;
@@ -2744,23 +2913,23 @@ s_chtml30_chxjif_tag(void* pdoc, Node* node)
   for (child = qs_get_child_node(doc, node);
        child;
        child = qs_get_next_node(doc, child)) {
-    W30_V(child->otext);
+    W_V(child->otext);
     s_chtml30_chxjif_tag(chtml30, child);
   }
 
   return NULL;
 }
 
-static char*
-s_chtml30_text_tag(void* pdoc, Node* child)
+static char *
+s_chtml30_text_tag(void *pdoc, Node *child)
 {
-  chtml30_t*    chtml30;
-  Doc*          doc;
-  request_rec*  r;
+  chtml30_t *chtml30;
+  Doc *doc;
+  request_rec *r;
 
-  char*   textval;
-  char*   tmp;
-  char*   tdst;
+  char *textval;
+  char *tmp;
+  char *tdst;
   char    one_byte[2];
   int     ii;
   int     tdst_len;
@@ -2770,9 +2939,9 @@ s_chtml30_text_tag(void* pdoc, Node* child)
   r       = doc->r;
   
   textval = qs_get_node_value(doc,child);
-  textval = qs_trim_string(doc->buf.pool, textval);
-  if (strlen(textval) == 0)
+  if (strlen(textval) == 0) {
     return chtml30->out;
+  }
   
   tmp = apr_palloc(r->pool, qs_get_node_size(doc,child)+1);
   memset(tmp, 0, qs_get_node_size(doc,child)+1);
@@ -2810,11 +2979,391 @@ s_chtml30_text_tag(void* pdoc, Node* child)
       tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
     }
   }
-  W30_V(tdst);
+  W_V(tdst);
+
+  return chtml30->out;
+}
+
+
+/**
+ * It is a handler who processes the BLOCKQUOTE tag.
+ *
+ * @param pdoc  [i/o] The pointer to the CHTML structure at the output
+ *                     destination is specified.
+ * @param node   [i]   The BLOCKQUOTE tag node is specified.
+ * @return The conversion result is returned.
+ */
+static char *
+s_chtml30_start_blockquote_tag(void *pdoc, Node *UNUSED(child))
+{
+  chtml30_t *chtml30;
+  Doc *doc;
+  chtml30 = GET_CHTML30(pdoc);
+  doc     = chtml30->doc;
+  W_L("<blockquote>");
+  return chtml30->out;
+}
+
+
+/**
+ * It is a handler who processes the BLOCKQUOTE tag.
+ *
+ * @param pdoc  [i/o] The pointer to the CHTML structure at the output
+ *                     destination is specified.
+ * @param node   [i]   The BLOCKQUOTE tag node is specified.
+ * @return The conversion result is returned.
+ */
+static char *
+s_chtml30_end_blockquote_tag(void *pdoc, Node *UNUSED(child))
+{
+  chtml30_t *chtml30;
+  Doc *doc;
+
+  chtml30 = GET_CHTML30(pdoc);
+  doc     = chtml30->doc;
+  W_L("</blockquote>");
+  return chtml30->out;
+}
+
+
+/**
+ * It is a handler who processes the DIR tag.
+ *
+ * @param pdoc  [i/o] The pointer to the CHTML structure at the output
+ *                     destination is specified.
+ * @param node   [i]   The DIR tag node is specified.
+ * @return The conversion result is returned.
+ */
+static char *
+s_chtml30_start_dir_tag(void *pdoc, Node *UNUSED(child))
+{
+  chtml30_t *chtml30 = GET_CHTML30(pdoc);
+  Doc *doc = chtml30->doc;
+  W_L("<dir>");
+  return chtml30->out;
+}
+
+
+/**
+ * It is a handler who processes the DIR tag.
+ *
+ * @param pdoc  [i/o] The pointer to the CHTML structure at the output
+ *                     destination is specified.
+ * @param node   [i]   The DIR tag node is specified.
+ * @return The conversion result is returned.
+ */
+static char *
+s_chtml30_end_dir_tag(void *pdoc, Node *UNUSED(child))
+{
+  chtml30_t *chtml30 = GET_CHTML30(pdoc);
+  Doc *doc = chtml30->doc;
+  W_L("</dir>");
+  return chtml30->out;
+}
+
+
+/**
+ * It is a handler who processes the DL tag.
+ *
+ * @param pdoc  [i/o] The pointer to the CHTML structure at the output
+ *                     destination is specified.
+ * @param node   [i]   The DL tag node is specified.
+ * @return The conversion result is returned.
+ */
+static char *
+s_chtml30_start_dl_tag(void *pdoc, Node *UNUSED(child))
+{
+  chtml30_t *chtml30 = GET_CHTML30(pdoc);
+  Doc *doc = chtml30->doc;
+  W_L("<dl>");
+  return chtml30->out;
+}
+
+
+/**
+ * It is a handler who processes the DL tag.
+ *
+ * @param pdoc  [i/o] The pointer to the CHTML structure at the output
+ *                     destination is specified.
+ * @param node   [i]   The DL tag node is specified.
+ * @return The conversion result is returned.
+ */
+static char *
+s_chtml30_end_dl_tag(void *pdoc, Node *UNUSED(child))
+{
+  chtml30_t *chtml30 = GET_CHTML30(pdoc);
+  Doc *doc = chtml30->doc;
+  W_L("</dl>");
+  return chtml30->out;
+}
+
+
+/**
+ * It is a handler who processes the DT tag.
+ *
+ * @param pdoc  [i/o] The pointer to the CHTML structure at the output
+ *                     destination is specified.
+ * @param node   [i]   The DT tag node is specified.
+ * @return The conversion result is returned.
+ */
+static char *
+s_chtml30_start_dt_tag(void *pdoc, Node *UNUSED(child))
+{
+  chtml30_t *chtml30;
+  Doc *doc;
+  chtml30 = GET_CHTML30(pdoc);
+  doc     = chtml30->doc;
+  W_L("<dt>");
+  return chtml30->out;
+}
+
+
+/**
+ * It is a handler who processes the DT tag.
+ *
+ * @param pdoc  [i/o] The pointer to the CHTML structure at the output
+ *                     destination is specified.
+ * @param node   [i]   The DT tag node is specified.
+ * @return The conversion result is returned.
+ */
+static char *
+s_chtml30_end_dt_tag(void *pdoc, Node *UNUSED(child))
+{
+  chtml30_t *chtml30;
+  chtml30 = GET_CHTML30(pdoc);
+  return chtml30->out;
+}
+
+
+/**
+ * It is a handler who processes the DD tag.
+ *
+ * @param pdoc  [i/o] The pointer to the CHTML structure at the output
+ *                     destination is specified.
+ * @param node   [i]   The DD tag node is specified.
+ * @return The conversion result is returned.
+ */
+static char *
+s_chtml30_start_dd_tag(void *pdoc, Node *UNUSED(child))
+{
+  chtml30_t *chtml30 = GET_CHTML30(pdoc);
+  Doc *doc = chtml30->doc;
+  W_L("<dd>");
+  return chtml30->out;
+}
+
+
+/**
+ * It is a handler who processes the DD tag.
+ *
+ * @param pdoc  [i/o] The pointer to the CHTML structure at the output
+ *                     destination is specified.
+ * @param node   [i]   The DD tag node is specified.
+ * @return The conversion result is returned.
+ */
+static char *
+s_chtml30_end_dd_tag(void *pdoc, Node *UNUSED(child))
+{
+  chtml30_t *chtml30 = GET_CHTML30(pdoc);
+  return chtml30->out;
+}
+
+
+/**
+ * It is a handler who processes the MARQUEE tag.
+ *
+ * @param pdoc  [i/o] The pointer to the CHTML structure at the output
+ *                     destination is specified.
+ * @param node   [i]   The MARQUEE tag node is specified.
+ * @return The conversion result is returned.
+ */
+static char *
+s_chtml30_start_marquee_tag(void *pdoc, Node *node)
+{
+  chtml30_t *chtml30 = GET_CHTML30(pdoc);
+  Doc *doc = chtml30->doc;
+  Attr *attr;
+  W_L("<marquee");
+  /*--------------------------------------------------------------------------*/
+  /* Get Attributes                                                           */
+  /*--------------------------------------------------------------------------*/
+  for (attr = qs_get_attr(doc,node);
+       attr;
+       attr = qs_get_next_attr(doc,attr)) {
+    char *name   = qs_get_attr_name(doc,attr);
+    char *value  = qs_get_attr_value(doc,attr);
+    if (STRCASEEQ('d','D',"direction", name)) {
+      if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value))) {
+        W_L(" direction=\"");
+        W_V(value);
+        W_L("\"");
+      }
+    }
+    else if (STRCASEEQ('b','B',"behavior",name)) {
+      if (value && (STRCASEEQ('s','S',"scroll",value) || STRCASEEQ('s','S',"slide",value) || STRCASEEQ('a','A',"alternate",value))) {
+        W_L(" behavior=\""); 
+        W_V(value);
+        W_L("\"");
+      }
+    }
+    else if (STRCASEEQ('l','L',"loop",name)) {
+      if (value && *value) {
+        W_L(" loop=\"");
+        W_V(value);
+        W_L("\"");
+      }
+    }
+  }
+  W_L(">");
+  return chtml30->out;
+}
+
 
+/**
+ * It is a handler who processes the MARQUEE tag.
+ *
+ * @param pdoc  [i/o] The pointer to the CHTML structure at the output
+ *                     destination is specified.
+ * @param node   [i]   The MARQUEE tag node is specified.
+ * @return The conversion result is returned.
+ */
+static char *
+s_chtml30_end_marquee_tag(void *pdoc, Node *UNUSED(child))
+{
+  chtml30_t *chtml30 = GET_CHTML30(pdoc);
+  Doc *doc = chtml30->doc;
+  W_L("</marquee>");
   return chtml30->out;
 }
 
+
+/**
+ * It is a hanblinker who processes the BLINK tag.
+ *
+ * @param pdoc  [i/o] The pointer to the CHTML structure at the output
+ *                     destination is specified.
+ * @param node   [i]   The BLINK tag node is specified.
+ * @return The conversion result is returned.
+ */
+static char *
+s_chtml30_start_blink_tag(void *pdoc, Node *UNUSED(child))
+{
+  chtml30_t *chtml30 = GET_CHTML30(pdoc);
+  Doc *doc = chtml30->doc;
+  W_L("<blink>");
+  return chtml30->out;
+}
+
+
+/**
+ * It is a hanblinker who processes the BLINK tag.
+ *
+ * @param pdoc  [i/o] The pointer to the CHTML structure at the output
+ *                     destination is specified.
+ * @param node   [i]   The BLINK tag node is specified.
+ * @return The conversion result is returned.
+ */
+static char *
+s_chtml30_end_blink_tag(void *pdoc, Node *UNUSED(child))
+{
+  chtml30_t *chtml30 = GET_CHTML30(pdoc);
+  Doc *doc = chtml30->doc;
+  W_L("</blink>");
+  return chtml30->out;
+}
+
+
+/**
+ * It is a handler 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_chtml30_start_menu_tag(void *pdoc, Node *UNUSED(child))
+{
+  chtml30_t *chtml30;
+  Doc *doc;
+  chtml30 = GET_CHTML30(pdoc);
+  doc     = chtml30->doc;
+  W_L("<menu>");
+  return chtml30->out;
+}
+
+
+/**
+ * It is a handler 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_chtml30_end_menu_tag(void *pdoc, Node *UNUSED(child))
+{
+  chtml30_t *chtml30 = GET_CHTML30(pdoc);
+  Doc *doc = chtml30->doc;
+  W_L("</menu>");
+  return chtml30->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_chtml30_start_plaintext_tag(void *pdoc, Node *node)
+{
+  chtml30_t *chtml30;
+  Doc *doc;
+
+  chtml30 = GET_CHTML30(pdoc);
+  doc     = chtml30->doc;
+  W_L("<plaintext>");
+  s_chtml30_start_plaintext_tag_inner(pdoc,node);
+  return chtml30->out;
+}
+
+static char *
+s_chtml30_start_plaintext_tag_inner(void *pdoc, Node *node)
+{
+  chtml30_t *chtml30;
+  Doc *doc;
+  Node *child;
+  chtml30 = GET_CHTML30(pdoc);
+  doc     = chtml30->doc;
+  for (child = qs_get_child_node(doc, node);
+       child;
+       child = qs_get_next_node(doc, child)) {
+    W_V(child->otext);
+    s_chtml30_start_plaintext_tag_inner(pdoc, child);
+  }
+  return chtml30->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_chtml30_end_plaintext_tag(void *pdoc, Node *UNUSED(child))
+{
+  chtml30_t *chtml30 = GET_CHTML30(pdoc);
+  return chtml30->out;
+}
 /*
  * vim:ts=2 et
  */