OSDN Git Service

* Fixed warning
[modchxj/mod_chxj.git] / src / chxj_jxhtml.c
index afe049b..ea94c38 100755 (executable)
@@ -137,6 +137,8 @@ static char *s_jxhtml_style_tag       (void *pdoc, Node *node);
 static char *s_jxhtml_start_object_tag     (void *pdoc, Node *node);
 static char *s_jxhtml_end_object_tag       (void *pdoc, Node *node);
 static char *s_jxhtml_start_param_tag     (void *pdoc, Node *node);
+static char *s_jxhtml_start_caption_tag     (void *pdoc, Node *node);
+static char *s_jxhtml_end_caption_tag       (void *pdoc, Node *node);
 
 static void  s_init_jxhtml(jxhtml_t *jxhtml, Doc *doc, request_rec *r, device_table *spec);
 
@@ -438,6 +440,11 @@ tag_handler jxhtml_handler[] = {
     s_jxhtml_start_param_tag,
     NULL,
   },
+  /* tagCAPTION */
+  {
+    s_jxhtml_start_caption_tag,
+    s_jxhtml_end_caption_tag,
+  },
 };
 
 
@@ -486,7 +493,9 @@ chxj_convert_jxhtml(
 
   jxhtml.entryp = entryp;
   jxhtml.cookie = cookie;
-
+  if (strcasecmp(spec->output_encoding,"UTF-8") == 0 ){
+    apr_table_setn(r->headers_out,HTTP_X_CHXJ_SET_CONTENT_TYPE,"application/xhtml+xml; charset=UTF-8");
+  }
   chxj_set_content_type(r, chxj_header_inf_set_content_type(r, "application/xhtml+xml; charset=Windows-31J"));
 
   /*--------------------------------------------------------------------------*/
@@ -713,7 +722,9 @@ s_jxhtml_start_html_tag(void *pdoc, Node *UNUSED(node))
   r      = doc->r;
   DBG(r, "REQ[%X] start s_jxhtml_start_html_tag()", TO_ADDR(r));
 
-  W_L("<?xml version=\"1.0\" encoding=\"Shift_JIS\" ?>");
+  W_L("<?xml version=\"1.0\" encoding=\"");
+  W_V(jxhtml->spec->output_encoding);
+  W_L("\" ?>");
   W_NLCODE();
   W_L("<!DOCTYPE html PUBLIC \"-//J-PHONE//DTD XHTML Basic 1.0 Plus//EN\" \"xhtml-basic10-plus.dtd\">");
   W_NLCODE();
@@ -1110,7 +1121,7 @@ s_jxhtml_start_body_tag(void *pdoc, Node *node)
   }
 
   if (IS_CSS_ON(jxhtml->entryp)) {
-    css_prop_list_t *style = s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
+    css_prop_list_t *style = s_jxhtml_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");
@@ -1365,7 +1376,7 @@ s_jxhtml_start_a_tag(void *pdoc, Node *node)
   W_L(">");
 
   if (IS_CSS_ON(jxhtml->entryp)) {
-    s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
+    s_jxhtml_nopush_and_get_now_style(pdoc, node, attr_style);
   }
 
   return jxhtml->out;
@@ -1616,7 +1627,7 @@ s_jxhtml_start_table_tag(void *pdoc, Node *node)
   }
   if (attr_height){
     W_L(" height=\"");
-    W_L(attr_height);
+    W_V(attr_height);
     W_L("\"");
   }
   if (attr_width){
@@ -2080,7 +2091,7 @@ s_jxhtml_start_font_tag(void *pdoc, Node *node)
     }
   }
   if (IS_CSS_ON(jxhtml->entryp)) {
-    css_prop_list_t *style = s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
+    css_prop_list_t *style = s_jxhtml_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");
@@ -2292,7 +2303,7 @@ s_jxhtml_start_form_tag(void *pdoc, Node *node)
     }
   }
   if (IS_CSS_ON(jxhtml->entryp)) {
-    css_prop_list_t *style = s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
+    css_prop_list_t *style = s_jxhtml_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");
@@ -2411,6 +2422,23 @@ s_jxhtml_end_form_tag(void *pdoc, Node *node)
   return jxhtml->out;
 }
 
