diff --git a/CHANGES b/CHANGES index cad76cd50..472d20ebe 100644 --- a/CHANGES +++ b/CHANGES @@ -33,6 +33,7 @@ Bugs fixed * #6584: i18n: Error when compiling message catalogs on Hindi * #6708: mathbase: Some deprecated functions have removed * #6709: autodoc: mock object does not work as a class decorator +* #5070: epub: Wrong internal href fragment links * #6712: Allow not to install sphinx.testing as runtime (mainly for ALT Linux) Testing diff --git a/sphinx/builders/_epub_base.py b/sphinx/builders/_epub_base.py index 75e79936b..9bdf856a6 100644 --- a/sphinx/builders/_epub_base.py +++ b/sphinx/builders/_epub_base.py @@ -272,7 +272,7 @@ class EpubBuilder(StandaloneHTMLBuilder): if ':' in node_id: target['ids'][i] = self.fix_fragment('', node_id) - next_node = target.next_node(siblings=True) # type: Node + next_node = target.next_node(ascend=True) # type: Node if isinstance(next_node, nodes.Element): for i, node_id in enumerate(next_node['ids']): if ':' in node_id: diff --git a/tests/roots/test-epub-anchor-id/index.rst b/tests/roots/test-epub-anchor-id/index.rst index f3064615c..75e3c6054 100644 --- a/tests/roots/test-epub-anchor-id/index.rst +++ b/tests/roots/test-epub-anchor-id/index.rst @@ -5,4 +5,9 @@ test-epub-anchor-id blah blah blah +.. setting:: STATICFILES_SECTION + +blah blah blah +============== + see :setting:`STATICFILES_FINDERS` diff --git a/tests/test_build_epub.py b/tests/test_build_epub.py index bace00ea7..9436ac020 100644 --- a/tests/test_build_epub.py +++ b/tests/test_build_epub.py @@ -321,6 +321,7 @@ def test_epub_anchor_id(app): html = (app.outdir / 'index.xhtml').text() assert '

blah blah blah

' in html + assert '

blah blah blah

' in html assert 'see ' in html