summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKohei Yoshida <kyoshida@novell.com>2009-12-23 20:29:41 -0500
committerKohei Yoshida <kyoshida@novell.com>2009-12-23 20:29:41 -0500
commit4cfa17630d56ad31c3911418c18ac3533be09c14 (patch)
treef74a6493d5963ad341145c4b9e728b787679b758
parent76e669e4b683831532e83e01ef684cbdaaa40800 (diff)
Removed the old docbook converter code.
-rw-r--r--source/docbook.py58
1 files changed, 4 insertions, 54 deletions
diff --git a/source/docbook.py b/source/docbook.py
index 328f0cc..ec6bed1 100644
--- a/source/docbook.py
+++ b/source/docbook.py
@@ -154,62 +154,12 @@ class DocBookConverter:
def __getContentFromXHP (self, xhppath, dest):
xhproot = self.xhproots[xhppath]
xhpbody = xhproot.firstChild().firstChildByName('body')
- for xhppara in xhpbody.getChildByName('paragraph'):
- para = dest.appendElement('para')
- para.appendContent(xhppara.getContent())
-
-
- def prettyPrint (self, fd):
- node.prettyPrint(fd, self.root)
-
-class DocBookConverterOld:
- def __init__ (self, xhproots):
- self.__xhproots = xhproots
- self.root = node.Root()
-
- def convert (self):
- filenames = self.__xhproots.keys()
- sorter = FilePathSorter(filenames)
- filenames = sorter.sort()
-# for filename in filenames:
-# print (filename)
-# return
-
- book = self.root.appendElement('book')
- bookinfo = book.appendElement('bookinfo')
- title = bookinfo.appendElement('title')
- title.appendContent("OpenOffice.org Help")
-
- sectionStack = [book]
- for filename in filenames:
- if not self.__xhproots.has_key(filename):
- continue
-
- # 0 - book, 1 - chapter, 2 - sect1, 3 - sect2, and so on...
- # file name is expected to be like 'text/swriter/...'
- level = filename.count('/') - 1
-
- xhproot = self.__xhproots[filename]
- # go to helpdocument/meta/topic/title to get the title text.
- cursect = None
- if level == 1:
- cursect = book.appendElement('chapter')
- chapter = cursect
- elif level == 2:
- cursect = chapter.appendElement('sect1')
- sect1 = cursect
- if cursect == None:
- continue
-
- titleText = xhproot.firstChild().firstChildByName('meta').firstChildByName('topic').firstChildByName('filename').getContent()
- cursect.appendElement('title').appendContent(titleText)
-
- # convert all paragraphs.
- xhpbody = xhproot.firstChild().firstChildByName('body')
- for xhppara in xhpbody.getChildByName('paragraph'):
- para = cursect.appendElement('para')
+ for xhpelem in xhpbody.getChildNodes():
+ if xhpelem.name == 'paragraph':
+ para = dest.appendElement('para')
para.appendContent(xhppara.getContent())
+
def prettyPrint (self, fd):
node.prettyPrint(fd, self.root)