Skip to content

Commit a833a44

Browse files
committed
Improve docs layout.
1 parent fb04c15 commit a833a44

File tree

8 files changed

+49
-17
lines changed

8 files changed

+49
-17
lines changed

coverage_pyver_pragma/grammar.py

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,15 @@
1616
(:py:data:`VERSION_TAG`, :py:data:`PLATFORM_TAG` or :py:data:`IMPLEMENTATION_TAG`).
1717
The tags can be joined with the keywords ``AND``, ``OR`` and ``NOT``, with the exclamation mark ``!`` implying ``NOT``.
1818
Parentheses can be used to group sub expressions.
19-
A series of tags without keywords in between them are evaluated with ``AND``.
19+
A series of tags without keywords between them are evaluated with ``AND``.
2020
2121
.. py:data:: VERSION_TAG
2222
2323
A ``VERSION_TAG`` comprises an optional comparator (one of ``<=``, ``<``, ``>=``, ``>``),
2424
a version specifier in the form ``pyXX``, and an optional ``+`` to indicate ``>=``.
2525
26-
**Examples:**
26+
27+
:bold-title:`Example:`
2728
2829
.. parsed-literal::
2930
@@ -39,7 +40,8 @@
3940
A ``PLATFORM_TAG`` comprises a single word which will be compared (ignoring case)
4041
with the output of :func:`platform.system`.
4142
42-
**Examples:**
43+
44+
:bold-title:`Example:`
4345
4446
.. parsed-literal::
4547
@@ -59,7 +61,8 @@
5961
An ``IMPLEMENTATION_TAG`` comprises a single word which will be compared (ignoring case)
6062
with the output of :func:`platform.python_implementation`.
6163
62-
**Examples:**
64+
65+
:bold-title:`Example:`
6366
6467
.. parsed-literal::
6568
@@ -68,6 +71,7 @@
6871
IronPython
6972
Jython
7073
74+
7175
Examples
7276
-----------
7377
@@ -102,6 +106,7 @@
102106
API Reference
103107
----------------
104108
109+
.. automodulesumm:: coverage_pyver_pragma.grammar
105110
""" # noqa: D400
106111
#
107112
# Copyright © 2021 Dominic Davis-Foster <[email protected]>
@@ -185,7 +190,7 @@ class VersionTag(packaging.specifiers.SpecifierSet):
185190
A ``VERSION_TAG`` comprises an optional comparator (one of ``<=``, ``<``, ``>=``, ``>``),
186191
a version specifier in the form ``pyXX``, and an optional ``+`` to indicate ``>=``.
187192
188-
**Examples:**
193+
:bold-title:`Examples:`
189194
190195
.. parsed-literal::
191196
@@ -231,7 +236,7 @@ class PlatformTag(str):
231236
A ``PLATFORM_TAG`` comprises a single word which will be compared (ignoring case)
232237
with the output of :func:`platform.system`.
233238
234-
**Examples:**
239+
:bold-title:`Examples:`
235240
236241
.. parsed-literal::
237242
@@ -268,7 +273,7 @@ class ImplementationTag(str):
268273
An ``IMPLEMENTATION_TAG`` comprises a single word which will be compared (ignoring case)
269274
with the output of :func:`platform.python_implementation`.
270275
271-
**Examples:**
276+
:bold-title:`Examples:`
272277
273278
.. parsed-literal::
274279
@@ -278,6 +283,8 @@ class ImplementationTag(str):
278283
Jython
279284
280285
:param tokens:
286+
287+
.. latex:vspace:: -10px
281288
"""
282289

283290
__slots__ = ()
@@ -409,7 +416,7 @@ def __bool__(self):
409416
)
410417
)
411418
"""
412-
The ``coverage_pyver_pragma`` expression grammar.
419+
The :mod:`coverage_pyver_pragma` expression grammar.
413420
414421
This can be used to parse an expression outside of the coverage context.
415422
"""

doc-source/api.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,7 @@
22
Public API
33
=============
44

5+
.. autosummary-widths:: 6/16
6+
:html: 35/100
7+
58
.. automodule:: coverage_pyver_pragma

doc-source/conf.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,5 +66,16 @@
6666
}
6767

