merge with stable

This commit is contained in:
Georg Brandl 2015-07-24 15:59:47 +02:00
commit c2f1a27905
9 changed files with 64 additions and 8 deletions

View File

@ -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
----------

View File

@ -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',

View File

@ -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] + ': ')

View File

@ -0,0 +1,4 @@
.. seealso::
* item 1
* item 2

View File

@ -0,0 +1,4 @@
# -*- coding: utf-8 -*-
extensions = ['sphinx.ext.graphviz']
master_doc = 'index'

View File

@ -0,0 +1,7 @@
graphviz
========
.. digraph:: foo
:caption: caption of graph
bar -> baz

View File

@ -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"

View File

@ -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 = ('<p class="graphviz">\s*<img .*?/>\s*</p>\s*'
'<p class="caption"><span class="caption-text">caption of graph</span>')
assert re.search(html, content, re.S)

View File

@ -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