[Pkg-ocaml-maint-commits] [tyxml] 11/19: Imported Upstream version 3.5.0

Mehdi Dogguy mehdi at moszumanska.debian.org
Sun Oct 18 09:55:49 UTC 2015


This is an automated email from the git hooks/post-receive script.

mehdi pushed a commit to branch master
in repository tyxml.

commit 6984fda69ac931167e0ec5720872e076e7f68cb7
Author: Mehdi Dogguy <mehdi at debian.org>
Date:   Sun Oct 18 11:16:21 2015 +0200

    Imported Upstream version 3.5.0
---
 .gitignore                |   4 ++-
 .merlin                   |   5 ++--
 CHANGES                   |  11 ++++++++
 _oasis                    |  15 ++++++++++-
 _tags                     |   9 ++++++-
 lib/META                  |  21 ++++++++++++----
 lib/html5_f.ml            |  30 +++++++++++-----------
 lib/html5_f.mli           |   6 +++--
 lib/html5_sigs.mli        |  10 +++++---
 lib/html5_types.mli       |   2 ++
 lib/svg_f.ml              |  60 +++++++++++++++++++++++++++++++++++++++++++-
 lib/svg_sigs.mli          |  17 +++++++++++++
 lib/svg_types.mli         |   5 ++--
 myocamlbuild.ml           |   5 ++--
 setup.exe                 | Bin 3510843 -> 0 bytes
 setup.ml                  |  62 ++++++++++++++++++++++++++++++++++++++++++----
 syntax/pa_tyxml.ml        |   2 +-
 tools/autoname.ml         |  21 ++++++++++++++++
 tools/tyxml_name.ml       |  46 ++++++++++++++++++++++++++++++++++
 tools/tyxml_name.mli      |  23 +++++++++++++++++
 tools/tyxml_tools.mldylib |   4 +++
 tools/tyxml_tools.mllib   |   4 +++
 22 files changed, 320 insertions(+), 42 deletions(-)

