OSDN Git Service

Merge branch 'master' into branch_0.13.0
[modchxj/mod_chxj.git] / src / chxj_xhtml_mobile_1_0.c
index 5829e64..09c792c 100755 (executable)
@@ -79,6 +79,10 @@ static char *s_xhtml_1_0_start_tr_tag     (void *pdoc, Node *node);
 static char *s_xhtml_1_0_end_tr_tag       (void *pdoc, Node *node);
 static char *s_xhtml_1_0_start_td_tag     (void *pdoc, Node *node);
 static char *s_xhtml_1_0_end_td_tag       (void *pdoc, Node *node);
+static char *s_xhtml_1_0_start_th_tag     (void *pdoc, Node *node);
+static char *s_xhtml_1_0_end_th_tag       (void *pdoc, Node *node);
+static char *s_xhtml_1_0_start_td_or_th_tag     (void *pdoc, Node *node,char *tagName);
+static char *s_xhtml_1_0_end_td_or_th_tag       (void *pdoc, Node *node,char *tagName);
 static char *s_xhtml_1_0_start_font_tag   (void *pdoc, Node *node);
 static char *s_xhtml_1_0_end_font_tag     (void *pdoc, Node *node);
 static char *s_xhtml_1_0_start_form_tag   (void *pdoc, Node *node);
@@ -126,6 +130,11 @@ static char *s_xhtml_1_0_link_tag           (void *pdoc, Node *node);
 static char *s_xhtml_1_0_start_span_tag      (void *pdoc, Node *node);
 static char *s_xhtml_1_0_end_span_tag        (void *pdoc, Node *node);
 static char *s_xhtml_1_0_style_tag        (void *pdoc, Node *node);
+static char *s_xhtml_1_0_start_object_tag    (void *pdoc, Node *node);
+static char *s_xhtml_1_0_end_object_tag      (void *pdoc, Node *node);
+static char *s_xhtml_1_0_start_param_tag     (void *pdoc, Node *node);
+static char *s_xhtml_1_0_start_caption_tag    (void *pdoc, Node *node);
+static char *s_xhtml_1_0_end_caption_tag      (void *pdoc, Node *node);
 
 static void  s_init_xhtml(xhtml_t *xhtml, Doc *doc, request_rec *r, device_table *spec);
 static int   s_xhtml_search_emoji(xhtml_t *xhtml, char *txt, char **rslt);
@@ -338,8 +347,8 @@ tag_handler xhtml_handler[] = {
   },
   /* tagTH */
   {
-    NULL,
-    NULL,
+    s_xhtml_1_0_start_th_tag,
+    s_xhtml_1_0_end_th_tag,
   },
   /* tagB */
   {
@@ -416,6 +425,21 @@ tag_handler xhtml_handler[] = {
     s_xhtml_1_0_newline_mark,
     NULL,
   },
+  /* tagObject */
+  {
+    s_xhtml_1_0_start_object_tag,
+    s_xhtml_1_0_end_object_tag,
+  },
+  /* tagParam */
+  {
+    s_xhtml_1_0_start_param_tag,
+    NULL,
+  },
+  /* tagCAPTION */
+  {
+    s_xhtml_1_0_start_caption_tag,
+    s_xhtml_1_0_end_caption_tag,
+  },
 };
  
 /**
@@ -462,6 +486,9 @@ chxj_convert_xhtml_mobile_1_0(
   xhtml.entryp = entryp;
   xhtml.cookie = cookie;
 
+  if (strcasecmp(spec->output_encoding,"UTF-8") == 0 ){
+    apr_table_setn(r->headers_out,HTTP_X_CHXJ_SET_CONTENT_TYPE,"text/html; charset=UTF-8");
+  }
   chxj_set_content_type(r, chxj_header_inf_set_content_type(r, "text/html; charset=Windows-31J"));
 
   /*--------------------------------------------------------------------------*/
@@ -750,7 +777,9 @@ s_xhtml_1_0_start_html_tag(void *pdoc, Node *UNUSED(node))
   /*--------------------------------------------------------------------------*/
   /* Add XML Declare                                                          */
   /*--------------------------------------------------------------------------*/
-  W_L("<?xml version=\"1.0\" encoding=\"Shift_JIS\"?>");
+  W_L("<?xml version=\"1.0\" encoding=\"");
+  W_V(xhtml->spec->output_encoding);
+  W_L("\"?>");
   W_NLCODE();
   /*--------------------------------------------------------------------------*/
   /* Add DocType                                                              */
@@ -1017,7 +1046,9 @@ s_xhtml_1_0_start_body_tag(void *pdoc, Node *node)
   char        *attr_bgcolor = NULL;
   char        *attr_text    = NULL;
   char        *attr_link    = NULL;
+  char        *attr_vlink   = NULL;
   char        *attr_style   = NULL;
+  char        *attr_background   = NULL;
 
   /*--------------------------------------------------------------------------*/
   /* Get Attributes                                                           */
@@ -1040,18 +1071,22 @@ s_xhtml_1_0_start_body_tag(void *pdoc, Node *node)
       /* ignore */
     }
     else if (STRCASEEQ('v','V',"vlink",name)) {
-      /* ignore */
+      attr_vlink = value;
     }
     else if (STRCASEEQ('s','S',"style",name) && value && *value) {
       attr_style = value;
     }
