[Python-modules-commits] [python-odf] 31/118: Can now understand manifests

Wolfgang Borgert debacle at moszumanska.debian.org
Fri Oct 3 21:27:19 UTC 2014


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

debacle pushed a commit to reference refs/remotes/upstream/master
in repository python-odf.

commit 3ea68998d8e09e19536093ce7b0d30895ff58150
Author: Søren Roug <soren.roug at eea.europa.eu>
Date:   Sun Jan 4 16:41:41 2009 +0000

    Can now understand manifests
---
 grammar/Makefile                                 | 18 ++++++++++-------
 grammar/OpenDocument-manifest-schema-v1.0-os.rng | 13 ------------
 grammar/OpenDocument-schema-v1.0-os.rng          | 25 ++++++------------------
 grammar/OpenDocument-schema-v1.1.rng             |  8 ++++----
 grammar/OpenDocument-strict-schema-v1.0-os.rng   | 13 ------------
 grammar/gen_allowed_attrs.py                     |  2 +-
 grammar/gen_allowed_children.py                  | 20 ++++++++-----------
 grammar/gen_allows_text.py                       |  2 +-
 grammar/gen_required_attrs.py                    | 20 +++++++++----------
 9 files changed, 40 insertions(+), 81 deletions(-)

diff --git a/grammar/Makefile b/grammar/Makefile
index b2c57c5..6e6c244 100644
--- a/grammar/Makefile
+++ b/grammar/Makefile
@@ -1,25 +1,29 @@
 all: odf grammarnew.py
 
-simplified-7-22.rng: OpenDocument-strict-schema-v1.2-draft7.rng
-	xsltproc simplification.xsl $<
+#simplified-7-22.rng: OpenDocument-strict-schema-v1.2-draft7.rng OpenDocument-schema-v1.0-os.rng
+simple-schema-7-22.rng: OpenDocument-strict-schema-v1.0-os.rng OpenDocument-schema-v1.0-os.rng simplification.xsl
+	xsltproc --stringparam out-name simple-schema- simplification.xsl $<
+
+simple-manifest-7-22.rng: OpenDocument-manifest-schema-v1.0-os.rng simplification.xsl
+	xsltproc --stringparam out-name simple-manifest- simplification.xsl $<
 
 grammarnew.py: allowed_children.py allows_text.py required_attrs.py allowed_attrs.py
 	cat allowed_children.py allows_text.py required_attrs.py allowed_attrs.py >grammarnew.py
 
-allowed_children.py: simplified-7-22.rng gen_allowed_children.py
+allowed_children.py: simple-schema-7-22.rng gen_allowed_children.py
 	python gen_allowed_children.py > allowed_children.py
 
-allows_text.py: simplified-7-22.rng gen_allows_text.py
+allows_text.py: simple-schema-7-22.rng gen_allows_text.py
 	python gen_allows_text.py > allows_text.py
 
-required_attrs.py: simplified-7-22.rng
+required_attrs.py: simple-schema-7-22.rng simple-manifest-7-22.rng
 	python gen_required_attrs.py > required_attrs.py
 
-allowed_attrs.py: simplified-7-22.rng gen_allowed_attrs.py
+allowed_attrs.py: simple-schema-7-22.rng gen_allowed_attrs.py
 	python gen_allowed_attrs.py > allowed_attrs.py
 
 clean:
-	rm -f odf simplified-7-*.rng required_attrs.py allowed_attrs.py allowed_children.py
+	rm -f odf simple-schema-7-*.rng simple-manifest-7-*.rng required_attrs.py allowed_attrs.py allowed_children.py
 
 odf:
 	ln -s ../odf
diff --git a/grammar/OpenDocument-manifest-schema-v1.0-os.rng b/grammar/OpenDocument-manifest-schema-v1.0-os.rng
index 5f9494d..97fe580 100644
--- a/grammar/OpenDocument-manifest-schema-v1.0-os.rng
+++ b/grammar/OpenDocument-manifest-schema-v1.0-os.rng
@@ -8,19 +8,6 @@
 
     © 2002-2005 OASIS Open
     © 1999-2005 Sun Microsystems, Inc.
-
-    This document and translations of it may be copied and furnished
-    to others, and derivative works that comment on or otherwise explain
-    it or assist in its implementation may be prepared, copied,
-    published and distributed, in whole or in part, without restriction
-    of any kind, provided that the above copyright notice and this
-    paragraph are included on all such copies and derivative works.
-    However, this document itself does not be modified in any way, such
-    as by removing the copyright notice or references to OASIS, except
-    as needed for the purpose of developing OASIS specifications, in
-    which case the procedures for copyrights defined in the OASIS
-    Intellectual Property Rights document must be followed, or as
-    required to translate it into languages other than English.
 -->
 
 <grammar 