diff --git a/.gitignore b/.gitignore
index 18a2841..7386b66 100644
--- a/.gitignore
+++ b/.gitignore
@@ -8,4 +8,6 @@ setup.data
 setup.log
 **/*~
 setup.exe
-setup-dev.exe
\ No newline at end of file
+setup-dev.exe
+*.byte
+*.native
diff --git a/.merlin b/.merlin
index 4b95b98..1577ae4 100644
--- a/.merlin
+++ b/.merlin
@@ -1,8 +1,7 @@
 S lib
 S syntax
+S tools
 
-B _build
-B _build/lib
-B _build/syntax
+B _build/*
 
 PKG uutf
\ No newline at end of file
diff --git a/CHANGES b/CHANGES
index ecf01b5..75ed04e 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,3 +1,14 @@
+===== 3.5.0 ====
+
+  * Add Tyxml_name, which allows to derive tyxml identifiers from HTML
+    elements and attributes.
+  * Internally build the tool `autoname`, which applies the aftermentionned
+    transformation for the given elements/attributes.
+  * Fix typo in `datetime-local`.
+  * Add download attributes for area and tags.
+  * Add various svg `text` attributes.
+  * Fix namespaces issues related to svg elements inside html.
+
 ===== 3.4.0 ====
 
   * Add `a_lang` for HTML. Deprecate `a_srclang` in favor of `a_xml_lang`.
diff --git a/_oasis b/_oasis
index 54032aa..74c5e31 100644
--- a/_oasis
+++ b/_oasis
@@ -1,6 +1,6 @@
 OASISFormat: 0.4
 Name: tyxml
-Version: 3.4.0
+Version: 3.5.0
 Homepage: http://ocsigen.org/tyxml/
 Authors:
   Thorsten Ohl,
@@ -66,6 +66,19 @@ Library tyxml_f
     Html5_f
   BuildDepends: uutf
 
+Library tyxml_tools
+  FindlibName: tools
+  FindlibParent: tyxml
+  Path: tools
+  Modules: Tyxml_name
+  BuildDepends: bytes
+
+Executable autoname
+  Path: tools
+  MainIs: autoname.ml
+  Install: false
+  BuildDepends: tyxml.tools
+
 Library pa_tyxml
   Build$: flag(syntax)
   FindlibName: syntax
diff --git a/_tags b/_tags
index 30b56a6..45de19e 100644
--- a/_tags
+++ b/_tags
@@ -1,5 +1,5 @@
 # OASIS_START
-# DO NOT EDIT (digest: eb1c70f2a41e1c055bc2a938a29a8397)
+# DO NOT EDIT (digest: fa14ee70b6a48b09ce560d188d71cf18)
 # Ignore VCS directories, you can use the same kind of rule outside
 # OASIS_START/STOP if you want to exclude directories that contains
 # useless stuff for the build process
@@ -20,6 +20,13 @@ true: annot, bin_annot
 # Library tyxml_f
 "lib/tyxml_f.cmxs": use_tyxml_f
 <lib/*.ml{,i,y}>: pkg_uutf
+# Library tyxml_tools
+"tools/tyxml_tools.cmxs": use_tyxml_tools
+# Executable autoname
+"tools/autoname.byte": pkg_bytes
+"tools/autoname.byte": use_tyxml_tools
+<tools/*.ml{,i,y}>: pkg_bytes
+<tools/*.ml{,i,y}>: use_tyxml_tools
 # Library pa_tyxml
 "syntax/pa_tyxml.cmxs": use_pa_tyxml
 <syntax/*.ml{,i,y}>: pkg_camlp4
diff --git a/lib/META b/lib/META
index 6a94602..27591f5 100644
--- a/lib/META
+++ b/lib/META
@@ -1,6 +1,6 @@
 # OASIS_START
-# DO NOT EDIT (digest: 21543140a2f275b8126768fe97e820fa)
-version = "3.4.0"
+# DO NOT EDIT (digest: 021d471bb39b23f70df98da6742b16a3)
+version = "3.5.0"
 description = "HTML5 pages typed with polymorphic variants"
 requires = "str uutf"
 archive(byte) = "tyxml.cma"
@@ -8,8 +8,19 @@ archive(byte, plugin) = "tyxml.cma"
 archive(native) = "tyxml.cmxa"
 archive(native, plugin) = "tyxml.cmxs"
 exists_if = "tyxml.cma"
+package "tools" (
+ version = "3.5.0"
+ description = "HTML5 pages typed with polymorphic variants"
+ requires = "bytes"
+ archive(byte) = "tyxml_tools.cma"
+ archive(byte, plugin) = "tyxml_tools.cma"
+ archive(native) = "tyxml_tools.cmxa"
+ archive(native, plugin) = "tyxml_tools.cmxs"
+ exists_if = "tyxml_tools.cma"
+)
+
 package "syntax" (
- version = "3.4.0"
+ version = "3.5.0"
  description = "HTML5 and SVG syntax extension"
  requires = "bytes camlp4"
  archive(syntax, preprocessor) = "pa_tyxml.cma"
@@ -21,7 +32,7 @@ package "syntax" (
 )
 
 package "parser" (
- version = "3.4.0"
+ version = "3.5.0"
  description = "Simple XML parser"
  requires = "bytes camlp4.lib"
  archive(byte) = "tymlx_p.cma"
@@ -32,7 +43,7 @@ package "parser" (
 )
 
 package "functor" (
- version = "3.4.0"
+ version = "3.5.0"
  description =
  "HTML5 pages typed with polymorphic variants (Functor version)"
  requires = "uutf"
diff --git a/lib/html5_f.ml b/lib/html5_f.ml
index e2e248e..424fb4c 100644
--- a/lib/html5_f.ml
+++ b/lib/html5_f.ml
@@ -36,7 +36,8 @@ module MakeWrapped
     (W : Xml_wrap.T)
     (Xml : Xml_sigs.Wrapped with type 'a wrap = 'a W.t
                              and type 'a list_wrap = 'a W.tlist)
-    (Svg : Svg_sigs.T with module Xml := Xml)= struct
+    (Svg : Svg_sigs.T with module Xml := Xml
+                       and type 'a list_wrap = 'a W.tlist)= struct
 
   module Xml = Xml
 
@@ -282,6 +283,12 @@ module MakeWrapped
 
   let a_hreflang = string_attrib "hreflang"
 
+  let a_download file =
+    let f = function
+      | None -> ""
+      | Some s -> s
+    in user_attrib f "download" file
+
   let a_rel = linktypes_attrib "rel"
 
   let a_tabindex = int_attrib "tabindex"
@@ -523,16 +530,16 @@ module MakeWrapped
     let f = function
       | `Sizes sizes ->
 	 let buf = Buffer.create 17 in
-	 let size_fmt (w, h) = 
+	 let size_fmt (w, h) =
 	   Buffer.add_string buf (string_of_int w);
 	   Buffer.add_char buf 'x';
 	   Buffer.add_string buf (string_of_int h)
 	 in
 	 let rec sizes_fmt = function
 	   | [] -> ()
-	   | x :: [] -> 
+	   | x :: [] ->
 	      size_fmt x
-	   | x :: xs -> 
+	   | x :: xs ->
 	      size_fmt x;
 	      Buffer.add_char buf ' ';
 	      sizes_fmt xs
@@ -584,7 +591,7 @@ module MakeWrapped
       | `Image -> "image"
       | `Date -> "date"
       | `Datetime -> "datetime"
-      | `Datetime_local -> "datetime-locale"
+      | `Datetime_local -> "datetime-local"
       | `Color -> "color"
       | `Button -> "button"
       | `Hidden -> "hidden"
@@ -921,14 +928,8 @@ module MakeWrapped
 
   let form = star "form"
 
-  let svg ?(xmlns = "http://www.w3.org/2000/svg") ?(a = []) children =
-    let attribs =
-      string_attrib "xmlns" (W.return xmlns)
-      :: string_attrib "xmlns:xlink" (W.return "http://www.w3.org/1999/xlink")
-      :: Svg.to_xmlattribs a
-    in
-    star ~a:(attribs)
-      "svg" (W.map Svg.toelt children)
+  let svg ?(a = []) children =
+    Svg.toelt (Svg.svg ~a children)
 
   let input = terminal "input"
 
@@ -1066,7 +1067,8 @@ end
 
 module Make
     (Xml : Xml_sigs.T)
-    (Svg : Svg_sigs.T with module Xml := Xml) =
+    (Svg : Svg_sigs.T with module Xml := Xml
+                       and type 'a list_wrap = 'a Xml.list_wrap) =
   MakeWrapped
     (Xml_wrap.NoWrap)
     (Xml)
diff --git a/lib/html5_f.mli b/lib/html5_f.mli
index 88d1568..af9c6ab 100644
--- a/lib/html5_f.mli
+++ b/lib/html5_f.mli
@@ -23,7 +23,8 @@
 
 module Make
     (Xml : Xml_sigs.T)
-    (Svg : Svg_sigs.T with module Xml := Xml)
+    (Svg : Svg_sigs.T with module Xml := Xml
+                       and type 'a list_wrap = 'a Xml.list_wrap)
   : Html5_sigs.Make(Xml)(Svg).T
     with type +'a elt = Xml.elt
      and type +'a attrib = Xml.attrib
@@ -35,7 +36,8 @@ module MakeWrapped
     (W : Xml_wrap.T)
     (Xml : Xml_sigs.Wrapped with type 'a wrap = 'a W.t
                              and type 'a list_wrap = 'a W.tlist)
-    (Svg : Svg_sigs.T with module Xml := Xml)
+    (Svg : Svg_sigs.T with module Xml := Xml
+                       and type 'a list_wrap = 'a Xml.list_wrap)
   : Html5_sigs.MakeWrapped(W)(Xml)(Svg).T
     with type +'a elt = Xml.elt
      and type +'a attrib = Xml.attrib
diff --git a/lib/html5_sigs.mli b/lib/html5_sigs.mli
index ab69c02..a9b360d 100644
--- a/lib/html5_sigs.mli
+++ b/lib/html5_sigs.mli
@@ -134,9 +134,9 @@ module type T = sig
   val a_reversed : [< | `Reversed] wrap -> [> | `Reversed] attrib
 
   val a_sandbox :
-    [< 
-     | `AllowSameOrigin 
-     | `AllowForms 
+    [<
+     | `AllowSameOrigin
+     | `AllowForms
      | `AllowScript
      | `AllowPointerLock
      | `AllowPopups
@@ -310,6 +310,8 @@ module type T = sig
   (** This attribute specifies the base language of the resource
       designated by href and may only be used when href is specified. *)
 
+  val a_download : string option wrap -> [> | `Download] attrib
+
   val a_rel : linktypes wrap -> [> | `Rel] attrib
   (** This attribute describes the relationship from the current
       document to the anchor specified by the href attribute. The
@@ -559,7 +561,7 @@ module type T = sig
   val body : ([< | body_attrib], [< | body_content_fun], [> | body]) star
 
 
-  val svg : ?xmlns : string -> ?a : [< svg_attrib ] Svg.attrib list -> [< svg_content ] Svg.elt list_wrap -> [> svg ] elt
+  val svg : ?a : [< svg_attrib ] Svg.attrib list -> [< svg_content ] Svg.elt list_wrap -> [> svg ] elt
 
   (** {2 Section} *)
 
diff --git a/lib/html5_types.mli b/lib/html5_types.mli
index 0c3cf0b..429d099 100644
--- a/lib/html5_types.mli
+++ b/lib/html5_types.mli
@@ -1660,6 +1660,7 @@ type 'a a = [ | `A of 'a ]
 type a_ = [ `A of a_content ] (* should not be used as it may break *)
 type a_attrib =
   [ | common | `Href | `Hreflang | `Media | `Rel | `Target | `Mime_type
+    | `Download
   ]
 
 (* NAME: del, KIND: star, TYPE: [= common | `Cite | `Datetime ], 'a,[=`Del of 'a], ARG: 'a, ATTRIB:  OUT: [=`Del of 'a] *)
@@ -1816,6 +1817,7 @@ type area_attrib =
     | `Media
     | `Hreflang
     | `Mime_type
+    | `Download
   ]
 
 (* NAME: map, KIND: plus, TYPE: [=common | `Name ],'a, [=`Map of 'a], ARG: 'a, ATTRIB:  OUT: [=`Map of 'a] *)
diff --git a/lib/svg_f.ml b/lib/svg_f.ml
index 13d8c68..c5a22a2 100644
--- a/lib/svg_f.ml
+++ b/lib/svg_f.ml
@@ -339,6 +339,28 @@ struct
 
   let a_textlength = user_attrib string_of_length "textLength"
 
+  let a_text_anchor x =
+    let f = function
+      | `Start -> "start" | `Middle -> "middle"
+      | `End -> "end" | `Inherit -> "inherit" in
+    user_attrib f "text-anchor" x
+
+  let a_text_decoration x =
+    let f = function
+      | `None -> "none" | `Underline -> "underline"
+      | `Overline -> "overline" | `Line_through -> "line-through"
+      | `Blink -> "blink" | `Inherit -> "inherit" in
+    user_attrib f "text-decoration" x
+
+  let a_text_rendering x =
+    let f = function
+      | `Auto -> "auto"
+      | `OptimizeSpeed -> "optimizeSpeed"
+      | `OptimizeLegibility -> "optimizeLegibility"
+      | `GeometricPrecision -> "geometricPrecision"
+      | `Inherit -> "inherit" in
+    user_attrib f "text-rendering" x
+
   let a_rotate = user_attrib string_of_numbers "rotate"
 
   let a_startoffset = user_attrib string_of_length "startOffset"
@@ -827,6 +849,41 @@ struct
 
   let a_name = string_attrib "name"
 
+  let string_of_alignment_baseline = function
+    | `Auto -> "auto"
+    | `Baseline -> "baseline"
+    | `Before_edge -> "before-edge"
+    | `Text_before_edge -> "text-before-edge"
+    | `Middle -> "middle"
+    | `Central -> "central"
+    | `After_edge -> "after-edge"
+    | `Text_after_edge -> "text-after-edge"
+    | `Ideographic -> "ideographic"
+    | `Alphabetic -> "alphabetic"
+    | `Hanging-> "hanging"
+    | `Mathematical -> "mathematical"
+    | `Inherit -> "inherit"
+
+  let a_alignment_baseline x =
+    user_attrib string_of_alignment_baseline "alignment-baseline" x
+
+  let string_of_dominant_baseline = function
+    | `Auto -> "auto"
+    | `Use_script -> "use-script"
+    | `No_change -> "no-change"
+    | `Reset_size -> "reset-size"
+    | `Ideographic -> "ideographic"
+    | `Alphabetic -> "alphabetic"
+    | `Hanging -> "hanging"
+    | `Mathematical -> "mathematical"
+    | `Central -> "central"
+    | `Middle -> "middle"
+    | `Text_after_edge -> "text-after-edge"
+    | `Text_before_edge -> "text-before-edge"
+    | `Inherit -> "inherit"
+
+  let a_dominant_baseline x =
+    user_attrib string_of_dominant_baseline "dominant-baseline" x
 
   (** Javascript events *)
 
@@ -897,7 +954,8 @@ struct
   *)
   let svg ?(a = []) children =
     let attribs =
-      string_attrib "xmlns:xlink" (W.return "http://www.w3.org/1999/xlink")
+      string_attrib "xmlns" (W.return "http://www.w3.org/2000/svg")
+      :: string_attrib "xmlns:xlink" (W.return "http://www.w3.org/1999/xlink")
       :: to_xmlattribs a
     in
     star ~a:(attribs) "svg" (W.map toeltl children)
diff --git a/lib/svg_sigs.mli b/lib/svg_sigs.mli
index 1cd564a..985fec8 100644
--- a/lib/svg_sigs.mli
+++ b/lib/svg_sigs.mli
@@ -150,6 +150,12 @@ module type T = sig
 
   val a_textlength : Unit.length wrap -> [> | `TextLength ] attrib
 
+  val a_text_anchor : [< `Start | `Middle | `End | `Inherit ] wrap -> [> | `Text_Anchor ] attrib
+
+  val a_text_decoration : [< `None | `Underline | `Overline | `Line_through | `Blink | `Inherit ] wrap -> [> | `Text_Decoration ] attrib
+
+  val a_text_rendering : [< `Auto | `OptimizeSpeed | `OptimizeLegibility | `GeometricPrecision | `Inherit ] wrap -> [> | `Text_Rendering ] attrib
+
   val a_rotate : numbers wrap -> [> | `Rotate ] attrib
 
   val a_startoffset : Unit.length wrap -> [> | `StartOffset ] attrib
@@ -523,6 +529,17 @@ module type T = sig
 
   val a_name : string wrap -> [> | `Name ] attrib
 
+  val a_alignment_baseline :
+    [< | `Auto | `Baseline | `Before_edge | `Text_before_edge | `Middle
+       | `Central | `After_edge | `Text_after_edge | `Ideographic
+       | `Alphabetic | `Hanging | `Mathematical | `Inherit ] wrap ->
+    [> | `Alignment_Baseline ] attrib
+
+  val a_dominant_baseline :
+    [< | `Auto | `Use_script | `No_change | `Reset_size | `Ideographic
+       | `Alphabetic | `Hanging | `Mathematical | `Central | `Middle
+       | `Text_after_edge | `Text_before_edge | `Inherit ] wrap ->
+    [> | `Dominant_Baseline ] attrib
 
   (** Javascript events *)
 
diff --git a/lib/svg_types.mli b/lib/svg_types.mli
index 3289e7f..4c34bc1 100644
--- a/lib/svg_types.mli
+++ b/lib/svg_types.mli
@@ -162,7 +162,7 @@ type animation_addition_attr = [ | `Additive | `Accumulate ]
 
 type presentation_attr =
   [
-    | `Alignement_Baseline
+    | `Alignment_Baseline
     | `Baseline_Shift
     | `Clip
     | `Clip_Path
@@ -175,7 +175,7 @@ type presentation_attr =
     | `Cursor
     | `Direction
     | `Display
-    | `Dominant_baseline
+    | `Dominant_Baseline
     | `Enable_background
     | `Fill
     | `Fill_opacity
@@ -746,6 +746,7 @@ type text_attr =
     | core_attr
     | graphical_event_attr
     | presentation_attr
+    | `Class
     | `Transform
     | `LengthAdjust
     | `X_list
diff --git a/myocamlbuild.ml b/myocamlbuild.ml
index b7cce16..561c53b 100644
--- a/myocamlbuild.ml
+++ b/myocamlbuild.ml
@@ -21,7 +21,7 @@
 *)
 
 (* OASIS_START *)
-(* DO NOT EDIT (digest: db419e06c9afbb186094601c7cf28f8c) *)
+(* DO NOT EDIT (digest: 9c9509f12b10b2d15113fa1ad7a5b4a7) *)
 module OASISGettext = struct
 (* # 22 "src/oasis/OASISGettext.ml" *)
 
@@ -636,6 +636,7 @@ let package_default =
             ["lib"],
             ["Xml_sigs"; "Svg_sigs"; "Svg_types"; "Html5_sigs"; "Html5_types"
             ]);
+          ("tyxml_tools", ["tools"], []);
           ("pa_tyxml", ["syntax"], []);
           ("tymlx_p", ["syntax"], [])
        ];
@@ -649,7 +650,7 @@ let conf = {MyOCamlbuildFindlib.no_automatic_syntax = false}
 
 let dispatch_default = MyOCamlbuildBase.dispatch_default conf package_default;;
 
-# 631 "myocamlbuild.ml"
+# 632 "myocamlbuild.ml"
 (* OASIS_STOP *)
 
 open Ocamlbuild_plugin
diff --git a/setup.exe b/setup.exe
deleted file mode 100755
index 3df5dfe..0000000
Binary files a/setup.exe and /dev/null differ
diff --git a/setup.ml b/setup.ml
index bfbf8ab..205c9c7 100644
--- a/setup.ml
+++ b/setup.ml
@@ -1,7 +1,7 @@
 (* setup.ml generated for the first time by OASIS v0.3.0 *)
 
 (* OASIS_START *)
-(* DO NOT EDIT (digest: 3193bf1324398724957ef0574221635f) *)
+(* DO NOT EDIT (digest: 0d50d507dd03de48954971f23dc2890a) *)
 (*
    Regenerated by OASIS v0.4.5
    Visit http://oasis.forge.ocamlcore.org for more information and
@@ -6683,7 +6683,7 @@ let setup_t =
           alpha_features = ["pure_interface"];
           beta_features = [];
           name = "tyxml";
-          version = "3.4.0";
+          version = "3.5.0";
           license =
             OASISLicense.DEP5License
               (OASISLicense.DEP5Unit
@@ -6847,6 +6847,59 @@ let setup_t =
                    });
                Library
                  ({
+                     cs_name = "tyxml_tools";
+                     cs_data = PropList.Data.create ();
+                     cs_plugin_data = []
+                  },
+                   {
+                      bs_build = [(OASISExpr.EBool true, true)];
+                      bs_install = [(OASISExpr.EBool true, true)];
+                      bs_path = "tools";
+                      bs_compiled_object = Best;
+                      bs_build_depends = [FindlibPackage ("bytes", None)];
+                      bs_build_tools = [ExternalTool "ocamlbuild"];
+                      bs_c_sources = [];
+                      bs_data_files = [];
+                      bs_ccopt = [(OASISExpr.EBool true, [])];
+                      bs_cclib = [(OASISExpr.EBool true, [])];
+                      bs_dlllib = [(OASISExpr.EBool true, [])];
+                      bs_dllpath = [(OASISExpr.EBool true, [])];
+                      bs_byteopt = [(OASISExpr.EBool true, [])];
+                      bs_nativeopt = [(OASISExpr.EBool true, [])]
+                   },
+                   {
+                      lib_modules = ["Tyxml_name"];
+                      lib_pack = false;
+                      lib_internal_modules = [];
+                      lib_findlib_parent = Some "tyxml";
+                      lib_findlib_name = Some "tools";
+                      lib_findlib_containers = []
+                   });
+               Executable
+                 ({
+                     cs_name = "autoname";
+                     cs_data = PropList.Data.create ();
+                     cs_plugin_data = []
+                  },
+                   {
+                      bs_build = [(OASISExpr.EBool true, true)];
+                      bs_install = [(OASISExpr.EBool true, false)];
+                      bs_path = "tools";
+                      bs_compiled_object = Byte;
+                      bs_build_depends = [InternalLibrary "tyxml_tools"];
+                      bs_build_tools = [ExternalTool "ocamlbuild"];
+                      bs_c_sources = [];
+                      bs_data_files = [];
+                      bs_ccopt = [(OASISExpr.EBool true, [])];
+                      bs_cclib = [(OASISExpr.EBool true, [])];
+                      bs_dlllib = [(OASISExpr.EBool true, [])];
+                      bs_dllpath = [(OASISExpr.EBool true, [])];
+                      bs_byteopt = [(OASISExpr.EBool true, [])];
+                      bs_nativeopt = [(OASISExpr.EBool true, [])]
+                   },
+                   {exec_custom = false; exec_main_is = "autoname.ml"});
+               Library
+                 ({
                      cs_name = "pa_tyxml";
                      cs_data = PropList.Data.create ();
                      cs_plugin_data = []
@@ -6964,8 +7017,7 @@ let setup_t =
        };
      oasis_fn = Some "_oasis";
      oasis_version = "0.4.5";
-     oasis_digest =
-       Some "\158\131\248\226\223\138\143\134\238\212#1S\016\246]";
+     oasis_digest = Some "xw\176\185k\203\012\021%\167S\236\224\127\128`";
      oasis_exec = None;
      oasis_setup_args = [];
      setup_update = false
@@ -6973,6 +7025,6 @@ let setup_t =
 
 let setup () = BaseSetup.setup setup_t;;
 
-# 6977 "setup.ml"
+# 7029 "setup.ml"
 (* OASIS_STOP *)
 let () = setup ();;
diff --git a/syntax/pa_tyxml.ml b/syntax/pa_tyxml.ml
index dff35c1..28ebe1a 100644
--- a/syntax/pa_tyxml.ml
+++ b/syntax/pa_tyxml.ml
@@ -160,7 +160,7 @@ module ParserSvg = Xhtmlparser.Make(Syntax)(struct
   value make_attrib_type _loc tag =
     let tag = match String.lowercase tag with
     [ "accent-height" -> "AccentHeight"
-    | "alignement-baseline" -> "Alignement_Baseline"
+    | "alignment-baseline" -> "Alignment_Baseline"
     | "altglyph" -> "AltGlyph"
     | "animatecolor" -> "AnimateColor"
     | "arabic-form" -> "ArabicForm"
diff --git a/tools/autoname.ml b/tools/autoname.ml
new file mode 100644
index 0000000..56ba434
--- /dev/null
+++ b/tools/autoname.ml
@@ -0,0 +1,21 @@
+
+let arg = ref false
+
+let answer_elem ~attrib s =
+  Printf.printf
+    "%s\t%s\t%s\n%!"
+    s
+    (if attrib then Tyxml_name.attrib s else Tyxml_name.ident s)
+    (Tyxml_name.polyvar s)
+
+let spec = [
+  "-a", Arg.String (answer_elem ~attrib:true), "Returns the tyxml names for the given attribute." ;
+  "-e", Arg.String (answer_elem ~attrib:false), "Returns the tyxml names for the given element." ;
+
+]
+
+let usage =
+  "Accepts HTML attributes and elements and returns their tyxml names.
+Names without option are treated as elements."
+
+let () = Arg.parse spec (answer_elem ~attrib:false) usage
diff --git a/tools/tyxml_name.ml b/tools/tyxml_name.ml
new file mode 100644
index 0000000..24dd2f7
--- /dev/null
+++ b/tools/tyxml_name.ml
@@ -0,0 +1,46 @@
+
+(* Elements and attributes are technically utf8, but ascii is enough for now.
+
+   see <http://www.w3.org/TR/html51/syntax.html#syntax>
+*)
+
+(* In the ocaml parser:
+   let identchar = ['A'-'Z' 'a'-'z' '_' '\'' '0'-'9']
+*)
+let is_identchar = function
+  | 'A'..'Z'
+  | 'a'..'z'
+  | '_'
+  | '\''
+  | '0'..'9' -> true
+  | _ -> false
+
+let to_ocaml_bytes s =
+  let f c = if is_identchar c then c else '_' in
+  Bytes.init (String.length s) (fun i -> f s.[i])
+
+let to_ocaml s =
+  Bytes.to_string (to_ocaml_bytes s)
+
+
+let mapi f s =
+  let l = String.length s in
+  Bytes.init l (fun i -> f i (String.get s i))
+
+
+let ident s =
+  let s = to_ocaml_bytes s in
+  let s = Bytes.mapi (fun i c ->
+    if i = 0 then Char.lowercase c else c)
+    s in
+  Bytes.to_string s
+
+let attrib s =
+  "a_" ^  to_ocaml s
+
+let polyvar s =
+  let s = to_ocaml_bytes s in
+  let s = Bytes.mapi (fun i c ->
+    if i = 0 then Char.uppercase c else c)
+    s in
+  "`" ^ Bytes.to_string s
diff --git a/tools/tyxml_name.mli b/tools/tyxml_name.mli
new file mode 100644
index 0000000..fe90cb7
--- /dev/null
+++ b/tools/tyxml_name.mli
@@ -0,0 +1,23 @@
+(** Gives the tyxml names for HTML elements and attributes. *)
+
+(** The transformations are the following:
+    - Valid letters in OCaml identifiers are kept.
+    - Everything else is turn into an underscore '_'.
+*)
+val to_ocaml : string -> string
+
+(** Turn the given element name into a valid identifier.
+
+    Follow the [to_ocaml] convention and lowercase the first letter. *)
+val ident : string -> string
+
+
+(** Turn the given attribute name into a valid identifier.
+
+    Follow the [to_ocaml] convention and add ["a_"] at the beginning. *)
+val attrib : string -> string
+
+(** Turn the given name into a valid Polymorphic variant name.
+
+    Follow the [to_ocaml] convention, uppercase the first letter and add ["`"]. *)
+val polyvar : string -> string
diff --git a/tools/tyxml_tools.mldylib b/tools/tyxml_tools.mldylib
new file mode 100644
index 0000000..5a1ff9f
--- /dev/null
+++ b/tools/tyxml_tools.mldylib
@@ -0,0 +1,4 @@
+# OASIS_START
+# DO NOT EDIT (digest: c5452e0dcba88d3ad1e0196aeadd9e75)
+Tyxml_name
+# OASIS_STOP
diff --git a/tools/tyxml_tools.mllib b/tools/tyxml_tools.mllib
new file mode 100644
index 0000000..5a1ff9f
--- /dev/null
+++ b/tools/tyxml_tools.mllib
@@ -0,0 +1,4 @@
+# OASIS_START
+# DO NOT EDIT (digest: c5452e0dcba88d3ad1e0196aeadd9e75)
+Tyxml_name
+# OASIS_STOP

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-ocaml-maint/packages/tyxml.git



More information about the Pkg-ocaml-maint-commits mailing list