+static char *
+s_jxhtml_istyle_to_wap_input_format(apr_pool_t *p, const char *s)
+{
+  if (s) {
+    switch (s[0]) {
+    case '1': return apr_psprintf(p, "&quot;*&lt;ja:h&gt;&quot;");
+    case '2': return apr_psprintf(p, "&quot;*&lt;ja:hk&gt;&quot;");
+    case '3': return apr_psprintf(p, "&quot;*&lt;ja:en&gt;&quot;");
+    case '4': return apr_psprintf(p, "&quot;*&lt;ja:n&gt;&quot;");
+    default:
+      return apr_pstrdup(p, "");
+    }
+  }
+
+  return apr_pstrdup(p,"");
+}
+
 
 /**
  * It is a handler who processes the INPUT tag.
@@ -2539,9 +2567,23 @@ s_jxhtml_start_input_tag(void *pdoc, Node *node)
     W_L(" istyle=\"");
     W_V(attr_istyle);
     W_L("\"");
+
+    char *vv = s_jxhtml_istyle_to_wap_input_format(doc->buf.pool,attr_istyle);
+    W_L(" style=\"");
+    W_L("-wrap-input-format:");
+    W_V(vv);
+    W_L(";");
+    W_L("\"");
   }
   else if(attr_type && STRCASEEQ('p','P',"password",attr_type)) {
     W_L(" istyle=\"4\"");
+
+    char *vv = s_jxhtml_istyle_to_wap_input_format(doc->buf.pool,"4");
+    W_L(" style=\"");
+    W_L("-wrap-input-format:");
+    W_V(vv);
+    W_L(";");
+    W_L("\"");
   }
   /*--------------------------------------------------------------------------*/
   /* The figure is default for the password.                                  */
@@ -2719,7 +2761,7 @@ s_jxhtml_start_center_tag(void *pdoc, Node *node)
     }
   }
   if (IS_CSS_ON(jxhtml->entryp)) {
-    css_prop_list_t *style = s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
+    css_prop_list_t *style = s_jxhtml_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");
@@ -2838,7 +2880,7 @@ s_jxhtml_start_li_tag(void *pdoc, Node *node)
     }
   }
   if (IS_CSS_ON(jxhtml->entryp)) {
-    css_prop_list_t *style = s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
+    css_prop_list_t *style = s_jxhtml_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;
@@ -2929,6 +2971,7 @@ s_jxhtml_start_ol_tag(void *pdoc, Node *node)
   char        *attr_style = NULL;
   char        *attr_start = NULL;
   char        *attr_type  = NULL;
+  char        *css_clear  = NULL;
 
   jxhtml = GET_JXHTML(pdoc);
   doc   = jxhtml->doc;
@@ -2961,9 +3004,11 @@ s_jxhtml_start_ol_tag(void *pdoc, Node *node)
     }
   }
   if (IS_CSS_ON(jxhtml->entryp)) {
-    css_prop_list_t *style = s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
+    css_prop_list_t *style = s_jxhtml_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 *clear_prop           = chxj_css_get_property_value(doc, style, "clear");
+      
       css_property_t *cur;
       for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
         if (STRCASEEQ('d','D',"decimal", cur->value)) {
@@ -2976,14 +3021,24 @@ s_jxhtml_start_ol_tag(void *pdoc, Node *node)
           attr_type = apr_pstrdup(doc->pool, "lower-alpha");
         }
       }
+      for (cur = clear_prop->next; cur != clear_prop; cur = cur->next) {
+        css_clear = apr_pstrdup(doc->pool, cur->value);
+      }
     }
   }
   W_L("<ol");
-  if (attr_type) {
+  if (attr_type || css_clear) {
     W_L(" style=\"");
-    W_L("list-style-type:");
-    W_V(attr_type);
-    W_L(";");
+    if (attr_type) {
+      W_L("list-style-type:");
+      W_V(attr_type);
+      W_L(";");
+    }
+    if (css_clear){
+      W_L("clear:");
+      W_V(css_clear);
+      W_L(";");
+    }
     W_L("\"");
   }
   if (attr_start) {
@@ -3068,7 +3123,7 @@ s_jxhtml_start_p_tag(void *pdoc, Node *node)
     }
   }
   if (IS_CSS_ON(jxhtml->entryp)) {
-    css_prop_list_t *style = s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
+    css_prop_list_t *style = s_jxhtml_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");
@@ -3169,6 +3224,7 @@ s_jxhtml_start_pre_tag(void *pdoc, Node *node)
   Doc       *doc   = jxhtml->doc;
   Attr      *attr;
   char      *attr_style = NULL;
+  char      *css_clear  = NULL;
 
   for (attr = qs_get_attr(doc,node);
        attr;
@@ -3181,11 +3237,27 @@ s_jxhtml_start_pre_tag(void *pdoc, Node *node)
   }
 
   if (IS_CSS_ON(jxhtml->entryp)) {
-    s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
+    css_prop_list_t *style = s_jxhtml_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) {
+        css_clear = apr_pstrdup(doc->pool, cur->value);
+      }
+    }
   }
 
   jxhtml->pre_flag++;
