diff options
author | Takayuki Shimizukawa <shimizukawa+bitbucket@gmail.com> | 2013-09-23 22:53:10 +0900 |
---|---|---|
committer | Takayuki Shimizukawa <shimizukawa+bitbucket@gmail.com> | 2013-09-23 22:53:10 +0900 |
commit | e40d57316f5036fb319c6e6fb4c3b9526527b5b8 (patch) | |
tree | 8024b3ba9edc57d870d8f89e2de9ab6b64339f96 | |
parent | 09eec633e6c92af34ebccf4aa859b28774c35494 (diff) | |
parent | 496e04d2968bcea4b9afb4f7833d039ce0e24be1 (diff) | |
download | sphinx-e40d57316f5036fb319c6e6fb4c3b9526527b5b8.tar.gz |
Merged in erikb85/sphinx (pull request #154)
Removing "sphinx" prefix from Latex class parsing
-rw-r--r-- | doc/config.rst | 6 | ||||
-rw-r--r-- | sphinx/quickstart.py | 2 | ||||
-rw-r--r-- | sphinx/writers/latex.py | 12 |
3 files changed, 18 insertions, 2 deletions
diff --git a/doc/config.rst b/doc/config.rst index 70ebacb4..70ccd26e 100644 --- a/doc/config.rst +++ b/doc/config.rst @@ -1016,11 +1016,17 @@ These options influence LaTeX output. "sphinx" package in order to define Sphinx' custom LaTeX commands. "howto" documents will not get appendices. Also, howtos will have a simpler title page. + * *toctree_only*: Must be ``True`` or ``False``. If ``True``, the *startdoc* document itself is not included in the output, only the documents referenced by it via TOC trees. With this option, you can put extra stuff in the master document that shows up in the HTML, but not the LaTeX output. + .. versionadded:: 1.2 + In the past including your own document class required you to prepend the + document class name with the string "sphinx". This is not necessary + anymore. + .. versionadded:: 0.3 The 6th item ``toctree_only``. Tuples with 5 items are still accepted. diff --git a/sphinx/quickstart.py b/sphinx/quickstart.py index 7124184e..ea9a3f4a 100644 --- a/sphinx/quickstart.py +++ b/sphinx/quickstart.py @@ -236,7 +236,7 @@ latex_elements = { # Grouping the document tree into LaTeX files. List of tuples # (source start file, target name, title, -# author, documentclass [howto/manual]). +# author, documentclass [howto, manual, or own class]). latex_documents = [ ('%(master_str)s', '%(project_fn)s.tex', u'%(project_doc_texescaped_str)s', u'%(author_texescaped_str)s', 'manual'), diff --git a/sphinx/writers/latex.py b/sphinx/writers/latex.py index b67638a2..ce92edfc 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': 'sphinx' + 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() + |