[Python-modules-commits] [python-odf] 100/118: Can now handle bookmark references

Wolfgang Borgert debacle at moszumanska.debian.org
Fri Oct 3 21:27:28 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 fef8dfacdd783129dd658e311971447340d8e6ad
Author: Søren Roug <soren.roug at eea.europa.eu>
Date:   Sun Feb 13 14:06:53 2011 +0000

    Can now handle bookmark references
---
 odf/namespaces.py |  2 ++
 odf/odf2xhtml.py  | 11 +++++++++++
 odflint/odflint   |  9 +++++++++
 3 files changed, 22 insertions(+)

diff --git a/odf/namespaces.py b/odf/namespaces.py
index 642598d..d64a104 100644
--- a/odf/namespaces.py
+++ b/odf/namespaces.py
@@ -31,6 +31,7 @@ DRAWNS         = u"urn:oasis:names:tc:opendocument:xmlns:drawing:1.0"
 FIELDNS        = u"urn:openoffice:names:experimental:ooo-ms-interop:xmlns:field:1.0"
 FONS           = u"urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0"
 FORMNS         = u"urn:oasis:names:tc:opendocument:xmlns:form:1.0"
+GRDDLNS        = u"http://www.w3.org/2003/g/data-view#"
 KOFFICENS      = u"http://www.koffice.org/2005/"
 MANIFESTNS     = u"urn:oasis:names:tc:opendocument:xmlns:manifest:1.0"
 MATHNS         = u"http://www.w3.org/1998/Math/MathML"
@@ -68,6 +69,7 @@ nsdict = {
    FIELDNS: u'field',
    FONS: u'fo',
    FORMNS: u'form',
+   GRDDLNS: u'grddl',
    KOFFICENS: u'koffice',
    MANIFESTNS: u'manifest',
    MATHNS: u'math',
diff --git a/odf/odf2xhtml.py b/odf/odf2xhtml.py
index b2f03d3..4bf4553 100644
--- a/odf/odf2xhtml.py
+++ b/odf/odf2xhtml.py
@@ -405,6 +405,9 @@ class ODF2XHTML(handler.ContentHandler):
         (TEXTNS, "bibliography-configuration"):(self.s_ignorexml, None),
         (TEXTNS, "bibliography-source"):(self.s_text_x_source, self.e_text_x_source),
         (TEXTNS, 'bookmark'): (self.s_text_bookmark, None),
+        (TEXTNS, 'bookmark-start'): (self.s_text_bookmark, None),
+        (TEXTNS, 'bookmark-ref'): (self.s_text_bookmark_ref, self.e_text_a),
+        (TEXTNS, 'bookmark-ref-start'): (self.s_text_bookmark_ref, None),
         (TEXTNS, 'h'): (self.s_text_h, self.e_text_h),
         (TEXTNS, "illustration-index-source"):(self.s_text_x_source, self.e_text_x_source),
         (TEXTNS, 'line-break'):(self.s_text_line_break, None),
@@ -1134,6 +1137,7 @@ ol, ul { padding-left: 2em; }
         self.purgedata()
 
     def e_text_a(self, tag, attrs):
+        """ End an anchor or bookmark reference """
         self.writedata()
         self.closetag('a', False)
         self.purgedata()
@@ -1147,6 +1151,13 @@ ol, ul { padding-left: 2em; }
         self.closetag('span', False)
         self.purgedata()
 
+    def s_text_bookmark_ref(self, tag, attrs):
+        """ Bookmark reference """
+        name = attrs[(TEXTNS,'ref-name')]
+        html_id = "#" + self.get_anchor(name)
+        self.writedata()
+        self.opentag('a', {'href':html_id})
+        self.purgedata()
 
     def s_text_h(self, tag, attrs):
         """ Headings start """
diff --git a/odflint/odflint b/odflint/odflint
index d3c5bd4..9f21c5c 100755
--- a/odflint/odflint
+++ b/odflint/odflint
@@ -35,6 +35,15 @@ except ImportError:
 
 extension_attributes = {
 	 "OpenDocument 1.2" : {
+		(OFFICENS,u'document-content'):(
+			(GRDDLNS,u'transformation'),
+		),
+		(OFFICENS,u'document-meta'):(
+			(GRDDLNS,u'transformation'),
+		),
+		(OFFICENS,u'document-styles'):(
+			(GRDDLNS,u'transformation'),
+		),
 		(STYLENS,u'section-properties'): (
 			(STYLENS,u'editable'),
 		),

-- 
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