+    else if (STRCASEEQ('b','B',"background",name) && value && *value) {
+      attr_background = value;
+    }
   }
 
   if (IS_CSS_ON(xhtml->entryp)) {
-    css_prop_list_t *style = s_xhtml_1_0_push_and_get_now_style(pdoc, node, attr_style);
+    css_prop_list_t *style = s_xhtml_1_0_nopush_and_get_now_style(pdoc, node, attr_style);
     if (style) {
       css_property_t *color_prop      = chxj_css_get_property_value(doc, style, "color");
       css_property_t *bgcolor_prop    = chxj_css_get_property_value(doc, style, "background-color");
+      css_property_t *bgimage_prop    = chxj_css_get_property_value(doc, style, "background-image");
       css_property_t *cur;
       for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
         if (cur->value && *cur->value) {
@@ -1063,6 +1098,18 @@ s_xhtml_1_0_start_body_tag(void *pdoc, Node *node)
           attr_bgcolor = apr_pstrdup(doc->pool, cur->value);
         }
       }
+      for (cur = bgimage_prop->next; cur != bgimage_prop; cur = cur->next) {
+        if (cur->value && *cur->value) {
+          char *tmp = apr_pstrdup(doc->pool, cur->value);
+          char *tmps = strstr(tmp,"(");
+          if(tmps){
+            char *tmpe = strstr(tmp,")");
+            size_t len = strlen(tmps) - strlen(tmpe) -1 ;
+            tmps++;
+            attr_background = apr_pstrndup(doc->pool, tmps,len);
+          }
+        }
+      }
     }
     if (xhtml->style) {
       css_stylesheet_t *pseudos = chxj_find_pseudo_selectors(doc, xhtml->style);
@@ -1076,6 +1123,14 @@ s_xhtml_1_0_start_body_tag(void *pdoc, Node *node)
             }
           }
         }
+        else if (cur_sel->name && strcasecmp(cur_sel->name, "a:visited") == 0) {
+          css_property_t *cur;
+          for (cur = cur_sel->property_head.next; cur != &cur_sel->property_head; cur = cur->next) {
+            if (cur->name && strcasecmp(cur->name, "color") == 0) {
+              attr_vlink = apr_pstrdup(doc->pool, cur->value);
+            }
+          }
+        }
       }
     }
   }
@@ -1103,6 +1158,17 @@ s_xhtml_1_0_start_body_tag(void *pdoc, Node *node)
     W_V(attr_link);
     W_L("\"");
   }
+  if (attr_vlink) {
+    attr_vlink = chxj_css_rgb_func_to_value(doc->pool, attr_vlink);
+    W_L(" vlink=\"");
+    W_V(attr_vlink);
+    W_L("\"");
+  }
+  if (attr_background) {
+    W_L(" background=\"");
+    W_V(attr_background);
+    W_L("\"");
+  }
   W_L(">");
 
   return xhtml->out;
@@ -1124,9 +1190,11 @@ s_xhtml_1_0_end_body_tag(void *pdoc, Node *UNUSED(child))
   Doc           *doc   = xhtml->doc;
 
   W_L("</body>");
+  /*
   if (IS_CSS_ON(xhtml->entryp)) {
     chxj_css_pop_prop_list(xhtml->css_prop_stack);
   }
+  */
 
   return xhtml->out;
 }
@@ -1148,6 +1216,7 @@ s_xhtml_1_0_start_a_tag(void *pdoc, Node *node)
   request_rec *r     = doc->r;
   Attr        *attr;
   char        *attr_style = NULL;
+  char        *attr_id    = NULL;
 
   W_L("<a");
   /*--------------------------------------------------------------------------*/
@@ -1158,10 +1227,11 @@ s_xhtml_1_0_start_a_tag(void *pdoc, Node *node)
        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) && value && *value) {
-      W_L(" id=\"");
-      W_V(value);
-      W_L("\"");
+    if (STRCASEEQ('i','I',"id",name)){
+      attr_id = apr_pstrdup(doc->buf.pool, value);
+    }
+    else if (STRCASEEQ('n','N',"name",name)) {
+      attr_id = apr_pstrdup(doc->buf.pool, value);
     }
     else if (STRCASEEQ('h','H',"href", name) && value && *value) {
       value = chxj_encoding_parameter(r, value, 1);
@@ -1211,10 +1281,15 @@ s_xhtml_1_0_start_a_tag(void *pdoc, Node *node)
       attr_style = value;
     }
   }
+  if(attr_id){
+    W_L(" id=\"");
+    W_V(attr_id);
+    W_L("\"");
+  }
   W_L(">");
 
   if (IS_CSS_ON(xhtml->entryp)) {
-    s_xhtml_1_0_push_and_get_now_style(pdoc, node, attr_style);
+    s_xhtml_1_0_nopush_and_get_now_style(pdoc, node, attr_style);
   }
 
   return xhtml->out;
