mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Merge pull request #6734 from tk0miya/5070_epub_wrong_anchor
Fix #5070: epub: Wrong internal href fragment links
This commit is contained in:
1
CHANGES
1
CHANGES
@@ -34,6 +34,7 @@ Bugs fixed
|
||||
* #6718: i18n: KeyError is raised if section title and table title are same
|
||||
* #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
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -5,4 +5,9 @@ test-epub-anchor-id
|
||||
|
||||
blah blah blah
|
||||
|
||||
.. setting:: STATICFILES_SECTION
|
||||
|
||||
blah blah blah
|
||||
==============
|
||||
|
||||
see :setting:`STATICFILES_FINDERS`
|
||||
|
||||
@@ -321,6 +321,7 @@ def test_epub_anchor_id(app):
|
||||
|
||||
html = (app.outdir / 'index.xhtml').text()
|
||||
assert '<p id="std-setting-STATICFILES_FINDERS">blah blah blah</p>' in html
|
||||
assert '<span id="std-setting-STATICFILES_SECTION"></span><h1>blah blah blah</h1>' in html
|
||||
assert 'see <a class="reference internal" href="#std-setting-STATICFILES_FINDERS">' in html
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user