Fix doctool to work with docutils 0.6
New versions of docutils starting from 0.6 have introduced some changes in the LaTeX translator which made doctool fail. This patch adds a workaround for those new versions; for older docutils versions things should keep working normally.
This commit is contained in:
parent
638bb63184
commit
179f430435
1 changed files with 19 additions and 1 deletions
|
|
@ -124,6 +124,9 @@ HTML_SETTINGS = {
|
|||
#
|
||||
class LaTeXStandaloneTranslator(latex2e.LaTeXTranslator):
|
||||
def __init__(self, document):
|
||||
self._class = document.settings.documentclass
|
||||
self._typearea = ""
|
||||
|
||||
latex2e.LaTeXTranslator.__init__(self, document)
|
||||
|
||||
# XXX We rely on DocumentClass having a document_class attribute and
|
||||
|
|
@ -131,11 +134,26 @@ class LaTeXStandaloneTranslator(latex2e.LaTeXTranslator):
|
|||
#
|
||||
if self.d_class.document_class == "igaliabk":
|
||||
self.d_class.document_class = "book"
|
||||
|
||||
try:
|
||||
del self.head_prefix[self.head_prefix.index(self.typearea)]
|
||||
except ValueError:
|
||||
except AttributeError:
|
||||
pass
|
||||
|
||||
def __get_typearea(self):
|
||||
if self._class == "igaliabk" or self._class.startswith("scr"):
|
||||
value = ""
|
||||
else:
|
||||
value = self._typearea
|
||||
return value
|
||||
|
||||
def __set_typearea(self, value):
|
||||
self._typearea = value
|
||||
|
||||
typarea = property(__get_typearea, __set_typearea)
|
||||
|
||||
|
||||
|
||||
class LaTeXInsertTranslator(LaTeXStandaloneTranslator):
|
||||
def astext(self):
|
||||
return "".join(self.body)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue