mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Merge branch '2.0' into 1331_useragent
This commit is contained in:
commit
b4cd34c8f4
5
CHANGES
5
CHANGES
@ -7,6 +7,8 @@ Dependencies
|
||||
Incompatible changes
|
||||
--------------------
|
||||
|
||||
* #6742: ``end-before`` option of :rst:dir:`literalinclude` directive does not
|
||||
match the first line of the code block.
|
||||
* #1331: Change default User-Agent header to ``"Sphinx/X.Y.Z requests/X.Y.Z
|
||||
python/X.Y.Z"``. It can be changed via :confval:`user_agent`.
|
||||
|
||||
@ -22,6 +24,9 @@ Features added
|
||||
* #6707: C++, support bit-fields.
|
||||
* #267: html: Eliminate prompt characters of doctest block from copyable text
|
||||
* #6729: html theme: agogo theme now supports ``rightsidebar`` option
|
||||
* #6780: Add PEP-561 Support
|
||||
* #6762: latex: Allow to load additonal LaTeX packages via ``extrapackages`` key
|
||||
of :confval:`latex_elements`
|
||||
* #1331: Add new config variable: :confval:`user_agent`
|
||||
|
||||
Bugs fixed
|
||||
|
@ -226,6 +226,25 @@ into the generated ``.tex`` files. Its ``'sphinxsetup'`` key is described
|
||||
|
||||
.. versionadded:: 1.5
|
||||
|
||||
``'extrapackages'``
|
||||
Additional LaTeX packages. For example:
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
latex_elements = {
|
||||
'packages': r'\usepackage{isodate}'
|
||||
}
|
||||
|
||||
It defaults to empty.
|
||||
|
||||
The specified LaTeX packages will be loaded before
|
||||
hyperref package and packages loaded from Sphinx extensions.
|
||||
|
||||
.. hint:: If you'd like to load additional LaTeX packages after hyperref, use
|
||||
``'preamble'`` key instead.
|
||||
|
||||
.. versionadded:: 2.3
|
||||
|
||||
``'footer'``
|
||||
Additional footer content (before the indices), default empty.
|
||||
|
||||
|
3
setup.py
3
setup.py
@ -216,6 +216,9 @@ setup(
|
||||
],
|
||||
platforms='any',
|
||||
packages=find_packages(exclude=['tests', 'utils']),
|
||||
package_data = {
|
||||
'sphinx': ['py.typed'],
|
||||
},
|
||||
include_package_data=True,
|
||||
entry_points={
|
||||
'console_scripts': [
|
||||
|
@ -348,7 +348,7 @@ class LiteralIncludeReader:
|
||||
return lines[:lineno + 1]
|
||||
else:
|
||||
if lineno == 0:
|
||||
return []
|
||||
pass # end-before ignores first line
|
||||
else:
|
||||
return lines[:lineno]
|
||||
if inclusive is True:
|
||||
|
0
sphinx/py.typed
Normal file
0
sphinx/py.typed
Normal file
@ -35,6 +35,7 @@
|
||||
<%= sphinxsetup %>
|
||||
<%= fvset %>
|
||||
<%= geometry %>
|
||||
<%= extrapackages %>
|
||||
|
||||
<%- for name, option in packages %>
|
||||
<%- if option %>
|
||||
|
@ -155,6 +155,7 @@ DEFAULT_SETTINGS = {
|
||||
'% Set up styles of URL: it should be placed after hyperref.\n'
|
||||
'\\urlstyle{same}'),
|
||||
'contentsname': '',
|
||||
'extrapackages': '',
|
||||
'preamble': '',
|
||||
'title': '',
|
||||
'release': '',
|
||||
|
@ -1437,3 +1437,11 @@ def test_index_on_title(app, status, warning):
|
||||
'\\label{\\detokenize{contents:test-for-index-in-top-level-title}}'
|
||||
'\\index{index@\\spxentry{index}}\n'
|
||||
in result)
|
||||
|
||||
|
||||
@pytest.mark.sphinx('latex', testroot='basic',
|
||||
confoverrides={'latex_elements': {'extrapackages': r'\usepackage{foo}'}})
|
||||
def test_latex_elements_extrapackages(app, status, warning):
|
||||
app.builder.build_all()
|
||||
result = (app.outdir / 'test.tex').text()
|
||||
assert r'\usepackage{foo}' in result
|
||||
|
@ -206,6 +206,14 @@ def test_LiteralIncludeReader_missing_start_and_end(literal_inc_path):
|
||||
content, lines = reader.read()
|
||||
|
||||
|
||||
def test_LiteralIncludeReader_end_before(literal_inc_path):
|
||||
options = {'end-before': 'nclud'} # *nclud* matches first and third lines.
|
||||
reader = LiteralIncludeReader(literal_inc_path, options, DUMMY_CONFIG)
|
||||
content, lines = reader.read()
|
||||
assert content == ("# Literally included file using Python highlighting\n"
|
||||
"\n")
|
||||
|
||||
|
||||
@pytest.mark.xfail(os.name != 'posix', reason="Not working on windows")
|
||||
def test_LiteralIncludeReader_prepend(literal_inc_path):
|
||||
options = {'lines': '1', 'prepend': 'Hello', 'append': 'Sphinx'}
|
||||
|
Loading…
Reference in New Issue
Block a user