@@ -1281,17 +1356,19 @@ s_xhtml_1_0_start_br_tag(void *pdoc, Node *node)
     }
   }
   if (IS_CSS_ON(xhtml->entryp)) {
-    css_prop_list_t *style = s_xhtml_1_0_push_and_get_now_style(pdoc, node, attr_style);
+    css_prop_list_t *style = s_xhtml_1_0_nopush_and_get_now_style(pdoc, node, attr_style);
     if (style) {
       css_property_t *clear_prop = chxj_css_get_property_value(doc, style, "clear");
       css_property_t *cur;
       for (cur = clear_prop->next; cur != clear_prop; cur = cur->next) {
         if (cur->value && *cur->value) {
           if ( STRCASEEQ('l','L',"left",  cur->value)
-            || STRCASEEQ('r','R',"right", cur->value)
-            || STRCASEEQ('b','B',"both"  ,cur->value)) {
+            || STRCASEEQ('r','R',"right", cur->value)) {
             attr_clear = apr_pstrdup(doc->pool, cur->value);
           }
+          else if(STRCASEEQ('b','B',"both"  ,cur->value)) {
+            attr_clear = apr_pstrdup(doc->pool, "all");
+          }
         }
       }
     }
@@ -1629,7 +1706,7 @@ s_xhtml_1_0_end_tr_tag(void *pdoc, Node *UNUSED(child))
  * @return The conversion result is returned.
  */
 static char *
-s_xhtml_1_0_start_td_tag(void *pdoc, Node *node) 
+s_xhtml_1_0_start_td_or_th_tag(void *pdoc, Node *node,char *tagName) 
 {
   xhtml_t *xhtml = GET_XHTML(pdoc);
   Doc     *doc   = xhtml->doc;
@@ -1643,6 +1720,8 @@ s_xhtml_1_0_start_td_tag(void *pdoc, Node *node)
   char         *attr_bgcolor = NULL;
   char         *attr_colspan = NULL;
   char         *attr_rowspan = NULL;
+  char         *attr_width   = NULL;
+  char         *attr_height  = NULL;
   
   /*--------------------------------------------------------------------------*/
   /* Get Attributes                                                           */
@@ -1675,6 +1754,24 @@ s_xhtml_1_0_start_td_tag(void *pdoc, Node *node)
     else if (STRCASEEQ('r','R',"rowspan",name) && val && *val) {
       attr_rowspan = apr_pstrdup(doc->buf.pool, val);
     }
+    else if (STRCASEEQ('w','W',"width",name) && val && *val) {
+      char *tmp = strstr(val, "%");
+      if(tmp){
+        attr_width = apr_pstrdup(doc->buf.pool, val);
+      }
+      else{
+        attr_width = apr_psprintf(doc->buf.pool,"%spx",val);
+      }
+    }
+    else if (STRCASEEQ('h','H',"height",name) && val && *val) {
+      char *tmp = strstr(val, "%");
+      if(tmp){
+        attr_height = apr_pstrdup(doc->buf.pool, val);
+      }
+      else{
+        attr_height = apr_psprintf(doc->buf.pool,"%spx",val);
+      }
+    }
   }
   
   if (IS_CSS_ON(xhtml->entryp)) {
@@ -1683,6 +1780,8 @@ s_xhtml_1_0_start_td_tag(void *pdoc, Node *node)
       css_property_t *align_prop             = chxj_css_get_property_value(doc, style, "text-align");
       css_property_t *valign_prop            = chxj_css_get_property_value(doc, style, "vertical-align");
       css_property_t *bgcolor_prop           = chxj_css_get_property_value(doc, style, "background-color");
+      css_property_t *width_prop             = chxj_css_get_property_value(doc, style, "width");
+      css_property_t *height_prop            = chxj_css_get_property_value(doc, style, "height");
       
       css_property_t *cur;
       for (cur = align_prop->next; cur != align_prop; cur = cur->next) {
@@ -1699,10 +1798,17 @@ s_xhtml_1_0_start_td_tag(void *pdoc, Node *node)
         attr_bgcolor = apr_pstrdup(doc->pool, cur->value);
         attr_bgcolor = chxj_css_rgb_func_to_value(doc->pool, attr_bgcolor);
       }
+      for (cur = width_prop->next; cur != width_prop; cur = cur->next) {
+        attr_width = apr_pstrdup(doc->pool, cur->value);
+      }
+      for (cur = height_prop->next; cur != height_prop; cur = cur->next) {
+        attr_height = apr_pstrdup(doc->pool, cur->value);
+      }
     }
   }
 
-  W_L("<td");
+  W_L("<");
+  W_V(tagName);
   if (attr_align){
     W_L(" align=\"");
     W_V(attr_align);
@@ -1728,6 +1834,20 @@ s_xhtml_1_0_start_td_tag(void *pdoc, Node *node)
     W_V(attr_bgcolor);
     W_L("\"");
   }
+  if (attr_width || attr_height ){
+    W_L(" style=\"");
+    if (attr_width){
+      W_L("width:");
+      W_V(attr_width);
+      W_L(";");
+    }
+    if (attr_height){
+      W_L("height:");
+      W_V(attr_height);
+      W_L(";");
+    }
+    W_L("\"");
+  }
   W_L(">");
 
   return xhtml->out;
@@ -1743,17 +1863,77 @@ s_xhtml_1_0_start_td_tag(void *pdoc, Node *node)
  * @return The conversion result is returned.
  */
 static char *
