From b7c679626a652a4abe35633415c8665d1886950c Mon Sep 17 00:00:00 2001 From: Takeshi KOMIYA Date: Sun, 3 Feb 2019 17:35:51 +0900 Subject: [PATCH 1/3] Fix #5948: LaTeX: duplicated labels are generated for sections --- CHANGES | 1 + sphinx/writers/latex.py | 5 ++--- tests/roots/test-latex-labels/index.rst | 2 ++ tests/test_build_latex.py | 4 ++++ 4 files changed, 9 insertions(+), 3 deletions(-) diff --git a/CHANGES b/CHANGES index e8ee9e4d0..4464210c4 100644 --- a/CHANGES +++ b/CHANGES @@ -32,6 +32,7 @@ Bugs fixed * #5954: ``:scale:`` image option may break PDF build if image in an admonition * #5960: LaTeX: modified PDF layout since September 2018 TeXLive update of :file:`parskip.sty` +* #5948: LaTeX: duplicated labels are generated for sections * #5958: versionadded directive causes crash with Python 3.5.0 * #5995: autodoc: autodoc_mock_imports conflict with metaclass on Python 3.7 * #5871: texinfo: a section title ``.`` is not allowed diff --git a/sphinx/writers/latex.py b/sphinx/writers/latex.py index 3ada12c4d..c97554e6a 100644 --- a/sphinx/writers/latex.py +++ b/sphinx/writers/latex.py @@ -1876,10 +1876,9 @@ class LaTeXTranslator(nodes.NodeVisitor): elif domain.get_enumerable_node_type(next_node) and domain.get_numfig_title(next_node): return - if 'refuri' in node: + if 'refuri' in node or 'refid' in node or 'refname' in node: + # skip indirect targets (external hyperlink and internal links) return - if node.get('refid'): - add_target(node['refid']) for id in node['ids']: add_target(id) diff --git a/tests/roots/test-latex-labels/index.rst b/tests/roots/test-latex-labels/index.rst index c55ee0b04..781db5a01 100644 --- a/tests/roots/test-latex-labels/index.rst +++ b/tests/roots/test-latex-labels/index.rst @@ -68,3 +68,5 @@ subsubsection .. toctree:: otherdoc + +* Embeded standalone hyperlink reference(refs: #5948): `subsection `_. diff --git a/tests/test_build_latex.py b/tests/test_build_latex.py index fb481371c..b81d2a3fe 100644 --- a/tests/test_build_latex.py +++ b/tests/test_build_latex.py @@ -1336,3 +1336,7 @@ def test_latex_labels(app, status, warning): assert ('\\subsection{otherdoc}\n' r'\label{\detokenize{otherdoc:otherdoc}}' r'\label{\detokenize{otherdoc::doc}}' in result) + + + # Embeded standalone hyperlink reference (refs: #5948) + assert result.count(r'\label{\detokenize{index:section1}}') == 1 From 2f61ba876c40bf8c77d74faf372279c3510166bb Mon Sep 17 00:00:00 2001 From: Takeshi KOMIYA Date: Sun, 3 Feb 2019 23:15:10 +0900 Subject: [PATCH 2/3] Bump to 1.8.4 final --- CHANGES | 20 +++----------------- sphinx/__init__.py | 4 ++-- 2 files changed, 5 insertions(+), 19 deletions(-) diff --git a/CHANGES b/CHANGES index 4464210c4..2ecae9e1a 100644 --- a/CHANGES +++ b/CHANGES @@ -1,20 +1,9 @@ -Release 1.8.4 (in development) -============================== - -Dependencies ------------- - -Incompatible changes --------------------- - -Deprecated ----------- - -Features added --------------- +Release 1.8.4 (released Feb 03, 2019) +===================================== Bugs fixed ---------- + * #3707: latex: no bold checkmark (✔) available. * #5605: with the documentation language set to Chinese, English words could not be searched. @@ -37,9 +26,6 @@ Bugs fixed * #5995: autodoc: autodoc_mock_imports conflict with metaclass on Python 3.7 * #5871: texinfo: a section title ``.`` is not allowed -Testing --------- - Release 1.8.3 (released Dec 26, 2018) ===================================== diff --git a/sphinx/__init__.py b/sphinx/__init__.py index 52b8d40a3..a1442f208 100644 --- a/sphinx/__init__.py +++ b/sphinx/__init__.py @@ -36,7 +36,7 @@ if 'PYTHONWARNINGS' not in os.environ: warnings.filterwarnings('ignore', "'U' mode is deprecated", DeprecationWarning, module='docutils.io') -__version__ = '1.8.4+' +__version__ = '1.8.4' __released__ = '1.8.4' # used when Sphinx builds its own docs #: Version info for better programmatic use. @@ -47,7 +47,7 @@ __released__ = '1.8.4' # used when Sphinx builds its own docs #: #: .. versionadded:: 1.2 #: Before version 1.2, check the string ``sphinx.__version__``. -version_info = (1, 8, 4, 'beta', 0) +version_info = (1, 8, 4, 'final', 0) package_dir = path.abspath(path.dirname(__file__)) From 4367e20ab436c734aad0169c87b2cf6811073bb4 Mon Sep 17 00:00:00 2001 From: Takeshi KOMIYA Date: Sun, 3 Feb 2019 23:18:18 +0900 Subject: [PATCH 3/3] Bump version --- CHANGES | 21 +++++++++++++++++++++ sphinx/__init__.py | 6 +++--- 2 files changed, 24 insertions(+), 3 deletions(-) diff --git a/CHANGES b/CHANGES index 2ecae9e1a..1811eec4d 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,24 @@ +Release 1.8.5 (in development) +============================== + +Dependencies +------------ + +Incompatible changes +-------------------- + +Deprecated +---------- + +Features added +-------------- + +Bugs fixed +---------- + +Testing +-------- + Release 1.8.4 (released Feb 03, 2019) ===================================== diff --git a/sphinx/__init__.py b/sphinx/__init__.py index a1442f208..1c305d027 100644 --- a/sphinx/__init__.py +++ b/sphinx/__init__.py @@ -36,8 +36,8 @@ if 'PYTHONWARNINGS' not in os.environ: warnings.filterwarnings('ignore', "'U' mode is deprecated", DeprecationWarning, module='docutils.io') -__version__ = '1.8.4' -__released__ = '1.8.4' # used when Sphinx builds its own docs +__version__ = '1.8.5+' +__released__ = '1.8.5' # used when Sphinx builds its own docs #: Version info for better programmatic use. #: @@ -47,7 +47,7 @@ __released__ = '1.8.4' # used when Sphinx builds its own docs #: #: .. versionadded:: 1.2 #: Before version 1.2, check the string ``sphinx.__version__``. -version_info = (1, 8, 4, 'final', 0) +version_info = (1, 8, 5, 'beta', 0) package_dir = path.abspath(path.dirname(__file__))