mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Merge branch '1.7'
This commit is contained in:
commit
3d180f9385
2
CHANGES
2
CHANGES
@ -198,6 +198,8 @@ Bugs fixed
|
||||
* #5036: quickstart: Typing Ctrl-U clears the whole of line
|
||||
* #5066: html: "relations" sidebar is not shown by default
|
||||
* #5091: latex: curly braces in index entries are not handled correctly
|
||||
* #5070: epub: Wrong internal href fragment links
|
||||
* #5104: apidoc: Interface of ``sphinx.apidoc:main()`` has changed
|
||||
|
||||
Testing
|
||||
--------
|
||||
|
@ -9,6 +9,7 @@
|
||||
:license: BSD, see LICENSE for details.
|
||||
"""
|
||||
|
||||
import sys
|
||||
import warnings
|
||||
|
||||
from sphinx.deprecation import RemovedInSphinx20Warning
|
||||
@ -16,19 +17,18 @@ from sphinx.ext.apidoc import main as _main
|
||||
|
||||
if False:
|
||||
# For type annotation
|
||||
from typing import Any # NOQA
|
||||
from typing import List # NOQA
|
||||
from sphinx.application import Sphinx # NOQA
|
||||
|
||||
|
||||
def main(*args, **kwargs):
|
||||
# type: (Any, Any) -> None
|
||||
def main(argv=sys.argv):
|
||||
# type: (List[str]) -> None
|
||||
warnings.warn(
|
||||
'`sphinx.apidoc.main()` has moved to `sphinx.ext.apidoc.main()`.',
|
||||
RemovedInSphinx20Warning,
|
||||
stacklevel=2,
|
||||
)
|
||||
args = args[1:] # skip first argument to adjust arguments (refs: #4615)
|
||||
_main(*args, **kwargs)
|
||||
_main(argv[1:]) # skip first argument to adjust arguments (refs: #4615)
|
||||
|
||||
|
||||
# So program can be started with "python -m sphinx.apidoc ..."
|
||||
|
@ -272,6 +272,16 @@ class EpubBuilder(StandaloneHTMLBuilder):
|
||||
node['refuri'] = self.fix_fragment(m.group(1), m.group(2))
|
||||
if 'refid' in node:
|
||||
node['refid'] = self.fix_fragment('', node['refid'])
|
||||
for node in tree.traverse(nodes.target):
|
||||
for i, node_id in enumerate(node['ids']):
|
||||
if ':' in node_id:
|
||||
node['ids'][i] = self.fix_fragment('', node_id)
|
||||
|
||||
next_node = node.next_node(siblings=True)
|
||||
if next_node and isinstance(next_node, nodes.Element):
|
||||
for i, node_id in enumerate(next_node['ids']):
|
||||
if ':' in node_id:
|
||||
next_node['ids'][i] = self.fix_fragment('', node_id)
|
||||
for node in tree.traverse(addnodes.desc_signature):
|
||||
ids = node.attributes['ids']
|
||||
newids = []
|
||||
|
11
tests/roots/test-epub-anchor-id/conf.py
Normal file
11
tests/roots/test-epub-anchor-id/conf.py
Normal file
@ -0,0 +1,11 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
master_doc = 'index'
|
||||
|
||||
latex_documents = [
|
||||
(master_doc, 'test.tex', 'The basic Sphinx documentation for testing', 'Sphinx', 'report')
|
||||
]
|
||||
|
||||
|
||||
def setup(app):
|
||||
app.add_crossref_type(directivename="setting", rolename="setting")
|
8
tests/roots/test-epub-anchor-id/index.rst
Normal file
8
tests/roots/test-epub-anchor-id/index.rst
Normal file
@ -0,0 +1,8 @@
|
||||
test-epub-anchor-id
|
||||
===================
|
||||
|
||||
.. setting:: STATICFILES_FINDERS
|
||||
|
||||
blah blah blah
|
||||
|
||||
see :setting:`STATICFILES_FINDERS`
|
@ -317,6 +317,15 @@ def test_epub_writing_mode(app):
|
||||
assert 'writing-mode: vertical-rl;' in css
|
||||
|
||||
|
||||
@pytest.mark.sphinx('epub', testroot='epub-anchor-id')
|
||||
def test_epub_anchor_id(app):
|
||||
app.build()
|
||||
|
||||
html = (app.outdir / 'index.xhtml').text()
|
||||
assert '<p id="std-setting-STATICFILES_FINDERS">blah blah blah</p>' in html
|
||||
assert 'see <a class="reference internal" href="#std-setting-STATICFILES_FINDERS">' in html
|
||||
|
||||
|
||||
@pytest.mark.sphinx('epub', testroot='html_assets')
|
||||
def test_epub_assets(app):
|
||||
app.builder.build_all()
|
||||
|
Loading…
Reference in New Issue
Block a user