-s_xhtml_1_0_end_td_tag(void *pdoc, Node *UNUSED(child)
+s_xhtml_1_0_end_td_or_th_tag(void *pdoc, Node *UNUSED(child),char *tagName
 {
   xhtml_t *xhtml = GET_XHTML(pdoc);
   Doc     *doc   = xhtml->doc;
 
-  W_L("</td>");
+  W_L("</");
+  W_V(tagName);
+  W_L(">");
 
   return xhtml->out;
 }
 
 /**
+ * It is a handler who processes the TD tag.
+ *
+ * @param pdoc  [i/o] The pointer to the XHTML structure at the output
+ *                     destination is specified.
+ * @param node   [i]   The TD tag node is specified.
+ * @return The conversion result is returned.
+ */
+static char *
+s_xhtml_1_0_start_td_tag(void *pdoc, Node *child) 
+{
+  return s_xhtml_1_0_start_td_or_th_tag(pdoc,child,"td"); 
+}
+
+/**
+ * It is a handler who processes the TD tag.
+ *
+ * @param pdoc  [i/o] The pointer to the XHTML structure at the output
+ *                     destination is specified.
+ * @param node   [i]   The TD tag node is specified.
+ * @return The conversion result is returned.
+ */
+static char *
+s_xhtml_1_0_end_td_tag(void *pdoc, Node *child) 
+{
+  return s_xhtml_1_0_end_td_or_th_tag(pdoc,child,"td"); 
+}
+
+/**
+ * It is a handler who processes the TD tag.
+ *
+ * @param pdoc  [i/o] The pointer to the XHTML structure at the output
+ *                     destination is specified.
+ * @param node   [i]   The TH tag node is specified.
+ * @return The conversion result is returned.
+ */
+static char *
+s_xhtml_1_0_start_th_tag(void *pdoc, Node *child) 
+{
+  return s_xhtml_1_0_start_td_or_th_tag(pdoc,child,"th"); 
+}
+
+/**
+ * It is a handler who processes the TD tag.
+ *
+ * @param pdoc  [i/o] The pointer to the XHTML structure at the output
+ *                     destination is specified.
+ * @param node   [i]   The TH tag node is specified.
+ * @return The conversion result is returned.
+ */
+static char *
+s_xhtml_1_0_end_th_tag(void *pdoc, Node *child) 
+{
+  return s_xhtml_1_0_end_td_or_th_tag(pdoc,child,"th"); 
+}
+
+
+
+/**
  * It is a handler who processes the FONT tag.
  *
  * @param pdoc  [i/o] The pointer to the XHTML structure at the output
@@ -1793,7 +1973,7 @@ s_xhtml_1_0_start_font_tag(void *pdoc, Node *node)
     }
   }
   if (IS_CSS_ON(xhtml->entryp)) {
-    css_prop_list_t *style = s_xhtml_1_0_push_and_get_now_style(pdoc, node, attr_style);
+    css_prop_list_t *style = s_xhtml_1_0_nopush_and_get_now_style(pdoc, node, attr_style);
     if (style) {
       css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
       css_property_t *size_prop  = chxj_css_get_property_value(doc, style, "font-size");
@@ -1942,6 +2122,7 @@ s_xhtml_1_0_start_form_tag(void *pdoc, Node *node)
   char        *attr_color  = NULL;
   char        *attr_align  = NULL;
   char        *attr_name   = NULL;
+  char        *css_clear   = NULL;
   char        *new_hidden_tag = NULL;
 
   /*--------------------------------------------------------------------------*/
@@ -1995,10 +2176,11 @@ s_xhtml_1_0_start_form_tag(void *pdoc, Node *node)
     }
   }
   if (IS_CSS_ON(xhtml->entryp)) {
-    css_prop_list_t *style = s_xhtml_1_0_push_and_get_now_style(pdoc, node, attr_style);
+    css_prop_list_t *style = s_xhtml_1_0_nopush_and_get_now_style(pdoc, node, attr_style);
     if (style) {
       css_property_t *text_align_prop = chxj_css_get_property_value(doc, style, "text-align");
       css_property_t *color_prop      = chxj_css_get_property_value(doc, style, "color");
+      css_property_t *clear_prop      = chxj_css_get_property_value(doc, style, "clear");
       css_property_t *cur;
       for (cur = text_align_prop->next; cur != text_align_prop; cur = cur->next) {
         if (STRCASEEQ('l','L',"left", cur->value)) {
@@ -2014,6 +2196,9 @@ s_xhtml_1_0_start_form_tag(void *pdoc, Node *node)
       for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
         attr_color = apr_pstrdup(doc->pool, cur->value);
       }
+      for (cur = clear_prop->next; cur != clear_prop; cur = cur->next) {
+        css_clear = apr_pstrdup(doc->pool, cur->value);
+      }
     }
   }
 
@@ -2050,6 +2235,12 @@ s_xhtml_1_0_start_form_tag(void *pdoc, Node *node)
     W_V(attr_name);
     W_L("\"");
   }
+  if (css_clear) {
+    W_L(" style=\"");
+    W_L("clear:");
+    W_V(css_clear);
+    W_L("\"");
+  }
   W_L(">");
 
   xhtml_flags_t *flg = (xhtml_flags_t *)apr_palloc(doc->pool, sizeof(xhtml_flags_t));