-  W_L("<pre>");
+  W_L("<pre");
+  if (css_clear) {
+    W_L(" style=\"");
+    W_L("clear:");
+    W_V(css_clear);
+    W_L(";");
+    W_L("\"");
+  }
+  W_L(">");
   return jxhtml->out;
 }
 
@@ -3230,6 +3302,8 @@ s_jxhtml_start_ul_tag(void *pdoc, Node *node)
   Attr     *attr;
   char     *attr_type = NULL;
   char     *attr_style = NULL;
+  char     *css_clear  = NULL;
+  
   /*--------------------------------------------------------------------------*/
   /* Get Attributes                                                           */
   /*--------------------------------------------------------------------------*/
@@ -3248,9 +3322,11 @@ s_jxhtml_start_ul_tag(void *pdoc, Node *node)
     }
   }
   if (IS_CSS_ON(jxhtml->entryp)) {
-    css_prop_list_t *style = s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
+    css_prop_list_t *style = s_jxhtml_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 *clear_prop           = chxj_css_get_property_value(doc, style, "clear");
+      
       css_property_t *cur;
       for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
         if (STRCASEEQ('d','D',"disc",cur->value)) {
@@ -3263,14 +3339,24 @@ s_jxhtml_start_ul_tag(void *pdoc, Node *node)
           attr_type = apr_pstrdup(doc->pool, "square");
         }
       }
+      for (cur = clear_prop->next; cur != clear_prop; cur = cur->next) {
+        css_clear = apr_pstrdup(doc->pool, cur->value);
+      }
     }
   }
   W_L("<ul");
-  if (attr_type) {
+  if (attr_type || css_clear) {
     W_L(" style=\"");
-    W_L("list-style-type:");
-    W_V(attr_type);
-    W_L(";");
+    if (attr_type ){
+      W_L("list-style-type:");
+      W_V(attr_type);
+      W_L(";");
+    }
+    if (css_clear){
+      W_L("clear:");
+      W_V(css_clear);
+      W_L(";");
+    }
     W_L("\"");
   }
   W_L(">");
@@ -3324,6 +3410,7 @@ s_jxhtml_start_hr_tag(void *pdoc, Node *node)
   
   char        *style_float  = NULL;
   char        *style_border_color = NULL;
+  char        *css_clear          = NULL;
 
   jxhtml   = GET_JXHTML(pdoc);
   doc     = jxhtml->doc;
@@ -3410,6 +3497,7 @@ s_jxhtml_start_hr_tag(void *pdoc, Node *node)
       css_property_t *bgcolor_prop      = chxj_css_get_property_value(doc, style, "background-color");
       css_property_t *float_prop        = chxj_css_get_property_value(doc, style, "float");
       css_property_t *border_color_prop = chxj_css_get_property_value(doc, style, "border-color");
+      css_property_t *clear_prop        = chxj_css_get_property_value(doc, style, "clear");
       css_property_t *cur;
       
       for (cur = border_style_prop->next; cur != border_style_prop; cur = cur->next) {
@@ -3418,11 +3506,7 @@ s_jxhtml_start_hr_tag(void *pdoc, Node *node)
         }
       }
       for (cur = height_prop->next; cur != height_prop; cur = cur->next) {
-        char *tmp = apr_pstrdup(doc->pool, cur->value);
-        char *tmpp = strstr(tmp, "px");
-        if (tmpp) { 
-          attr_size = apr_pstrdup(doc->pool, tmp);
-        }
+        attr_size = apr_pstrdup(doc->pool, cur->value);
       }
       if(!attr_color){
           for(cur = bgcolor_prop->next; cur != bgcolor_prop; cur = cur->next){
@@ -3462,6 +3546,9 @@ s_jxhtml_start_hr_tag(void *pdoc, Node *node)
           style_border_color = apr_pstrdup(doc->pool, tmp);
         }
       }
