mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
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.
This commit is contained in:
parent
22d3976af2
commit
804b6a0cdb
@ -167,6 +167,9 @@ class LaTeXTranslator(nodes.NodeVisitor):
|
|||||||
'transition': '\n\n\\bigskip\\hrule{}\\bigskip\n\n',
|
'transition': '\n\n\\bigskip\\hrule{}\\bigskip\n\n',
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# sphinx specific document classes
|
||||||
|
docclasses = ('howto', 'manual')
|
||||||
|
|
||||||
def __init__(self, document, builder):
|
def __init__(self, document, builder):
|
||||||
nodes.NodeVisitor.__init__(self, document)
|
nodes.NodeVisitor.__init__(self, document)
|
||||||
self.builder = builder
|
self.builder = builder
|
||||||
@ -179,7 +182,7 @@ class LaTeXTranslator(nodes.NodeVisitor):
|
|||||||
|
|
||||||
self.elements = self.default_elements.copy()
|
self.elements = self.default_elements.copy()
|
||||||
self.elements.update({
|
self.elements.update({
|
||||||
'wrapperclass': document.settings.docclass,
|
'wrapperclass': self.format_docclass(document.settings.docclass),
|
||||||
'papersize': papersize,
|
'papersize': papersize,
|
||||||
'pointsize': builder.config.latex_font_size,
|
'pointsize': builder.config.latex_font_size,
|
||||||
# if empty, the title is set to the first section title
|
# 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.previous_spanning_column = 0
|
||||||
self.remember_multirow = {}
|
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):
|
def astext(self):
|
||||||
return (HEADER % self.elements +
|
return (HEADER % self.elements +
|
||||||
self.highlighter.get_stylesheet() +
|
self.highlighter.get_stylesheet() +
|
||||||
|
Loading…
Reference in New Issue
Block a user