OSDN Git Service

Add "caption" tag support for XHTML(i,ez,y!)
authorcoltware <coltware@94a86f0a-4377-0410-8349-a3afc59ff858>
Mon, 14 Dec 2009 21:17:29 +0000 (21:17 +0000)
committerAtsushi Konno <konn@users.sourceforge.jp>
Thu, 13 May 2010 16:27:00 +0000 (01:27 +0900)
12 files changed:
include/mod_chxj.h
src/chxj_chtml10.c
src/chxj_chtml20.c
src/chxj_chtml30.c
src/chxj_chtml40.c
src/chxj_chtml50.c
src/chxj_hdml.c
src/chxj_ixhtml10.c
src/chxj_jhtml.c
src/chxj_jxhtml.c
src/chxj_node_convert.c
src/chxj_xhtml_mobile_1_0.c

index 254d313..42c69cb 100644 (file)
@@ -283,6 +283,7 @@ typedef enum {
   tagNLMARK,      /* New Line Code */
   tagOBJECT,
   tagPARAM,
+  tagCAPTION,
 } tag_type;
 
 typedef struct mod_chxj_config mod_chxj_config;
index ffad546..e4fd52a 100644 (file)
@@ -441,6 +441,11 @@ tag_handler chtml10_handler[] = {
     NULL,
     NULL,
   },
+  /* tagCAPTION */
+  {
+    NULL,
+    NULL,
+  },
 };
 
 
index 0342ca0..9595b9c 100644 (file)
@@ -497,6 +497,11 @@ tag_handler chtml20_handler[] = {
     NULL,
     NULL,
   },
+  /* tagCAPTION */
+  {
+    NULL,
+    NULL,
+  },
 };
 
 /**
index 24e10aa..11c73e5 100644 (file)
@@ -496,6 +496,11 @@ tag_handler chtml30_handler[] = {
     NULL,
     NULL,
   },
+  /* tagCAPTION */
+  {
+    NULL,
+    NULL,
+  },
 };
 
 
index 864d225..fb099d3 100644 (file)
@@ -439,6 +439,11 @@ tag_handler chtml40_handler[] = {
     NULL,
     NULL,
   },
+  /* tagCAPTION */
+  {
+    NULL,
+    NULL,
+  },
 };
 
 
index f289e71..b4e975b 100644 (file)
@@ -419,6 +419,11 @@ tag_handler chtml50_handler[] = {
     NULL,
     NULL,
   },
+  /* tagCAPTION */
+  {
+    NULL,
+    NULL,
+  },
 };
 
 
index 4051ef7..9b02fd1 100644 (file)
@@ -386,6 +386,11 @@ tag_handler hdml_handler[] = {
     NULL,
     NULL,
   },
+  /* tagCAPTION */
+  {
+    NULL,
+    NULL,
+  },
 };
 
 /**
index 5c8b83f..c721dd3 100755 (executable)
@@ -139,6 +139,8 @@ static char *s_ixhtml10_end_small_tag      (void *pdoc, Node *node);
 static char *s_ixhtml10_start_object_tag    (void *pdoc, Node *node);
 static char *s_ixhtml10_end_object_tag      (void *pdoc, Node *node);
 static char *s_ixhtml10_start_param_tag    (void *pdoc, Node *node);
+static char *s_ixhtml10_start_caption_tag    (void *pdoc, Node *node);
+static char *s_ixhtml10_end_caption_tag      (void *pdoc, Node *node);
 
 static void  s_init_ixhtml10(ixhtml10_t *ixhtml10, Doc *doc, request_rec *r, device_table *spec);
 
@@ -442,6 +444,11 @@ tag_handler ixhtml10_handler[] = {
     s_ixhtml10_start_param_tag,
     NULL,
   },
+  /* tagCAPTION */
+  {
+    s_ixhtml10_start_caption_tag,
+    s_ixhtml10_end_caption_tag,
+  },
 };
 
 
@@ -6904,6 +6911,76 @@ s_ixhtml10_start_param_tag(void *pdoc, Node *node)
   return ixhtml10->out;
 }
 
+/**
+ * It is a handler who processes the CAPTION tag.
+ *
+ * @param pdoc  [i/o] The pointer to the IXHTML10 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_ixhtml10_start_caption_tag(void *pdoc, Node *node)
+{
+  ixhtml10_t    *ixhtml10;
+  Doc         *doc;
+  request_rec *r;
+  Attr        *attr;
+  char        *attr_style = NULL;
+  char        *attr_align = NULL;
+
+  ixhtml10   = GET_IXHTML10(pdoc);
+  doc     = ixhtml10->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 ixhtml10->out;
+}
+
+
+/**
+ * It is a handler who processes the CAPTION tag.
+ *
+ * @param pdoc  [i/o] The pointer to the IXHTML10 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_ixhtml10_end_caption_tag(void *pdoc, Node *UNUSED(node))
+{
+  ixhtml10_t *ixhtml10 = GET_IXHTML10(pdoc);
+  Doc *doc = ixhtml10->doc;
+
+  W_L("</caption>");
+  return ixhtml10->out;
+}
+
 /*
  * vim:ts=2 et
  */
index 6c9c297..79ef77f 100644 (file)
@@ -428,6 +428,11 @@ tag_handler jhtml_handler[] = {
     NULL,
     NULL,
   },
+  /* tagCAPTION */
+  {
+    NULL,
+    NULL,
+  },
 };
 
 
index 6e207c9..b642fae 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,
+  },
 };
 
 
@@ -6784,6 +6791,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
  */
index 848d47e..67fc8d1 100644 (file)
@@ -801,6 +801,19 @@ chxj_node_convert(
         if (handlers[tagCENTER].end_tag_handler)
           handlers[tagCENTER].end_tag_handler(pdoc, child);
       }
+      else
+      /*----------------------------------------------------------------------*/
+      /* <CAPTION>                                                            */
+      /*----------------------------------------------------------------------*/
+      if (strcasecmp(name, "caption") == 0) {
+        if (handlers[tagCAPTION].start_tag_handler) 
+          handlers[tagCAPTION].start_tag_handler(pdoc, child);
+
+        chxj_node_convert(spec, r, pdoc, doc, child, indent+1);
+
+        if (handlers[tagCAPTION].end_tag_handler)
+          handlers[tagCAPTION].end_tag_handler(pdoc, child);
+      }
       /*----------------------------------------------------------------------*/
       /* <CHXJ:IF>                                                            */
       /*----------------------------------------------------------------------*/
index f71fa76..1fb4556 100755 (executable)
@@ -133,6 +133,8 @@ 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);
@@ -433,6 +435,11 @@ tag_handler xhtml_handler[] = {
     s_xhtml_1_0_start_param_tag,
     NULL,
   },
+  /* tagCAPTION */
+  {
+    s_xhtml_1_0_start_caption_tag,
+    s_xhtml_1_0_end_caption_tag,
+  },
 };
  
 /**
@@ -6455,6 +6462,74 @@ s_xhtml_1_0_start_param_tag(void *pdoc, Node *node)
   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
  */