From 87b30cc3cbb23eb8d1f95c9a16536f1b7937d54f Mon Sep 17 00:00:00 2001 From: Takeshi KOMIYA Date: Wed, 3 May 2017 01:07:20 +0900 Subject: [PATCH 1/5] Fix #3685: AttributeError when using 3rd party domains --- CHANGES | 1 + sphinx/util/docfields.py | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGES b/CHANGES index 3e9f938bb..b48e17778 100644 --- a/CHANGES +++ b/CHANGES @@ -19,6 +19,7 @@ Bugs fixed * #3657: EPUB builder crashes if document startswith genindex exists * #3588: No compact (p tag) html output in the i18n document build even when :confval:`html_compact_lists` is True. +* #3685: AttributeError when using 3rd party domains Testing -------- diff --git a/sphinx/util/docfields.py b/sphinx/util/docfields.py index 79b19d00e..45bdb0600 100644 --- a/sphinx/util/docfields.py +++ b/sphinx/util/docfields.py @@ -310,7 +310,8 @@ class DocFieldTransformer(object): else: fieldtype, content = entry fieldtypes = types.get(fieldtype.name, {}) + env = self.directive.state.document.settings.env new_list += fieldtype.make_field(fieldtypes, self.directive.domain, - content, env=self.directive.env) + content, env=env) node.replace_self(new_list) From 097cd87fd8ceda2fed377c5207909e351315b24e Mon Sep 17 00:00:00 2001 From: Takeshi KOMIYA Date: Wed, 3 May 2017 01:18:13 +0900 Subject: [PATCH 2/5] Update CHANGES for PR #2454 (refs: 3691) --- CHANGES | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGES b/CHANGES index b48e17778..9b96777ba 100644 --- a/CHANGES +++ b/CHANGES @@ -259,6 +259,7 @@ Incompatible changes * Emit warnings that will be deprecated in Sphinx 1.6 by default. Users can change the behavior by setting the environment variable PYTHONWARNINGS. Please refer :ref:`when-deprecation-warnings-are-displayed`. +* #2454: new JavaScript variable ``SOURCELINK_SUFFIX`` is added Deprecated ---------- From 4ffe79c54872eea943663dc5bfe9d74139adfb80 Mon Sep 17 00:00:00 2001 From: jfbu Date: Tue, 2 May 2017 18:35:33 +0200 Subject: [PATCH 3/5] Fix duplicate entry in CHANGES (in 1.5a1 Incompatible changes) --- CHANGES | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/CHANGES b/CHANGES index 9b96777ba..7c0c7e564 100644 --- a/CHANGES +++ b/CHANGES @@ -218,10 +218,8 @@ Incompatible changes * QtHelpBuilder doens't generate search page (ref: #2352) * QtHelpBuilder uses ``nonav`` theme instead of default one to improve readability. -* latex: To provide good default settings to Japanese docs, Sphinx uses ``jsbook`` - as a docclass by default if the ``language`` is ``ja``. -* latex: To provide good default settings to Japanese docs, Sphinx uses - ``jreport`` and ``jsbooks`` as a docclass by default if the ``language`` is +* latex: To provide good default settings to Japanese documents, Sphinx uses + ``jreport`` and ``jsbook`` as docclass if :confval:`language` is ``ja``. * ``sphinx-quickstart`` now allows a project version is empty * Fix :download: role on epub/qthelp builder. They ignore the role because they don't support it. From 321a5e7a5e757b7138e4dfb9aa0e163afe3916ea Mon Sep 17 00:00:00 2001 From: jfbu Date: Thu, 4 May 2017 09:36:04 +0200 Subject: [PATCH 4/5] Fix #3702: abstract LaTeX styling of figure legends into sphinxlegend --- doc/latex.rst | 9 ++++++++- sphinx/texinputs/sphinx.sty | 2 ++ sphinx/writers/latex.py | 4 ++-- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/doc/latex.rst b/doc/latex.rst index ebc14765e..b027528fa 100644 --- a/doc/latex.rst +++ b/doc/latex.rst @@ -438,7 +438,14 @@ Let us now list some macros from the package file the new macros are wrappers of the formerly hard-coded ``\texttt``, ``\emph``, ... The default definitions can be found in :file:`sphinx.sty`. -- paragraph level environments: for each admonition type ````, the +- a :dudir:`figure` may have an optional legend with arbitrary body + elements: they are rendered in a ``sphinxlegend`` environment. The default + definition issues ``\small``, and ends with ``\par``. + + .. versionadded:: 1.5.6 + formerly, the ``\small`` was hardcoded in LaTeX writer and the ending + ``\par`` was lacking. +- for each admonition type ````, the used environment is named ``sphinx``. They may be ``\renewenvironment`` 'd individually, and must then be defined with one argument (it is the heading of the notice, for example ``Warning:`` for :dudir:`warning` directive, if diff --git a/sphinx/texinputs/sphinx.sty b/sphinx/texinputs/sphinx.sty index 15f9910ff..7a142c116 100644 --- a/sphinx/texinputs/sphinx.sty +++ b/sphinx/texinputs/sphinx.sty @@ -1383,6 +1383,8 @@ \protected\def\sphinxstyleliteralstrong {\sphinxbfcode} \protected\def\sphinxstyleabbreviation {\textsc} \protected\def\sphinxstyleliteralintitle {\sphinxcode} +% figure legend comes after caption and may contain arbitrary body elements +\newenvironment{sphinxlegend}{\par\small}{\par} % LaTeX writer uses macros to hide double quotes from \sphinxcode's \@noligs \protected\def\sphinxquotedblleft{``} diff --git a/sphinx/writers/latex.py b/sphinx/writers/latex.py index be0771c09..44155da71 100644 --- a/sphinx/writers/latex.py +++ b/sphinx/writers/latex.py @@ -1599,10 +1599,10 @@ class LaTeXTranslator(nodes.NodeVisitor): self.unrestrict_footnote(node) def visit_legend(self, node): - self.body.append('{\\small ') + self.body.append('\n\\begin{sphinxlegend}') def depart_legend(self, node): - self.body.append('}') + self.body.append('\\end{sphinxlegend}\n') def visit_admonition(self, node): self.body.append('\n\\begin{sphinxadmonition}{note}') From da8007c3f481615085157a18c3fe8932366913e6 Mon Sep 17 00:00:00 2001 From: jfbu Date: Fri, 5 May 2017 13:15:41 +0200 Subject: [PATCH 5/5] Update CHANGES for PR #3703 --- CHANGES | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGES b/CHANGES index 7c0c7e564..e5fc48393 100644 --- a/CHANGES +++ b/CHANGES @@ -20,6 +20,7 @@ Bugs fixed * #3588: No compact (p tag) html output in the i18n document build even when :confval:`html_compact_lists` is True. * #3685: AttributeError when using 3rd party domains +* #3702: LaTeX writer styles figure legends with a hard-coded ``\small`` Testing --------