Skip to content

Commit 9193827

Browse files
committed
Decouple documentation index from man pages
In general, the HTML documentation can (and should) contain more than just a single “Usage” chapter. For example, we might want to add a second man page, and include the latter in the HTML documentation, too. Or we might want to add unrelated info to the HTML documentation which is not supposed to show up in a man page. To accommodate for that, add one layer of indirection so the man page will be generated from the Usage document, and at the same time, the Usage document will be included in the HTML documentation.
1 parent a4b5b32 commit 9193827

3 files changed

Lines changed: 24 additions & 18 deletions

File tree

{{ cookiecutter.pypi_package_name }}/doc/sphinx/conf.py

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information
88

99
project = '{{ cookiecutter.project_title }}'
10-
executable_name = '{{ cookiecutter.executable_name }}'
10+
executable = '{{ cookiecutter.executable_name }}'
1111
author = '{{ cookiecutter.author_full_name }} <{{ cookiecutter.author_email }}>'
1212
description = '{{ cookiecutter.project_description }}'
1313

@@ -29,18 +29,20 @@
2929

3030
# Man page output
3131

32-
man_pages = [(
33-
'index',
34-
{% if cookiecutter.include_executable == "y" -%}
35-
executable_name,
36-
{%- else -%}
37-
'{{ cookiecutter.pypi_package_name }}',
38-
{%- endif %}
39-
description,
40-
[author],
41-
{% if cookiecutter.include_executable == "y" -%}
42-
1,
43-
{%- else -%}
44-
3,
45-
{%- endif %}
46-
)]
32+
man_pages = [
33+
(
34+
'usage',
35+
{% if cookiecutter.include_executable == "y" -%}
36+
executable,
37+
{%- else -%}
38+
'{{ cookiecutter.pypi_package_name }}',
39+
{%- endif %}
40+
description,
41+
[author],
42+
{% if cookiecutter.include_executable == "y" -%}
43+
1,
44+
{%- else -%}
45+
3,
46+
{%- endif %}
47+
)
48+
]

{{ cookiecutter.pypi_package_name }}/doc/sphinx/index.rst

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,4 @@ Welcome to {{ cookiecutter.project_title }}'s documentation!
55
:maxdepth: 2
66
:caption: Contents:
77

8-
.. include:: ../../USAGE.md
9-
:parser: myst_parser.sphinx_
8+
usage
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
Usage
2+
=====
3+
4+
.. include:: ../../USAGE.md
5+
:parser: myst_parser.sphinx_

0 commit comments

Comments
 (0)