6868
latex_elements = {
69-
"fncychap": "\\usepackage[Bjarne]{fncychap}\n\\ChNameAsIs\n\\ChTitleAsIs\n",
69+
"printindex": "\\begin{flushleft}\n\\printindex\n\\end{flushleft}",
70+
"tableofcontents": "\\pdfbookmark[0]{\\contentsname}{toc}\\sphinxtableofcontents",
7071
}
72+
73+
74+
def setup(app):
75+
# 3rd party
76+
from sphinx_toolbox.latex import better_header_layout
77+
78+
app.connect("config-inited", lambda app, config: better_header_layout(config))
79+
80+
81+
toctree_plus_types.add("envvar")

doc-source/configuration.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ For instance, you are generating a report from a ``.coverage`` file produced on
1616

1717
Defaults to the output of :func:`'.'.join(platform.python_version_tuple()[:2]) <platform.python_version_tuple>`.
1818

19-
**Example:**
19+
:bold-title:`Example:`
2020

2121
.. prompt:: bash
2222

@@ -29,7 +29,7 @@ For instance, you are generating a report from a ``.coverage`` file produced on
2929

3030
Defaults to the output of :func:`platform.system`.
3131

32-
**Example:**
32+
:bold-title:`Example:`
3333

3434
.. prompt:: bash
3535

@@ -43,7 +43,7 @@ For instance, you are generating a report from a ``.coverage`` file produced on
4343

4444
Defaults to the output of :func:`platform.python_implementation`.
4545

46-
**Example:**
46+
:bold-title:`Example:`
4747

4848
.. prompt:: bash
4949

doc-source/requirements.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
git+https://github.com/sphinx-toolbox/html-section.git
1+
git+https://github.com/sphinx-toolbox/sphinx-toolbox-experimental.git
22
autodocsumm>=0.2.0
33
default-values>=0.4.2
44
extras-require>=0.2.0
@@ -11,7 +11,7 @@ sphinx-notfound-page>=0.5
1111
sphinx-prompt>=1.1.0
1212
sphinx-pyproject>=0.1.0
1313
sphinx-tabs>=1.1.13
14-
sphinx-toolbox>=2.9.0
14+
sphinx-toolbox>=2.12.0
1515
sphinxcontrib-httpdomain>=1.7.0
1616
sphinxemoji>=0.1.6
1717
toctree-plus>=0.1.0

doc-source/syntax.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,8 @@
22
Syntax
33
=========
44

5+
.. autosummary-widths:: 6/16
6+
:html: 3/10
7+
58
.. automodule:: coverage_pyver_pragma.grammar
9+
:no-autosummary:

pyproject.toml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ extensions = [
5454
"sphinx_toolbox.more_autosummary",
5555
"sphinx_toolbox.documentation_summary",
5656
"sphinx_toolbox.tweaks.param_dash",
57+
"sphinx_toolbox.tweaks.latex_layout",
5758
"sphinx_toolbox.tweaks.latex_toc",
5859
"sphinx.ext.intersphinx",
5960
"sphinx.ext.mathjax",
@@ -67,7 +68,9 @@ extensions = [
6768
"sphinxcontrib.toctree_plus",
6869
"sphinx_debuginfo",
6970
"seed_intersphinx_mapping",
70-
"html_section",
71+
"sphinx_toolbox_experimental.html_section",
72+
"sphinx_toolbox_experimental.autosummary_widths",
73+
"sphinx_toolbox_experimental.needspace",
7174
]
7275
sphinxemoji_style = "twemoji"
7376
gitstamp_fmt = "%d %b %Y"
@@ -89,7 +92,6 @@ toctree_plus_types = [
8992
"exception",
9093
"flag",
9194
"function",
92-
"method",
9395
"namedtuple",
9496
"protocol",
9597
"role",

repo_helper.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,12 @@ keywords:
4545
- coverage
4646

4747
extra_sphinx_extensions:
48-
- html_section
48+
- sphinx_toolbox_experimental.html_section
49+
- sphinx_toolbox_experimental.autosummary_widths
50+
- sphinx_toolbox_experimental.needspace
4951

5052
exclude_files:
5153
- contributing
54+
55+
sphinx_conf_epilogue:
56+
- toctree_plus_types.add("envvar")

0 commit comments

Comments
 (0)