diff --git a/grammar/OpenDocument-schema-v1.0-os.rng b/grammar/OpenDocument-schema-v1.0-os.rng
index e57d08b..7c5cb42 100644
--- a/grammar/OpenDocument-schema-v1.0-os.rng
+++ b/grammar/OpenDocument-schema-v1.0-os.rng
@@ -8,19 +8,6 @@
 
     © 2002-2005 OASIS Open
     © 1999-2005 Sun Microsystems, Inc.
-
-    This document and translations of it may be copied and furnished
-    to others, and derivative works that comment on or otherwise explain 
-    it or assist in its implementation may be prepared, copied, 
-    published and distributed, in whole or in part, without restriction 
-    of any kind, provided that the above copyright notice and this 
-    paragraph are included on all such copies and derivative works. 
-    However, this document itself does not be modified in any way, such 
-    as by removing the copyright notice or references to OASIS, except 
-    as needed for the purpose of developing OASIS specifications, in 
-    which case the procedures for copyrights defined in the OASIS 
-    Intellectual Property Rights document must be followed, or as 
-    required to translate it into languages other than English.
 -->
 
 <grammar
@@ -789,22 +776,22 @@
             </attribute>
         </optional>
         <optional>
-            <attribute name="frame-count">
+            <attribute name="meta:frame-count">
                 <ref name="nonNegativeInteger"/>
             </attribute>
         </optional>
         <optional>
-            <attribute name="sentence-count">
+            <attribute name="meta:sentence-count">
                 <ref name="nonNegativeInteger"/>
             </attribute>
         </optional>
         <optional>
-            <attribute name="syllable-count">
+            <attribute name="meta:syllable-count">
                 <ref name="nonNegativeInteger"/>
             </attribute>
         </optional>
         <optional>
-            <attribute name="non-whitespace-character-count">
+            <attribute name="meta:non-whitespace-character-count">
                 <ref name="nonNegativeInteger"/>
             </attribute>
         </optional>
@@ -11533,7 +11520,7 @@
 <define name="svg-font-face-name">
     <element name="svg:font-face-name">
         <optional>
-            <attribute name="name"/>
+            <attribute name="svg:name"/>
         </optional>
         <empty/>
     </element>
@@ -12302,7 +12289,7 @@
         <attribute name="text:number-position" a:defaultValue="left">
             <choice>
                 <value>left</value>
-                <value>rigth</value>
+                <value>right</value>
                 <value>inner</value>
                 <value>outer</value>
             </choice>
diff --git a/grammar/OpenDocument-schema-v1.1.rng b/grammar/OpenDocument-schema-v1.1.rng
index 3ba6a68..3ccc759 100644
--- a/grammar/OpenDocument-schema-v1.1.rng
+++ b/grammar/OpenDocument-schema-v1.1.rng
@@ -789,22 +789,22 @@
             </attribute>
         </optional>
         <optional>
-            <attribute name="frame-count">
+            <attribute name="meta:frame-count">
                 <ref name="nonNegativeInteger"/>
             </attribute>
         </optional>
         <optional>
-            <attribute name="sentence-count">
+            <attribute name="meta:sentence-count">
                 <ref name="nonNegativeInteger"/>
             </attribute>
         </optional>
         <optional>
-            <attribute name="syllable-count">
+            <attribute name="meta:syllable-count">
                 <ref name="nonNegativeInteger"/>
             </attribute>
         </optional>
         <optional>
-            <attribute name="non-whitespace-character-count">
+            <attribute name="meta:non-whitespace-character-count">
                 <ref name="nonNegativeInteger"/>
             </attribute>
         </optional>
diff --git a/grammar/OpenDocument-strict-schema-v1.0-os.rng b/grammar/OpenDocument-strict-schema-v1.0-os.rng
index b2834c9..aa761dc 100644
--- a/grammar/OpenDocument-strict-schema-v1.0-os.rng
+++ b/grammar/OpenDocument-strict-schema-v1.0-os.rng
@@ -8,19 +8,6 @@
 
     © 2002-2005 OASIS Open
     © 1999-2005 Sun Microsystems, Inc.
-
-    This document and translations of it may be copied and furnished
-    to others, and derivative works that comment on or otherwise explain
-    it or assist in its implementation may be prepared, copied,
-    published and distributed, in whole or in part, without restriction
-    of any kind, provided that the above copyright notice and this
-    paragraph are included on all such copies and derivative works.
-    However, this document itself does not be modified in any way, such
-    as by removing the copyright notice or references to OASIS, except
-    as needed for the purpose of developing OASIS specifications, in
-    which case the procedures for copyrights defined in the OASIS
-    Intellectual Property Rights document must be followed, or as
-    required to translate it into languages other than English.
 -->
 
 <grammar xmlns="http://relaxng.org/ns/structure/1.0">