@@ -2422,7 +2613,7 @@ s_xhtml_1_0_start_center_tag(void *pdoc, Node *node)
     }
   }
   if (IS_CSS_ON(xhtml->entryp)) {
-    css_prop_list_t *style = s_xhtml_1_0_push_and_get_now_style(pdoc, node, attr_style);
+    css_prop_list_t *style = s_xhtml_1_0_nopush_and_get_now_style(pdoc, node, attr_style);
     if (style) {
       css_property_t *color_prop      = chxj_css_get_property_value(doc, style, "color");
       css_property_t *size_prop       = chxj_css_get_property_value(doc, style, "font-size");
@@ -2734,7 +2925,7 @@ s_xhtml_1_0_start_pre_tag(void *pdoc, Node *node)
   }
 
   if (IS_CSS_ON(xhtml->entryp)) {
-    s_xhtml_1_0_push_and_get_now_style(pdoc, node, attr_style);
+    s_xhtml_1_0_nopush_and_get_now_style(pdoc, node, attr_style);
   }
 
   xhtml->pre_flag++;
@@ -2806,7 +2997,7 @@ s_xhtml_1_0_start_p_tag(void *pdoc, Node *node)
     }
   }
   if (IS_CSS_ON(xhtml->entryp)) {
-    css_prop_list_t *style = s_xhtml_1_0_push_and_get_now_style(pdoc, node, attr_style);
+    css_prop_list_t *style = s_xhtml_1_0_nopush_and_get_now_style(pdoc, node, attr_style);
     if (style) {
       css_property_t *text_align_prop = chxj_css_get_property_value(doc, style, "text-align");
       css_property_t *color_prop      = chxj_css_get_property_value(doc, style, "color");
@@ -2926,7 +3117,7 @@ s_xhtml_1_0_start_ul_tag(void *pdoc, Node *node)
     }
   }
   if (IS_CSS_ON(xhtml->entryp)) {
-    css_prop_list_t *style = s_xhtml_1_0_push_and_get_now_style(pdoc, node, attr_style);
+    css_prop_list_t *style = s_xhtml_1_0_nopush_and_get_now_style(pdoc, node, attr_style);
     if (style) {
       css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "list-style-type");
       css_property_t *cur;
@@ -3011,7 +3202,7 @@ s_xhtml_1_0_start_h1_tag(void *pdoc, Node *node)
     }
   }
   if (IS_CSS_ON(xhtml->entryp)) {
-    css_prop_list_t *style = s_xhtml_1_0_push_and_get_now_style(pdoc, node, attr_style);
+    css_prop_list_t *style = s_xhtml_1_0_nopush_and_get_now_style(pdoc, node, attr_style);
     if (style) {
       css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
       css_property_t *clear_prop           = chxj_css_get_property_value(doc, style, "clear");
@@ -3116,7 +3307,7 @@ s_xhtml_1_0_start_h2_tag(void *pdoc, Node *node)
     }
   }
   if (IS_CSS_ON(xhtml->entryp)) {
-    css_prop_list_t *style = s_xhtml_1_0_push_and_get_now_style(pdoc, node, attr_style);
+    css_prop_list_t *style = s_xhtml_1_0_nopush_and_get_now_style(pdoc, node, attr_style);
     if (style) {
       css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
       css_property_t *clear_prop           = chxj_css_get_property_value(doc, style, "clear");
@@ -3221,7 +3412,7 @@ s_xhtml_1_0_start_h3_tag(void *pdoc, Node *node)
     }
   }
   if (IS_CSS_ON(xhtml->entryp)) {
-    css_prop_list_t *style = s_xhtml_1_0_push_and_get_now_style(pdoc, node, attr_style);
+    css_prop_list_t *style = s_xhtml_1_0_nopush_and_get_now_style(pdoc, node, attr_style);
     if (style) {
       css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
       css_property_t *clear_prop           = chxj_css_get_property_value(doc, style, "clear");
@@ -3327,7 +3518,7 @@ s_xhtml_1_0_start_h4_tag(void *pdoc, Node *node)
     }
   }
   if (IS_CSS_ON(xhtml->entryp)) {
-    css_prop_list_t *style = s_xhtml_1_0_push_and_get_now_style(pdoc, node, attr_style);
+    css_prop_list_t *style = s_xhtml_1_0_nopush_and_get_now_style(pdoc, node, attr_style);
     if (style) {
       css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
       css_property_t *clear_prop           = chxj_css_get_property_value(doc, style, "clear");
@@ -3389,7 +3580,7 @@ static char *
 s_xhtml_1_0_end_h4_tag(void *pdoc, Node *UNUSED(child)) 
 {
   xhtml_t *xhtml = GET_XHTML(pdoc);
-  Doc     *doc   = xhtml->doc;
+   Doc     *doc   = xhtml->doc;
 
   W_L("</h4>");
   if (IS_CSS_ON(xhtml->entryp)) {
@@ -3433,7 +3624,7 @@ s_xhtml_1_0_start_h5_tag(void *pdoc, Node *node)
     }
   }
   if (IS_CSS_ON(xhtml->entryp)) {
-    css_prop_list_t *style = s_xhtml_1_0_push_and_get_now_style(pdoc, node, attr_style);
+    css_prop_list_t *style = s_xhtml_1_0_nopush_and_get_now_style(pdoc, node, attr_style);
     if (style) {
       css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
       css_property_t *clear_prop           = chxj_css_get_property_value(doc, style, "clear");
@@ -3539,7 +3730,7 @@ s_xhtml_1_0_start_h6_tag(void *pdoc, Node *node)
     }
   }
   if (IS_CSS_ON(xhtml->entryp)) {
-    css_prop_list_t *style = s_xhtml_1_0_push_and_get_now_style(pdoc, node, attr_style);
+    css_prop_list_t *style = s_xhtml_1_0_nopush_and_get_now_style(pdoc, node, attr_style);
     if (style) {
       css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
       css_property_t *clear_prop           = chxj_css_get_property_value(doc, style, "clear");
@@ -3657,7 +3848,7 @@ s_xhtml_1_0_start_ol_tag(void *pdoc, Node *node)
     }
   }
   if (IS_CSS_ON(xhtml->entryp)) {
-    css_prop_list_t *style = s_xhtml_1_0_push_and_get_now_style(pdoc, node, attr_style);
+    css_prop_list_t *style = s_xhtml_1_0_nopush_and_get_now_style(pdoc, node, attr_style);
     if (style) {
       css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "list-style-type");
       css_property_t *cur;
@@ -3763,7 +3954,7 @@ s_xhtml_1_0_start_li_tag(void *pdoc, Node *node)
     }
   }
   if (IS_CSS_ON(xhtml->entryp)) {
-    css_prop_list_t *style = s_xhtml_1_0_push_and_get_now_style(pdoc, node, attr_style);
+    css_prop_list_t *style = s_xhtml_1_0_nopush_and_get_now_style(pdoc, node, attr_style);
     if (style) {
       css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "list-style-type");
       css_property_t *cur;
@@ -3879,6 +4070,7 @@ s_xhtml_1_0_start_img_tag(void *pdoc, Node *node)
       value = chxj_encoding_parameter(r, value, 1);
       value = chxj_add_cookie_parameter(r, value, xhtml->cookie);
       value = chxj_add_cookie_no_update_parameter(r, value);
+      value = chxj_img_rewrite_parameter(r,xhtml->conf,value);
 #ifdef IMG_NOT_CONVERT_FILENAME
       attr_src = value;
 
@@ -4156,7 +4348,7 @@ s_xhtml_1_0_start_select_tag(void *pdoc, Node *node)
   }
   W_L(">");
   if (IS_CSS_ON(xhtml->entryp)) {
-    s_xhtml_1_0_push_and_get_now_style(pdoc, node, attr_style);
+    s_xhtml_1_0_nopush_and_get_now_style(pdoc, node, attr_style);
   }
 
   return xhtml->out;
@@ -4233,7 +4425,7 @@ s_xhtml_1_0_start_option_tag(void *pdoc, Node *node)
   }
   W_L(">");
   if (IS_CSS_ON(xhtml->entryp)) {
-    s_xhtml_1_0_push_and_get_now_style(pdoc, node, attr_style);
+    s_xhtml_1_0_nopush_and_get_now_style(pdoc, node, attr_style);
   }
   return xhtml->out;
 }
