diff --git a/CHANGES b/CHANGES index 8a626e70a..566d7b8bb 100644 --- a/CHANGES +++ b/CHANGES @@ -10,6 +10,11 @@ Features added * #1962: when adding directives, roles or nodes from an extension, warn if such an element is already present (built-in or added by another extension). +Features added +-------------- + +* #1935: Make "numfig_format" overridable in latex_elements. + Bugs fixed ---------- diff --git a/sphinx/writers/latex.py b/sphinx/writers/latex.py index ffa8ae874..62f8a5284 100644 --- a/sphinx/writers/latex.py +++ b/sphinx/writers/latex.py @@ -248,12 +248,12 @@ class LaTeXTranslator(nodes.NodeVisitor): return '\\usepackage{%s}' % (packagename,) usepackages = (declare_package(*p) for p in builder.usepackages) self.elements['usepackages'] += "\n".join(usepackages) + self.elements['numfig_format'] = self.generate_numfig_format(builder) # allow the user to override them all self.elements.update(builder.config.latex_elements) if self.elements['extraclassoptions']: self.elements['classoptions'] += ',' + \ self.elements['extraclassoptions'] - self.elements['numfig_format'] = self.generate_numfig_format(builder) self.highlighter = highlighting.PygmentsBridge( 'latex', diff --git a/sphinx/writers/text.py b/sphinx/writers/text.py index ad2d8bbbc..5bab4b881 100644 --- a/sphinx/writers/text.py +++ b/sphinx/writers/text.py @@ -303,8 +303,6 @@ class TextTranslator(nodes.NodeVisitor): def visit_desc_signature(self, node): self.new_state(0) - if node.parent['objtype'] in ('class', 'exception'): - self.add_text('%s ' % node.parent['objtype']) def depart_desc_signature(self, node): # XXX: wrap signatures in a way that makes sense @@ -711,6 +709,9 @@ class TextTranslator(nodes.NodeVisitor): def _visit_admonition(self, node): self.new_state(2) + if isinstance(node.children[0], nodes.Sequential): + self.add_text(self.nl) + def _make_depart_admonition(name): def depart_admonition(self, node): self.end_state(first=admonitionlabels[name] + ': ') diff --git a/tests/roots/test-build-text/listitems.txt b/tests/roots/test-build-text/listitems.txt new file mode 100644 index 000000000..f0952d8c6 --- /dev/null +++ b/tests/roots/test-build-text/listitems.txt @@ -0,0 +1,4 @@ +.. seealso:: + + * item 1 + * item 2 diff --git a/tests/roots/test-ext-graphviz/conf.py b/tests/roots/test-ext-graphviz/conf.py new file mode 100644 index 000000000..cecd53668 --- /dev/null +++ b/tests/roots/test-ext-graphviz/conf.py @@ -0,0 +1,4 @@ +# -*- coding: utf-8 -*- + +extensions = ['sphinx.ext.graphviz'] +master_doc = 'index' diff --git a/tests/roots/test-ext-graphviz/index.rst b/tests/roots/test-ext-graphviz/index.rst new file mode 100644 index 000000000..39c755e9d --- /dev/null +++ b/tests/roots/test-ext-graphviz/index.rst @@ -0,0 +1,7 @@ +graphviz +======== + +.. digraph:: foo + :caption: caption of graph + + bar -> baz diff --git a/tests/test_build_text.py b/tests/test_build_text.py index 014deeca3..5a1ec227f 100644 --- a/tests/test_build_text.py +++ b/tests/test_build_text.py @@ -99,3 +99,15 @@ def test_table_with_empty_cell(app, status, warning): assert lines[4] == "+-------+-------+" assert lines[5] == "| XXX | |" assert lines[6] == "+-------+-------+" + + +@with_text_app() +def test_list_items_in_admonition(app, status, warning): + app.builder.build_update() + result = (app.outdir / 'listitems.txt').text(encoding='utf-8') + lines = [line.rstrip() for line in result.splitlines()] + assert lines[0] == "See also:" + assert lines[1] == "" + assert lines[2] == " * item 1" + assert lines[3] == "" + assert lines[4] == " * item 2" diff --git a/tests/test_ext_graphviz.py b/tests/test_ext_graphviz.py new file mode 100644 index 000000000..53f5be4df --- /dev/null +++ b/tests/test_ext_graphviz.py @@ -0,0 +1,23 @@ +# -*- coding: utf-8 -*- +""" + test_ext_graphviz + ~~~~~~~~~~~~~~~~~ + + Test sphinx.ext.graphviz extension. + + :copyright: Copyright 2007-2015 by the Sphinx team, see AUTHORS. + :license: BSD, see LICENSE for details. +""" + +import re +from util import with_app + + +@with_app('html', testroot='ext-graphviz') +def test_graphviz(app, status, warning): + app.builder.build_all() + if "dot command 'dot' cannot be run" not in warning.getvalue(): + content = (app.outdir / 'index.html').text() + html = ('
\s*\s*
caption of graph') + assert re.search(html, content, re.S) diff --git a/tests/test_intl.py b/tests/test_intl.py index 5c6be546a..ea506020f 100644 --- a/tests/test_intl.py +++ b/tests/test_intl.py @@ -269,21 +269,21 @@ def test_text_builder(app, status, warning): result = (app.outdir / 'docfields.txt').text(encoding='utf-8') expect = (u"\nI18N WITH DOCFIELDS" u"\n*******************\n" - u"\nclass class Cls1\n" + u"\nclass Cls1\n" u"\n Parameters:" u"\n **param** -- DESCRIPTION OF PARAMETER param\n" - u"\nclass class Cls2\n" + u"\nclass Cls2\n" u"\n Parameters:" u"\n * **foo** -- DESCRIPTION OF PARAMETER foo\n" u"\n * **bar** -- DESCRIPTION OF PARAMETER bar\n" - u"\nclass class Cls3(values)\n" + u"\nclass Cls3(values)\n" u"\n Raises ValueError:" u"\n IF THE VALUES ARE OUT OF RANGE\n" - u"\nclass class Cls4(values)\n" + u"\nclass Cls4(values)\n" u"\n Raises:" u"\n * **TypeError** -- IF THE VALUES ARE NOT VALID\n" u"\n * **ValueError** -- IF THE VALUES ARE OUT OF RANGE\n" - u"\nclass class Cls5\n" + u"\nclass Cls5\n" u"\n Returns:" u'\n A NEW "Cls3" INSTANCE\n') yield assert_equal, result, expect