+      for (cur = clear_prop->next; cur != clear_prop; cur = cur->next) {
+        css_clear = apr_pstrdup(doc->pool, cur->value);
+      }
     }
   }
   W_L("<hr");
@@ -3477,12 +3564,12 @@ s_jxhtml_start_hr_tag(void *pdoc, Node *node)
       W_L("\"");
     }
   }
-  if (attr_size || attr_width || attr_noshade || style_border_color) {
+  if (attr_size || attr_width || attr_noshade || style_border_color || css_clear) {
     W_L(" style=\"");
     if (attr_size) {
       W_L("height:");
       W_V(attr_size);
-      if (!strstr(attr_size, "px")) {
+      if (chxj_chk_numeric(attr_size) == 0) {
         W_L("px");
       }
       W_L(";");
@@ -3503,6 +3590,11 @@ s_jxhtml_start_hr_tag(void *pdoc, Node *node)
       W_V(style_border_color);
       W_V(";");
     }
+    if (css_clear){
+      W_L("clear:");
+      W_V(css_clear);
+      W_L(";");
+    }
     W_L("\"");
   }
   if (attr_color) {
@@ -3551,7 +3643,6 @@ s_jxhtml_start_img_tag(void *pdoc, Node *node)
   char        *attr_src    = NULL;
   char        *attr_height = NULL;
   char        *attr_width  = NULL;
-  char        *attr_align  = NULL;
   char        *attr_alt    = NULL;
   char        *attr_style  = NULL;
   char        *attr_hspace = NULL;
@@ -3585,12 +3676,14 @@ s_jxhtml_start_img_tag(void *pdoc, Node *node)
       value = chxj_encoding_parameter(r, value, 1);
       value = chxj_jreserved_tag_to_safe_for_query_string(r, value, jxhtml->entryp, 1);
       value = chxj_add_cookie_no_update_parameter(r, value);
+      value = chxj_img_rewrite_parameter(r,jxhtml->conf,value);
       attr_src = value;
 #else
       value = chxj_img_conv(r, spec, value);
       value = chxj_encoding_parameter(r, value, 1);
       value = chxj_jreserved_tag_to_safe_for_query_string(r, value, jxhtml->entryp, 1);
       value = chxj_add_cookie_no_update_parameter(r, value);
+      value = chxj_img_rewrite_parameter(r,jxhtml->conf,value);
       attr_src = value;
 #endif
     }
@@ -3876,7 +3969,7 @@ s_jxhtml_start_select_tag(void *pdoc, Node *node)
   W_L(">");
 
   if (IS_CSS_ON(jxhtml->entryp)) {
-    s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
+    s_jxhtml_nopush_and_get_now_style(pdoc, node, attr_style);
   }
 
   return jxhtml->out;
@@ -3960,7 +4053,7 @@ s_jxhtml_start_option_tag(void *pdoc, Node *node)
   W_L(">");
 
   if (IS_CSS_ON(jxhtml->entryp)) {
-    s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
+    s_jxhtml_nopush_and_get_now_style(pdoc, node, attr_style);
   }
 
   return jxhtml->out;
@@ -4340,6 +4433,14 @@ s_jxhtml_start_textarea_tag(void *pdoc, Node *node)
     W_L(" istyle=\"");
     W_V(attr_istyle);
     W_L("\"");
+
+    char *vv = s_jxhtml_istyle_to_wap_input_format(doc->buf.pool,attr_istyle);
+        W_L(" style=\"");
+        W_L("-wap-input-format:");
+        W_V(vv);
+        W_L(";");
+        W_L("\"");
+
   }
   W_L(">");
   return jxhtml->out;
@@ -4502,6 +4603,7 @@ s_jxhtml_start_blockquote_tag(void *pdoc, Node *node)
   char     *attr_style = NULL;
   char     *attr_color = NULL;
   char     *attr_size  = NULL;
+  char     *css_clear  = NULL;
 
   jxhtml  = GET_JXHTML(pdoc);
   doc     = jxhtml->doc;
@@ -4515,10 +4617,12 @@ s_jxhtml_start_blockquote_tag(void *pdoc, Node *node)
     }
   }
   if (IS_CSS_ON(jxhtml->entryp)) {
-    css_prop_list_t *style = s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
+    css_prop_list_t *style = s_jxhtml_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");
+      css_property_t *clear_prop           = chxj_css_get_property_value(doc, style, "clear");
+      
       css_property_t *cur;
       for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
         if (cur->value && *cur->value) {
@@ -4550,10 +4654,13 @@ s_jxhtml_start_blockquote_tag(void *pdoc, Node *node)
           }
         }
       }
