fork/mons

git clone https://git.julia.blue/fork/mons

coloursofnoiseStrip inline markup from help text, include meta options in sphinx docsa48714d

fixes
3.6 KiB125 linesraw
1# Configuration file for the Sphinx documentation builder.
2#
3# This file only contains a selection of the most common options. For a full
4# list see the documentation:
5# https://www.sphinx-doc.org/en/master/usage/configuration.html
6#
7#
8# -- Path setup --------------------------------------------------------------
9#
10# If extensions (or modules to document with autodoc) are in another directory,
11# add these directories to sys.path here. If the directory is relative to the
12# documentation root, use os.path.abspath to make it absolute, like shown here.
13#
14# import os
15# import sys
16# sys.path.insert(0, os.path.abspath('..'))
17import os
18import sys
19
20sys.path.append(os.path.abspath("./_extensions"))
21
22# -- Project information -----------------------------------------------------
23
24project = "mons"
25author = "coloursofnoise"
26copyright = "2022-2023, coloursofnoise"
27
28
29# -- General configuration ---------------------------------------------------
30
31# Add any Sphinx extension module names here, as strings. They can be
32# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
33# ones.
34extensions = [
35    "sphinx_click",
36    "myst_parser",
37    "sphinx.ext.autodoc",
38    "autodoc_ext",
39    "glossarygen",
40    "manpages_ext",
41]
42
43suppress_warnings = ["myst.header"]
44
45# Add any paths that contain templates here, relative to this directory.
46templates_path = ["_templates"]
47
48# List of patterns, relative to source directory, that match files and
49# directories to ignore when looking for source files.
50# This pattern also affects html_static_path and html_extra_path.
51exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"]
52
53# Don't prepend module names to object names.
54add_module_names = False
55
56# Don't include values for autodoc members.
57autodoc_default_options = {"no-value": True}
58
59autodoc_member_order = "bysource"
60
61
62def process_options(app, ctx, lines):
63    meta_options = getattr(ctx.command, "meta_options", {})
64    if not meta_options:
65        return
66
67    for section, opts in meta_options.items():
68        lines.append(".. rubric:: {}".format(section))
69        lines.append("")
70        for opt, desc in opts:
71            lines.append(".. option:: {}".format(opt))
72            lines.append("")
73            lines.append("    " + desc)
74
75
76def setup(app):
77    app.connect("sphinx-click-process-options", process_options)
78
79
80# -- Options for manual page output ------------------------------------------
81
82man_pages = [
83    ("everest", "mons", "", "", "1"),
84    ("mods", "mons-mods", "", "", "1"),
85    ("config", "mons", "", "", "5"),
86    ("glossary", "mons-glossary", "", "", "7"),
87    ("overlayfs", "mons-overlayfs", "", "", "7"),
88]
89
90# Use 'man/man[0-9]' section sub-directories
91man_make_section_directory = True
92
93# URL to use when displaying manpage links in HTML pages.
94manpages_url = "https://www.man7.org/linux/man-pages/man{section}/{page}.{section}.html"
95
96
97# -- Options for HTML output -------------------------------------------------
98
99# The theme to use for HTML and HTML Help pages.  See the documentation for
100# a list of builtin themes.
101#
102html_theme = "alabaster"
103
104html_theme_options = {
105    "github_user": "coloursofnoise",
106    "github_repo": "mons",
107    "github_type": "star",
108    "github_count": "true",
109}
110
111html_sidebars = {
112    "**": [
113        "about.html",
114        "project_links.html",
115        "navigation.html",
116        "relations.html",
117        "searchbox.html",
118        "donate.html",
119    ]
120}
121
122# Add any paths that contain custom static files (such as style sheets) here,
123# relative to this directory. They are copied after the builtin static files,
124# so a file named "default.css" will overwrite the builtin "default.css".
125# html_static_path = ['_static']