@@ -4636,9 +4828,8 @@ s_xhtml_1_0_start_textarea_tag(void *pdoc, Node *node)
     W_L("\"");
   }
   if (attr_istyle) {
-    char *fmt = qs_conv_istyle_to_format(doc->r->pool, attr_istyle);
-    W_L(" FORMAT=\"*");
-    W_V(fmt);
+    W_L(" istyle=\"");
+    W_V(attr_istyle);
     W_L("\"");
   }
   W_L(">");
@@ -4759,7 +4950,7 @@ s_xhtml_1_0_start_blockquote_tag(void *pdoc, Node *node)
     }
   }
   if (IS_CSS_ON(xhtml->entryp)) {
-    css_prop_list_t *style = s_xhtml_1_0_push_and_get_now_style(pdoc, node, attr_style);
+    css_prop_list_t *style = s_xhtml_1_0_nopush_and_get_now_style(pdoc, node, attr_style);
     if (style) {
       css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
       css_property_t *font_size_prop = chxj_css_get_property_value(doc, style, "font-size");
@@ -4871,7 +5062,7 @@ s_xhtml_1_0_start_dir_tag(void *pdoc, Node *node)
     }
   }
   if (IS_CSS_ON(xhtml->entryp)) {
-    css_prop_list_t *style = s_xhtml_1_0_push_and_get_now_style(pdoc, node, attr_style);
+    css_prop_list_t *style = s_xhtml_1_0_nopush_and_get_now_style(pdoc, node, attr_style);
     if (style) {
       css_property_t *color_prop           = chxj_css_get_property_value(doc, style, "color");
       css_property_t *size_prop            = chxj_css_get_property_value(doc, style, "font-size");
@@ -4989,7 +5180,7 @@ s_xhtml_1_0_start_dl_tag(void *pdoc, Node *node)
     }
   }
   if (IS_CSS_ON(xhtml->entryp)) {
-    css_prop_list_t *style = s_xhtml_1_0_push_and_get_now_style(pdoc, node, attr_style);
+    css_prop_list_t *style = s_xhtml_1_0_nopush_and_get_now_style(pdoc, node, attr_style);
     if (style) {
       css_property_t *color_prop           = chxj_css_get_property_value(doc, style, "color");
       css_property_t *size_prop            = chxj_css_get_property_value(doc, style, "font-size");
@@ -5096,7 +5287,7 @@ s_xhtml_1_0_start_dt_tag(void *pdoc, Node *node)
     }
   }
   if (IS_CSS_ON(xhtml->entryp)) {
-    css_prop_list_t *style = s_xhtml_1_0_push_and_get_now_style(pdoc, node, attr_style);
+    css_prop_list_t *style = s_xhtml_1_0_nopush_and_get_now_style(pdoc, node, attr_style);
     if (style) {
       css_property_t *color_prop           = chxj_css_get_property_value(doc, style, "color");
       css_property_t *size_prop            = chxj_css_get_property_value(doc, style, "font-size");
@@ -5203,7 +5394,7 @@ s_xhtml_1_0_start_dd_tag(void *pdoc, Node *node)
     }
   }
   if (IS_CSS_ON(xhtml->entryp)) {
-    css_prop_list_t *style = s_xhtml_1_0_push_and_get_now_style(pdoc, node, attr_style);
+    css_prop_list_t *style = s_xhtml_1_0_nopush_and_get_now_style(pdoc, node, attr_style);
     if (style) {
       css_property_t *color_prop           = chxj_css_get_property_value(doc, style, "color");
       css_property_t *size_prop            = chxj_css_get_property_value(doc, style, "font-size");
@@ -5315,7 +5506,7 @@ s_xhtml_1_0_start_menu_tag(void *pdoc, Node *node)
     }
   }
   if (IS_CSS_ON(xhtml->entryp)) {
-    css_prop_list_t *style = s_xhtml_1_0_push_and_get_now_style(pdoc, node, attr_style);
+    css_prop_list_t *style = s_xhtml_1_0_nopush_and_get_now_style(pdoc, node, attr_style);
     if (style) {
       css_property_t *color_prop           = chxj_css_get_property_value(doc, style, "color");
       css_property_t *size_prop            = chxj_css_get_property_value(doc, style, "font-size");
@@ -5485,7 +5676,7 @@ s_xhtml_1_0_start_blink_tag(void *pdoc, Node *node)
     }
   }
   if (IS_CSS_ON(xhtml->entryp)) {
-    css_prop_list_t *style = s_xhtml_1_0_push_and_get_now_style(pdoc, node, attr_style);
+    css_prop_list_t *style = s_xhtml_1_0_nopush_and_get_now_style(pdoc, node, attr_style);
     if (style) {
       css_property_t *color_prop           = chxj_css_get_property_value(doc, style, "color");
       css_property_t *size_prop            = chxj_css_get_property_value(doc, style, "font-size");
@@ -5621,7 +5812,7 @@ s_xhtml_1_0_start_marquee_tag(void *pdoc, Node *node)
     }
   }
   if (IS_CSS_ON(xhtml->entryp)) {
-    css_prop_list_t *style = s_xhtml_1_0_push_and_get_now_style(pdoc, node, attr_style);
+    css_prop_list_t *style = s_xhtml_1_0_nopush_and_get_now_style(pdoc, node, attr_style);
     if (style) {
       css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
       css_property_t *size_prop  = chxj_css_get_property_value(doc, style, "font-size");
@@ -5916,7 +6107,7 @@ s_xhtml_1_0_start_span_tag(void *pdoc, Node *node)
     }
   }
   if (IS_CSS_ON(xhtml->entryp)) {
-    css_prop_list_t *style = s_xhtml_1_0_push_and_get_now_style(pdoc, node, attr_style);
+    css_prop_list_t *style = s_xhtml_1_0_nopush_and_get_now_style(pdoc, node, attr_style);
     if (style) {
       css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
       css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
@@ -6070,9 +6261,7 @@ s_xhtml_1_0_end_span_tag(void *pdoc, Node *UNUSED(node))
   Doc *doc = xhtml->doc;
 
   W_L("</span>");
-  if (IS_CSS_ON(xhtml->entryp)) {
-    chxj_css_pop_prop_list(xhtml->css_prop_stack);
-  }
+
   return xhtml->out;
 }
 
@@ -6124,6 +6313,229 @@ s_xhtml_1_0_style_tag(void *pdoc, Node *node)
   }
   return xhtml->out;
 }