+      for (cur = clear_prop->next; cur != clear_prop; cur = cur->next) {
+        css_clear = apr_pstrdup(doc->pool, cur->value);
+      }
     }
   }
   W_L("<blockquote");
-  if (attr_color || attr_size) {
+  if (attr_color || attr_size || css_clear) {
     W_L(" style=\"");
     if (attr_color) {
       attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
@@ -4566,6 +4673,11 @@ s_jxhtml_start_blockquote_tag(void *pdoc, Node *node)
       W_V(attr_size);
       W_L(";");
     }
+    if (css_clear){
+      W_L("clear:");
+      W_V(css_clear);
+      W_L(";");
+    }
     W_L("\"");
   }
   W_L(">");
@@ -4627,7 +4739,7 @@ s_jxhtml_start_dir_tag(void *pdoc, Node *node)
     }
   }
   if (IS_CSS_ON(jxhtml->entryp)) {
-    css_prop_list_t *style = s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
+    css_prop_list_t *style = s_jxhtml_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");
@@ -4734,6 +4846,8 @@ s_jxhtml_start_dl_tag(void *pdoc, Node *node)
   char      *attr_style = NULL;
   char      *attr_color = NULL;
   char      *attr_size  = NULL;
+  char      *css_clear  = NULL;
+  
   for (attr = qs_get_attr(doc,node);
        attr;
        attr = qs_get_next_attr(doc,attr)) {
@@ -4744,10 +4858,12 @@ s_jxhtml_start_dl_tag(void *pdoc, Node *node)
     }
   }
   if (IS_CSS_ON(jxhtml->entryp)) {
-    css_prop_list_t *style = s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
+    css_prop_list_t *style = s_jxhtml_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");
+      css_property_t *clear_prop           = chxj_css_get_property_value(doc, style, "clear");
+      
       css_property_t *cur;
       for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
         if (cur->value && *cur->value) {
@@ -4779,10 +4895,13 @@ s_jxhtml_start_dl_tag(void *pdoc, Node *node)
           }
         }
       }
+      for (cur = clear_prop->next; cur != clear_prop; cur = cur->next) {
+        css_clear = apr_pstrdup(doc->pool, cur->value);
+      }
     }
   }
   W_L("<dl");
