[gnome-doc-utils] [xml2po] isFinalNode is now a method of the mode
- From: Claude Paroz <claudep src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [gnome-doc-utils] [xml2po] isFinalNode is now a method of the mode
- Date: Sat, 1 Aug 2009 22:27:11 +0000 (UTC)
commit dc090f1e80ae44c6bcd5384d13815bdae9e64742
Author: Claude Paroz <claude 2xlibre net>
Date: Sun Aug 2 00:27:05 2009 +0200
[xml2po] isFinalNode is now a method of the mode
xml2po/xml2po/__init__.py | 16 +---------------
xml2po/xml2po/modes/basic.py | 15 +++++++++++++++
2 files changed, 16 insertions(+), 15 deletions(-)
---
diff --git a/xml2po/xml2po/__init__.py b/xml2po/xml2po/__init__.py
index 763aa8d..641bb06 100644
--- a/xml2po/xml2po/__init__.py
+++ b/xml2po/xml2po/__init__.py
@@ -151,6 +151,7 @@ class XMLDocument(object):
raise Exception("Error: I tried to open '%s' but got '%s' -- how did that happen?" % (filename, self.doc.name))
if self.app.msg:
self.app.msg.setFilename(filename)
+ self.isFinalNode = self.app.current_mode.isFinalNode
def generate_messages(self):
self.app.msg.setFilename(self.doc.name)
@@ -287,21 +288,6 @@ class XMLDocument(object):
return False
return node.name
- def isFinalNode(self, node):
- #node.type =='text' or not node.children or
- if node.type == 'element' and node.name in self.app.current_mode.getFinalTags():
- return True
- elif node.children:
- final_children = True
- child = node.children
- while child and final_children:
- if not child.isBlankNode() and child.type != 'comment' and not self.isFinalNode(child):
- final_children = False
- child = child.next
- if final_children:
- return True
- return False
-
def ignoreNode(self, node):
if self.isFinalNode(node):
return False
diff --git a/xml2po/xml2po/modes/basic.py b/xml2po/xml2po/modes/basic.py
index 7765a1c..e2ef7a4 100644
--- a/xml2po/xml2po/modes/basic.py
+++ b/xml2po/xml2po/modes/basic.py
@@ -32,6 +32,21 @@ class basicXmlMode:
'date', 'itemizedlist', 'orderedlist',
'variablelist', 'varlistentry', 'term']
+ def isFinalNode(self, node):
+ #node.type =='text' or not node.children or
+ if node.type == 'element' and node.name in self.getFinalTags():
+ return True
+ elif node.children:
+ final_children = True
+ child = node.children
+ while child and final_children:
+ if not child.isBlankNode() and child.type != 'comment' and not self.isFinalNode(child):
+ final_children = False
+ child = child.next
+ if final_children:
+ return True
+ return False
+
def getSpacePreserveTags(self):
"Returns array of tags in which spaces are to be preserved."
return []
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]