summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErik Bernoth <erik.bernoth@gmail.com>2013-09-20 11:45:56 +0200
committerErik Bernoth <erik.bernoth@gmail.com>2013-09-20 11:45:56 +0200
commitf0477fc45d29d8dd8089f4d63b85cc8007d78cc8 (patch)
treed572b93e7dfa06f283346a31494dcd95ef1bdd1e
parentfcda5a7f1434da8df0b14af72bd223429fc0b59d (diff)
downloadsphinx-f0477fc45d29d8dd8089f4d63b85cc8007d78cc8.tar.gz
Conditional prefix prepending for docclasses
To remove the prefix for document classes completely is not necessary. Old style config files can still work if there is a corresponding condition which prepends 'sphinx' only when the configured document class is one of the Sphinx specific classes.
-rw-r--r--sphinx/writers/latex.py12
1 files changed, 11 insertions, 1 deletions
diff --git a/sphinx/writers/latex.py b/sphinx/writers/latex.py
index cd6cce9b..b465a2f8 100644
--- a/sphinx/writers/latex.py
+++ b/sphinx/writers/latex.py
@@ -167,6 +167,9 @@ class LaTeXTranslator(nodes.NodeVisitor):
'transition': '\n\n\\bigskip\\hrule{}\\bigskip\n\n',
}
+ # sphinx specific document classes
+ docclasses = ('howto', 'manual')
+
def __init__(self, document, builder):
nodes.NodeVisitor.__init__(self, document)
self.builder = builder
@@ -179,7 +182,7 @@ class LaTeXTranslator(nodes.NodeVisitor):
self.elements = self.default_elements.copy()
self.elements.update({
- 'wrapperclass': document.settings.docclass,
+ 'wrapperclass': self.format_docclass(document.settings.docclass),
'papersize': papersize,
'pointsize': builder.config.latex_font_size,
# if empty, the title is set to the first section title
@@ -276,6 +279,13 @@ class LaTeXTranslator(nodes.NodeVisitor):
self.previous_spanning_column = 0
self.remember_multirow = {}
+ def format_docclass(self, docclass):
+ """ prepends prefix to sphinx document classes
+ """
+ if docclass in self.docclasses:
+ docclass = 'sphinx' + docclass
+ return docclass
+
def astext(self):
return (HEADER % self.elements +
self.highlighter.get_stylesheet() +