diff --git a/grammar/gen_allowed_attrs.py b/grammar/gen_allowed_attrs.py
index 9f44170..b4c85b7 100755
--- a/grammar/gen_allowed_attrs.py
+++ b/grammar/gen_allowed_attrs.py
@@ -94,7 +94,7 @@ def parse_rng(relaxfile):
 
 
 if __name__ == "__main__":
-    parse_rng("simplified-7-22.rng")
+    parse_rng("simple-schema-7-22.rng")
 
     print "allowed_attributes = {"
 
diff --git a/grammar/gen_allowed_children.py b/grammar/gen_allowed_children.py
index 7aeaccb..adf825b 100755
--- a/grammar/gen_allowed_children.py
+++ b/grammar/gen_allowed_children.py
@@ -1,6 +1,6 @@
 #!/usr/bin/python
 # -*- coding: utf-8 -*-
-# Copyright (C) 2006 Søren Roug, European Environment Agency
+# Copyright (C) 2009 Søren Roug, European Environment Agency
 #
 # This is free software.  You may redistribute it under the terms
 # of the Apache license and the GNU General Public License Version
@@ -91,28 +91,24 @@ class S22RelaxParser(handler.ContentHandler):
             if self.currdef.has_key('element'):
                 self.definitions[self.currdef['name']] = self.currdef
         elif tag == (RELAXNS, 'name'):
-            #print "ELEMENT NAME:", self.text()
             self.currdef['element'] = self.text()
         elif tag == (RELAXNS, 'anyName'):
             self.currdef['element'] = "__ANYNAME__"
         self.data = []
 
-def parse_rng(relaxfile):
-    content = file(relaxfile)
+if __name__ == "__main__":
+    elements = {}
     parser = make_parser()
     parser.setFeature(handler.feature_namespaces, 1)
     p = S22RelaxParser()
     parser.setContentHandler(p)
     parser.setErrorHandler(handler.ErrorHandler())
 
-    inpsrc = InputSource()
-    inpsrc.setByteStream(content)
-    parser.parse(inpsrc)
-    return p
-
-
-if __name__ == "__main__":
-    p = parse_rng("simplified-7-22.rng")
+    for relaxfile in ["simple-manifest-7-22.rng","simple-schema-7-22.rng"]:
+        content = file(relaxfile)
+        inpsrc = InputSource()
+        inpsrc.setByteStream(content)
+        parser.parse(inpsrc)
 
     defs = p.definitions
     keys= defs.keys()
diff --git a/grammar/gen_allows_text.py b/grammar/gen_allows_text.py
index cb68f70..ca7a454 100755
--- a/grammar/gen_allows_text.py
+++ b/grammar/gen_allows_text.py
@@ -114,7 +114,7 @@ def parse_rng(relaxfile):
 
 
 if __name__ == "__main__":
-    p = parse_rng("simplified-7-22.rng")
+    p = parse_rng("simple-schema-7-22.rng")
 
     defs = p.definitions
     keys= defs.keys()
diff --git a/grammar/gen_required_attrs.py b/grammar/gen_required_attrs.py
index 08f7603..5f27751 100755
--- a/grammar/gen_required_attrs.py
+++ b/grammar/gen_required_attrs.py
@@ -73,7 +73,7 @@ class S22RelaxParser(handler.ContentHandler):
 
     def endElementNS(self, tag, qname):
         if tag == (RELAXNS, 'element'):
-            elements[(self.currelem.ns, self.currelem.name)] = self.currelem
+            self.elements[(self.currelem.ns, self.currelem.name)] = self.currelem
             self.currelem = None
         elif tag == (RELAXNS, 'attribute'):
             if self.optional == 0:
@@ -87,21 +87,19 @@ class S22RelaxParser(handler.ContentHandler):
             self.optional = self.optional - 1
         self.data = []
 
-def parse_rng(relaxfile, elements):
-    content = file(relaxfile)
+
+if __name__ == "__main__":
+    elements = {}
     parser = make_parser()
     parser.setFeature(handler.feature_namespaces, 1)
     parser.setContentHandler(S22RelaxParser(elements))
     parser.setErrorHandler(handler.ErrorHandler())
 
-    inpsrc = InputSource()
-    inpsrc.setByteStream(content)
-    parser.parse(inpsrc)
-
-
-if __name__ == "__main__":
-    elements = {}
-    parse_rng("simplified-7-22.rng", elements)
+    for relaxfile in ["simple-manifest-7-22.rng","simple-schema-7-22.rng"]:
+        content = file(relaxfile)
+        inpsrc = InputSource()
+        inpsrc.setByteStream(content)
+        parser.parse(inpsrc)
 
     slist = elements.keys()
     slist.sort()

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/python-modules/packages/python-odf.git



More information about the Python-modules-commits mailing list