+
+/**
+ * It is a handler who processes the OBJECT tag.
+ *
+ * @param pdoc  [i/o] The pointer to the XHTML structure at the output
+ *                     destination is specified.
+ * @param node   [i]   The OBJECT tag node is specified.
+ * @return The conversion result is returned.
+ */
+static char *
+s_xhtml_1_0_start_object_tag(void *pdoc, Node *node)
+{
+  xhtml_t *xhtml = GET_XHTML(pdoc);
+  Doc *doc = xhtml->doc;
+
+  Attr *attr;
+  
+  char *attr_id            = NULL;
+  char *attr_width         = NULL;
+  char *attr_height        = NULL;
+  char *attr_data          = NULL;
+  char *attr_type          = NULL;
+  
+  /*--------------------------------------------------------------------------*/
+  /* 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('i','I',"id",name)) {
+      attr_id = apr_pstrdup(doc->pool, value);
+    }
+    else if (STRCASEEQ('w','W',"width",name)) {
+      attr_width = apr_pstrdup(doc->pool, value);
+    }
+    else if (STRCASEEQ('h','H',"height",name)) {
+      attr_height = apr_pstrdup(doc->pool, value);
+    }
+    else if (STRCASEEQ('d','D',"data",name)) {
+      attr_data = apr_pstrdup(doc->pool, value);
+    }
+    else if  (STRCASEEQ('t','T',"type",name)) {
+      attr_type = apr_pstrdup(doc->pool, value);
+    }
+  }
+  W_L("<object");
+  
+  if(attr_id){
+    W_L(" id=\"");
+    W_V(attr_id);
+    W_L("\"");
+  }
+  if(attr_width){
+    W_L(" width=\"");
+    W_V(attr_width);
+    W_L("\"");
+  }
+  if(attr_height){
+    W_L(" height=\"");
+    W_V(attr_height);
+    W_L("\"");
+  }
+  if(attr_data){
+    W_L(" data=\"");
+    W_V(attr_data);
+    W_L("\"");
+  }
+  if(attr_type){
+    W_L(" type=\"");
+    W_V(attr_type);
+    W_L("\"");
+  }
+  
+  W_L(">");
+  return xhtml->out;
+}
+
+/**
+ * It is a handler who processes the OBJECT tag.
+ *
+ * @param pdoc  [i/o] The pointer to the XHTML structure at the output
+ *                     destination is specified.
+ * @param node   [i]   The OBJECT tag node is specified.
+ * @return The conversion result is returned.
+ */
+static char *
+s_xhtml_1_0_end_object_tag(void *pdoc, Node *UNUSED(node))
+{
+  xhtml_t *xhtml = GET_XHTML(pdoc);
+  Doc *doc = xhtml->doc;
+
+  W_L("</object>");
+  return xhtml->out;
+}
+
+/**
+ * It is a handler who processes the OBJECT tag.
+ *
+ * @param pdoc  [i/o] The pointer to the XHTML structure at the output
+ *                     destination is specified.
+ * @param node   [i]   The OBJECT tag node is specified.
+ * @return The conversion result is returned.
+ */
+static char *
+s_xhtml_1_0_start_param_tag(void *pdoc, Node *node)
+{
+  xhtml_t *xhtml = GET_XHTML(pdoc);
+  Doc *doc = xhtml->doc;
+
+  Attr *attr;
+  char *attr_style         = NULL;
+  char *attr_name          = NULL;
+  char *attr_value         = NULL;
+  char *attr_valuetype     = NULL;
+  
+  /*--------------------------------------------------------------------------*/
+  /* 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('n','N',"name",name)) {
+      attr_name = apr_pstrdup(doc->pool, value);
+    }
+    else if (STRCASEEQ('v','V',"value",name)) {
+      attr_value = apr_pstrdup(doc->pool, value);
+    }
+    else if (STRCASEEQ('v','V',"valuetype",name)) {
+      attr_valuetype = apr_pstrdup(doc->pool, value);
+    }
+  }
+  W_L("<param");
+  
+  if(attr_name){
+    W_L(" name=\"");
+    W_V(attr_name);
+    W_L("\"");
+  }
+  if(attr_value){
+    W_L(" value=\"");
+    W_V(attr_value);
+    W_L("\"");
+  }
+  if(attr_valuetype){
+    W_L(" valuetype=\"");
+    W_V(attr_valuetype);
+    W_L("\"");
+  }
+  W_L(" />");
+  return xhtml->out;
+}
+/**
+ * It is a handler who processes the CAPTION tag.
+ *
+ * @param pdoc  [i/o] The pointer to the XHTML structure at the output
+ *                     destination is specified.
+ * @param node   [i]   The CAPTION tag node is specified.
+ * @return The conversion result is returned.
+ */
+static char *
+s_xhtml_1_0_start_caption_tag(void *pdoc, Node *node) 
+{
+  xhtml_t *xhtml = GET_XHTML(pdoc);
+  Doc     *doc   = xhtml->doc;
+  Attr    *attr;
+  char    *attr_style = NULL;
+  char    *attr_align = NULL;
+
+  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('a','A',"align", name)) {
+      if (value && 
+          (STRCASEEQ('l','L',"left",value) 
+        || STRCASEEQ('r','R',"right",value) 
+        || STRCASEEQ('t','T',"top",value)
+        || STRCASEEQ('b','B',"bottom",value) 
+        )) {
+        attr_align = value;
+      }
+    }
+    else if (STRCASEEQ('s','S',"style",name) && value && *value) {
+      attr_style = value;
+    }
+  }
+  
+  W_L("<h1");
+  if(attr_align){
+    W_L(" align=\"");
+    W_V(attr_align);
+    W_L("\"");
+  }
+  W_L(">");
+
+  return xhtml->out;
+}
+
+
+/**
+ * It is a handler who processes the CAPTION tag.
+ *
+ * @param pdoc  [i/o] The pointer to the XHTML structure at the output
+ *                     destination is specified.
+ * @param node   [i]   The CAPTION tag node is specified.
+ * @return The conversion result is returned.
+ */
+static char *
+s_xhtml_1_0_end_caption_tag(void *pdoc, Node *UNUSED(child)) 
+{
+  xhtml_t *xhtml = GET_XHTML(pdoc);
+  Doc     *doc   = xhtml->doc;
+
+  W_L("</caption>");
+  return xhtml->out;
+}
+
+
 /*
  * vim:ts=2 et
  */