Fix a few issues in the doc builder class
This commit is contained in:
@@ -85,10 +85,13 @@ class NWBuildDocument:
|
|||||||
"""
|
"""
|
||||||
makeOdt = ToOdt(self._project, isFlat=isFlat)
|
makeOdt = ToOdt(self._project, isFlat=isFlat)
|
||||||
self._setupBuild(makeOdt)
|
self._setupBuild(makeOdt)
|
||||||
|
makeOdt.initDocument()
|
||||||
|
|
||||||
for i, tHandle in enumerate(self._documents):
|
for i, tHandle in enumerate(self._documents):
|
||||||
yield i, self._doBuild(makeOdt, tHandle)
|
yield i, self._doBuild(makeOdt, tHandle)
|
||||||
|
|
||||||
|
makeOdt.closeDocument()
|
||||||
|
|
||||||
self._error = None
|
self._error = None
|
||||||
try:
|
try:
|
||||||
if isFlat:
|
if isFlat:
|
||||||
@@ -201,13 +204,13 @@ class NWBuildDocument:
|
|||||||
if isinstance(bldObj, ToOdt):
|
if isinstance(bldObj, ToOdt):
|
||||||
bldObj.setColourHeaders(not noStyling)
|
bldObj.setColourHeaders(not noStyling)
|
||||||
bldObj.setLanguage(buildLang)
|
bldObj.setLanguage(buildLang)
|
||||||
bldObj.initDocument()
|
|
||||||
|
|
||||||
return
|
return
|
||||||
|
|
||||||
def _doBuild(self, bldObj, tHandle):
|
def _doBuild(self, bldObj, tHandle):
|
||||||
"""Build a single document and add it to the build object.
|
"""Build a single document and add it to the build object.
|
||||||
"""
|
"""
|
||||||
|
self._error = None
|
||||||
tItem = self._project.tree[tHandle]
|
tItem = self._project.tree[tHandle]
|
||||||
if tItem is None:
|
if tItem is None:
|
||||||
self._error = f"Build: Unknown item '{tHandle}'"
|
self._error = f"Build: Unknown item '{tHandle}'"
|
||||||
@@ -219,7 +222,7 @@ class NWBuildDocument:
|
|||||||
bldObj.addRootHeading(tItem.itemHandle)
|
bldObj.addRootHeading(tItem.itemHandle)
|
||||||
bldObj.doConvert()
|
bldObj.doConvert()
|
||||||
elif tItem.isFileType():
|
elif tItem.isFileType():
|
||||||
bldObj.setText(tItem.itemHandle)
|
bldObj.setText(tHandle)
|
||||||
bldObj.doPreProcessing()
|
bldObj.doPreProcessing()
|
||||||
bldObj.tokenizeText()
|
bldObj.tokenizeText()
|
||||||
bldObj.doHeaders()
|
bldObj.doHeaders()
|
||||||
|
|||||||
Reference in New Issue
Block a user