-  if (attr_color || attr_size) {
+  if (attr_color || attr_size || css_clear) {
     W_L(" style=\"");
     if (attr_color) {
       attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
@@ -4795,6 +4914,11 @@ s_jxhtml_start_dl_tag(void *pdoc, Node *node)
       W_V(attr_size);
       W_L(";");
     }
+    if (css_clear){
+      W_L("clear:");
+      W_V(css_clear);
+      W_L(";");
+    }
     W_L("\"");
   }
   W_L(">");
@@ -4850,7 +4974,7 @@ s_jxhtml_start_dt_tag(void *pdoc, Node *node)
     }
   }
   if (IS_CSS_ON(jxhtml->entryp)) {
-    css_prop_list_t *style = s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
+    css_prop_list_t *style = s_jxhtml_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");
@@ -4956,7 +5080,7 @@ s_jxhtml_start_dd_tag(void *pdoc, Node *node)
     }
   }
   if (IS_CSS_ON(jxhtml->entryp)) {
-    css_prop_list_t *style = s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
+    css_prop_list_t *style = s_jxhtml_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");
@@ -5073,7 +5197,7 @@ s_jxhtml_start_h1_tag(void *pdoc, Node *node)
     }
   }
   if (IS_CSS_ON(jxhtml->entryp)) {
-    css_prop_list_t *style = s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
+    css_prop_list_t *style = s_jxhtml_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");
@@ -5189,7 +5313,7 @@ s_jxhtml_start_h2_tag(void *pdoc, Node *node)
     }
   }
   if (IS_CSS_ON(jxhtml->entryp)) {
-    css_prop_list_t *style = s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
+    css_prop_list_t *style = s_jxhtml_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");
@@ -5304,7 +5428,7 @@ s_jxhtml_start_h3_tag(void *pdoc, Node *node)
     }
   }
   if (IS_CSS_ON(jxhtml->entryp)) {
-    css_prop_list_t *style = s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
+    css_prop_list_t *style = s_jxhtml_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");
@@ -5419,7 +5543,7 @@ s_jxhtml_start_h4_tag(void *pdoc, Node *node)
     }
   }
   if (IS_CSS_ON(jxhtml->entryp)) {
-    css_prop_list_t *style = s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
+    css_prop_list_t *style = s_jxhtml_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");
@@ -5535,7 +5659,7 @@ s_jxhtml_start_h5_tag(void *pdoc, Node *node)
     }
   }
   if (IS_CSS_ON(jxhtml->entryp)) {
-    css_prop_list_t *style = s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
+    css_prop_list_t *style = s_jxhtml_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");
@@ -5651,7 +5775,7 @@ s_jxhtml_start_h6_tag(void *pdoc, Node *node)
     }
   }
   if (IS_CSS_ON(jxhtml->entryp)) {
-    css_prop_list_t *style = s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
+    css_prop_list_t *style = s_jxhtml_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");
@@ -5762,7 +5886,7 @@ s_jxhtml_start_menu_tag(void *pdoc, Node *node)
     }
   }
   if (IS_CSS_ON(jxhtml->entryp)) {
-    css_prop_list_t *style = s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
+    css_prop_list_t *style = s_jxhtml_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");
@@ -5934,7 +6058,7 @@ s_jxhtml_start_blink_tag(void *pdoc, Node *node)
     }
   }
   if (IS_CSS_ON(jxhtml->entryp)) {
-    css_prop_list_t *style = s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
+    css_prop_list_t *style = s_jxhtml_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");
@@ -6066,7 +6190,7 @@ s_jxhtml_start_marquee_tag(void *pdoc, Node *node)
     }
   }
   if (IS_CSS_ON(jxhtml->entryp)) {
-    css_prop_list_t *style = s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
+    css_prop_list_t *style = s_jxhtml_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");
@@ -6326,7 +6450,7 @@ s_jxhtml_start_span_tag(void *pdoc, Node *node)
     }
   }
   if (IS_CSS_ON(jxhtml->entryp)) {
-    css_prop_list_t *style = s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
+    css_prop_list_t *style = s_jxhtml_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");
@@ -6668,7 +6792,6 @@ s_jxhtml_start_param_tag(void *pdoc, Node *node)
   Doc *doc = jxhtml->doc;
 
   Attr *attr;
-  char *attr_style         = NULL;
   char *attr_name          = NULL;
   char *attr_value         = NULL;
   char *attr_valuetype     = NULL;
@@ -6711,6 +6834,80 @@ s_jxhtml_start_param_tag(void *pdoc, Node *node)
   W_L(" />");
   return jxhtml->out;
 }
+/**
+ * It is a handler who processes the CAPTION tag.
+ *
+ * @param pdoc  [i/o] The pointer to the JXHTML 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_jxhtml_start_caption_tag(void *pdoc, Node *node)
+{
+  jxhtml_t    *jxhtml;
+  Doc         *doc;
+  request_rec *r;
+  Attr        *attr;
+  char        *attr_style = NULL;
+  char        *attr_align = NULL;
+
+  jxhtml = GET_JXHTML(pdoc);
+  doc    = jxhtml->doc;
+  r      = doc->r;
+
+  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("<caption");
+  if(attr_align){
+    W_L(" align=\"");
+    W_V(attr_align);
+    W_L("\"");
+  }
+  W_L(">");
+
+  return jxhtml->out;
+}
+
+
+/**
+ * It is a handler who processes the CAPTION tag.
+ *
+ * @param pdoc  [i/o] The pointer to the JXHTML 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_jxhtml_end_caption_tag(void *pdoc, Node *UNUSED(child)) 
+{
+  jxhtml_t*    jxhtml = GET_JXHTML(pdoc);
+  Doc*          doc   = jxhtml->doc;
+  
+  W_L("</caption>");
+  
+  return jxhtml->out;
+}
+
+
 /*
  * vim:ts=2 et
  */