xref: /aosp_15_r20/external/pigweed/docs/conf.py (revision 61c4878ac05f98d0ceed94b57d316916de578985)
1*61c4878aSAndroid Build Coastguard Worker# Copyright 2020 The Pigweed Authors
2*61c4878aSAndroid Build Coastguard Worker#
3*61c4878aSAndroid Build Coastguard Worker# Licensed under the Apache License, Version 2.0 (the "License"); you may not
4*61c4878aSAndroid Build Coastguard Worker# use this file except in compliance with the License. You may obtain a copy of
5*61c4878aSAndroid Build Coastguard Worker# the License at
6*61c4878aSAndroid Build Coastguard Worker#
7*61c4878aSAndroid Build Coastguard Worker#     https://www.apache.org/licenses/LICENSE-2.0
8*61c4878aSAndroid Build Coastguard Worker#
9*61c4878aSAndroid Build Coastguard Worker# Unless required by applicable law or agreed to in writing, software
10*61c4878aSAndroid Build Coastguard Worker# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
11*61c4878aSAndroid Build Coastguard Worker# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
12*61c4878aSAndroid Build Coastguard Worker# License for the specific language governing permissions and limitations under
13*61c4878aSAndroid Build Coastguard Worker# the License.
14*61c4878aSAndroid Build Coastguard Worker"""Pigweed's Sphinx configuration."""
15*61c4878aSAndroid Build Coastguard Worker
16*61c4878aSAndroid Build Coastguard Workerfrom datetime import date
17*61c4878aSAndroid Build Coastguard Worker
18*61c4878aSAndroid Build Coastguard Worker
19*61c4878aSAndroid Build Coastguard Workerfrom pw_console.pigweed_code_style import PigweedCodeStyle
20*61c4878aSAndroid Build Coastguard Workerfrom pw_console.pigweed_code_style import PigweedCodeLightStyle
21*61c4878aSAndroid Build Coastguard Worker
22*61c4878aSAndroid Build Coastguard Worker# The suffix of source filenames.
23*61c4878aSAndroid Build Coastguard Workersource_suffix = ['.rst']
24*61c4878aSAndroid Build Coastguard Worker
25*61c4878aSAndroid Build Coastguard Worker# The master toctree document.  # inclusive-language: ignore
26*61c4878aSAndroid Build Coastguard Workermaster_doc = 'index'
27*61c4878aSAndroid Build Coastguard Worker
28*61c4878aSAndroid Build Coastguard Worker# General information about the project.
29*61c4878aSAndroid Build Coastguard Workerproject = 'Pigweed'
30*61c4878aSAndroid Build Coastguard Workercopyright = f'{date.today().year} The Pigweed Authors'  # pylint: disable=redefined-builtin
31*61c4878aSAndroid Build Coastguard Worker
32*61c4878aSAndroid Build Coastguard Worker# The version info for the project you're documenting, acts as replacement for
33*61c4878aSAndroid Build Coastguard Worker# |version| and |release|, also used in various other places throughout the
34*61c4878aSAndroid Build Coastguard Worker# built documents.
35*61c4878aSAndroid Build Coastguard Worker#
36*61c4878aSAndroid Build Coastguard Worker# The short X.Y version.
37*61c4878aSAndroid Build Coastguard Workerversion = '0.1'
38*61c4878aSAndroid Build Coastguard Worker# The full version, including alpha/beta/rc tags.
39*61c4878aSAndroid Build Coastguard Workerrelease = '0.1.0'
40*61c4878aSAndroid Build Coastguard Worker
41*61c4878aSAndroid Build Coastguard Worker
42*61c4878aSAndroid Build Coastguard Worker# Pygments plugin approach (https://pygments.org/docs/plugins/) for getting
43*61c4878aSAndroid Build Coastguard Worker# Sphinx to use our custom styles doesn't work. Use this approach instead:
44*61c4878aSAndroid Build Coastguard Worker# https://stackoverflow.com/q/48615629/1669860
45*61c4878aSAndroid Build Coastguard Workerdef pygments_monkeypatch_style(mod_name, cls):
46*61c4878aSAndroid Build Coastguard Worker    import sys
47*61c4878aSAndroid Build Coastguard Worker    import pygments.styles
48*61c4878aSAndroid Build Coastguard Worker
49*61c4878aSAndroid Build Coastguard Worker    cls_name = cls.__name__
50*61c4878aSAndroid Build Coastguard Worker    mod = type(__import__('os'))(mod_name)
51*61c4878aSAndroid Build Coastguard Worker    setattr(mod, cls_name, cls)
52*61c4878aSAndroid Build Coastguard Worker    setattr(pygments.styles, mod_name, mod)
53*61c4878aSAndroid Build Coastguard Worker    sys.modules['pygments.styles.' + mod_name] = mod
54*61c4878aSAndroid Build Coastguard Worker    from pygments.styles import STYLE_MAP
55*61c4878aSAndroid Build Coastguard Worker
56*61c4878aSAndroid Build Coastguard Worker    STYLE_MAP[mod_name] = mod_name + '::' + cls_name
57*61c4878aSAndroid Build Coastguard Worker
58*61c4878aSAndroid Build Coastguard Worker
59*61c4878aSAndroid Build Coastguard Workerpygments_monkeypatch_style('pigweed_code_style', PigweedCodeStyle)
60*61c4878aSAndroid Build Coastguard Workerpygments_monkeypatch_style('pigweed_code_light_style', PigweedCodeLightStyle)
61*61c4878aSAndroid Build Coastguard Worker
62*61c4878aSAndroid Build Coastguard Workerextensions = [
63*61c4878aSAndroid Build Coastguard Worker    "pw_docgen.sphinx.bug",
64*61c4878aSAndroid Build Coastguard Worker    "pw_docgen.sphinx.google_analytics",  # Enables optional Google Analytics
65*61c4878aSAndroid Build Coastguard Worker    "pw_docgen.sphinx.kconfig",
66*61c4878aSAndroid Build Coastguard Worker    "pw_docgen.sphinx.module_metadata",
67*61c4878aSAndroid Build Coastguard Worker    "pw_docgen.sphinx.modules_index",
68*61c4878aSAndroid Build Coastguard Worker    "pw_docgen.sphinx.pigweed_live",
69*61c4878aSAndroid Build Coastguard Worker    "pw_docgen.sphinx.pw_status_codes",
70*61c4878aSAndroid Build Coastguard Worker    "pw_docgen.sphinx.seed_metadata",
71*61c4878aSAndroid Build Coastguard Worker    "sphinx.ext.autodoc",  # Automatic documentation for Python code
72*61c4878aSAndroid Build Coastguard Worker    "sphinx.ext.napoleon",  # Parses Google-style docstrings
73*61c4878aSAndroid Build Coastguard Worker    "sphinxarg.ext",  # Automatic documentation of Python argparse
74*61c4878aSAndroid Build Coastguard Worker    "sphinxcontrib.mermaid",
75*61c4878aSAndroid Build Coastguard Worker    "sphinx_design",
76*61c4878aSAndroid Build Coastguard Worker    "breathe",
77*61c4878aSAndroid Build Coastguard Worker    "sphinx_copybutton",  # Copy-to-clipboard button on code blocks
78*61c4878aSAndroid Build Coastguard Worker    "sphinx_reredirects",
79*61c4878aSAndroid Build Coastguard Worker    "sphinx_sitemap",
80*61c4878aSAndroid Build Coastguard Worker]
81*61c4878aSAndroid Build Coastguard Worker
82*61c4878aSAndroid Build Coastguard Worker# When a user clicks the copy-to-clipboard button the `$ ` prompt should not be
83*61c4878aSAndroid Build Coastguard Worker# copied: https://sphinx-copybutton.readthedocs.io/en/latest/use.html
84*61c4878aSAndroid Build Coastguard Workercopybutton_prompt_text = "$ "
85*61c4878aSAndroid Build Coastguard Worker
86*61c4878aSAndroid Build Coastguard Worker_DIAG_HTML_IMAGE_FORMAT = 'SVG'
87*61c4878aSAndroid Build Coastguard Workerblockdiag_html_image_format = _DIAG_HTML_IMAGE_FORMAT
88*61c4878aSAndroid Build Coastguard Workernwdiag_html_image_format = _DIAG_HTML_IMAGE_FORMAT
89*61c4878aSAndroid Build Coastguard Workerseqdiag_html_image_format = _DIAG_HTML_IMAGE_FORMAT
90*61c4878aSAndroid Build Coastguard Workeractdiag_html_image_format = _DIAG_HTML_IMAGE_FORMAT
91*61c4878aSAndroid Build Coastguard Workerrackdiag_html_image_format = _DIAG_HTML_IMAGE_FORMAT
92*61c4878aSAndroid Build Coastguard Workerpacketdiag_html_image_format = _DIAG_HTML_IMAGE_FORMAT
93*61c4878aSAndroid Build Coastguard Worker
94*61c4878aSAndroid Build Coastguard Worker# Tell m2r to parse links to .md files and add them to the build.
95*61c4878aSAndroid Build Coastguard Workerm2r_parse_relative_links = True
96*61c4878aSAndroid Build Coastguard Worker
97*61c4878aSAndroid Build Coastguard Worker# The theme to use for HTML and HTML Help pages.  See the documentation for
98*61c4878aSAndroid Build Coastguard Worker# a list of builtin themes.
99*61c4878aSAndroid Build Coastguard Workerhtml_theme = 'pydata_sphinx_theme'
100*61c4878aSAndroid Build Coastguard Worker
101*61c4878aSAndroid Build Coastguard Worker# The name for this set of Sphinx documents.  If None, it defaults to
102*61c4878aSAndroid Build Coastguard Worker# "<project> v<release> documentation".
103*61c4878aSAndroid Build Coastguard Workerhtml_title = 'Pigweed'
104*61c4878aSAndroid Build Coastguard Worker
105*61c4878aSAndroid Build Coastguard Worker# If true, SmartyPants will be used to convert quotes and dashes to
106*61c4878aSAndroid Build Coastguard Worker# typographically correct entities.
107*61c4878aSAndroid Build Coastguard Workerhtml_use_smartypants = True
108*61c4878aSAndroid Build Coastguard Worker
109*61c4878aSAndroid Build Coastguard Worker# If false, no module index is generated.
110*61c4878aSAndroid Build Coastguard Workerhtml_domain_indices = True
111*61c4878aSAndroid Build Coastguard Worker
112*61c4878aSAndroid Build Coastguard Workerhtml_favicon = 'docs/_static/pw_logo.ico'
113*61c4878aSAndroid Build Coastguard Workerhtml_logo = 'docs/_static/pw_logo.svg'
114*61c4878aSAndroid Build Coastguard Worker
115*61c4878aSAndroid Build Coastguard Worker# If false, no index is generated.
116*61c4878aSAndroid Build Coastguard Workerhtml_use_index = True
117*61c4878aSAndroid Build Coastguard Worker
118*61c4878aSAndroid Build Coastguard Worker# If true, the index is split into individual pages for each letter.
119*61c4878aSAndroid Build Coastguard Workerhtml_split_index = False
120*61c4878aSAndroid Build Coastguard Worker
121*61c4878aSAndroid Build Coastguard Worker# If true, links to the reST sources are added to the pages.
122*61c4878aSAndroid Build Coastguard Workerhtml_show_sourcelink = False
123*61c4878aSAndroid Build Coastguard Worker
124*61c4878aSAndroid Build Coastguard Worker# If true, "Created using Sphinx" is shown in the HTML footer. Default is True.
125*61c4878aSAndroid Build Coastguard Workerhtml_show_sphinx = False
126*61c4878aSAndroid Build Coastguard Worker
127*61c4878aSAndroid Build Coastguard Worker# These folders are copied to the documentation's HTML output
128*61c4878aSAndroid Build Coastguard Workerhtml_static_path = ['docs/_static']
129*61c4878aSAndroid Build Coastguard Worker
130*61c4878aSAndroid Build Coastguard Worker# These paths are either relative to html_static_path
131*61c4878aSAndroid Build Coastguard Worker# or fully qualified paths (eg. https://...)
132*61c4878aSAndroid Build Coastguard Workerhtml_css_files = [
133*61c4878aSAndroid Build Coastguard Worker    "css/pigweed.css",
134*61c4878aSAndroid Build Coastguard Worker    # We could potentially merge the Google Fonts stylesheets into a single network
135*61c4878aSAndroid Build Coastguard Worker    # request but we already preconnect with the service in //docs/layout/layout.html
136*61c4878aSAndroid Build Coastguard Worker    # so the performance impact of keeping these as 3 separate calls should be
137*61c4878aSAndroid Build Coastguard Worker    # negligible.
138*61c4878aSAndroid Build Coastguard Worker    "https://fonts.googleapis.com/css2?family=Lato:ital,wght@0,100;0,300;0,400;0,700;0,900;1,100;1,300;1,400;1,700;1,900&display=swap",
139*61c4878aSAndroid Build Coastguard Worker    "https://fonts.googleapis.com/css2?family=Noto+Sans:ital,wght@0,100..900;1,100..900&display=swap",
140*61c4878aSAndroid Build Coastguard Worker    "https://fonts.googleapis.com/css2?family=Roboto+Mono:ital,wght@0,100..700;1,100..700&display=swap",
141*61c4878aSAndroid Build Coastguard Worker    # FontAwesome for mermaid and sphinx-design
142*61c4878aSAndroid Build Coastguard Worker    "https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.4/css/all.min.css",
143*61c4878aSAndroid Build Coastguard Worker]
144*61c4878aSAndroid Build Coastguard Worker
145*61c4878aSAndroid Build Coastguard Workerhtml_js_files = [
146*61c4878aSAndroid Build Coastguard Worker    "js/pigweed.js",
147*61c4878aSAndroid Build Coastguard Worker    # Needed for sidebar search
148*61c4878aSAndroid Build Coastguard Worker    "https://cdnjs.cloudflare.com/ajax/libs/fuzzysort/2.0.4/fuzzysort.js",
149*61c4878aSAndroid Build Coastguard Worker]
150*61c4878aSAndroid Build Coastguard Worker
151*61c4878aSAndroid Build Coastguard Workerhtml_extra_path = [
152*61c4878aSAndroid Build Coastguard Worker    # Note: In this repo the file lives at //docs/blog/rss.xml but during the
153*61c4878aSAndroid Build Coastguard Worker    # Sphinx build it's copied to the root of the website, https://pigweed.dev/rss.xml
154*61c4878aSAndroid Build Coastguard Worker    'docs/blog/rss.xml',
155*61c4878aSAndroid Build Coastguard Worker]
156*61c4878aSAndroid Build Coastguard Worker
157*61c4878aSAndroid Build Coastguard Workerhtml_theme_options = {
158*61c4878aSAndroid Build Coastguard Worker    # https://pydata-sphinx-theme.readthedocs.io/en/stable/user_guide/header-links.html#navigation-bar-dropdown-links
159*61c4878aSAndroid Build Coastguard Worker    'header_links_before_dropdown': 5,
160*61c4878aSAndroid Build Coastguard Worker    # https://pydata-sphinx-theme.readthedocs.io/en/stable/user_guide/header-links.html#icon-links
161*61c4878aSAndroid Build Coastguard Worker    'icon_links': [
162*61c4878aSAndroid Build Coastguard Worker        {
163*61c4878aSAndroid Build Coastguard Worker            'name': 'Source code',
164*61c4878aSAndroid Build Coastguard Worker            'url': 'https://cs.opensource.google/pigweed/pigweed/',
165*61c4878aSAndroid Build Coastguard Worker            'icon': 'fa-solid fa-code',
166*61c4878aSAndroid Build Coastguard Worker        },
167*61c4878aSAndroid Build Coastguard Worker        {
168*61c4878aSAndroid Build Coastguard Worker            'name': 'Issue tracker',
169*61c4878aSAndroid Build Coastguard Worker            'url': 'https://pwbug.dev',
170*61c4878aSAndroid Build Coastguard Worker            'icon': 'fa-solid fa-bug',
171*61c4878aSAndroid Build Coastguard Worker        },
172*61c4878aSAndroid Build Coastguard Worker        {
173*61c4878aSAndroid Build Coastguard Worker            'name': 'Discord',
174*61c4878aSAndroid Build Coastguard Worker            'url': 'https://discord.com/channels/691686718377558037/691686718377558040',
175*61c4878aSAndroid Build Coastguard Worker            'icon': 'fa-brands fa-discord',
176*61c4878aSAndroid Build Coastguard Worker        },
177*61c4878aSAndroid Build Coastguard Worker    ],
178*61c4878aSAndroid Build Coastguard Worker    # https://pydata-sphinx-theme.readthedocs.io/en/stable/user_guide/branding.html
179*61c4878aSAndroid Build Coastguard Worker    'logo': {
180*61c4878aSAndroid Build Coastguard Worker        'text': 'Pigweed',
181*61c4878aSAndroid Build Coastguard Worker        'image_light': '_static/pw_logo.svg',
182*61c4878aSAndroid Build Coastguard Worker        'image_dark': '_static/pw_logo.svg',
183*61c4878aSAndroid Build Coastguard Worker    },
184*61c4878aSAndroid Build Coastguard Worker    # https://pydata-sphinx-theme.readthedocs.io/en/stable/user_guide/layout.html#configure-the-navbar-center-alignment
185*61c4878aSAndroid Build Coastguard Worker    'navbar_align': 'right',
186*61c4878aSAndroid Build Coastguard Worker    # https://pydata-sphinx-theme.readthedocs.io/en/stable/user_guide/styling.html#configure-pygments-theme
187*61c4878aSAndroid Build Coastguard Worker    'pygments_light_style': 'pigweed_code_light_style',
188*61c4878aSAndroid Build Coastguard Worker    'pygments_dark_style': 'pigweed_code_style',
189*61c4878aSAndroid Build Coastguard Worker}
190*61c4878aSAndroid Build Coastguard Worker
191*61c4878aSAndroid Build Coastguard Worker# sphinx-sitemap needs this:
192*61c4878aSAndroid Build Coastguard Worker# https://sphinx-sitemap.readthedocs.io/en/latest/getting-started.html#usage
193*61c4878aSAndroid Build Coastguard Workerhtml_baseurl = 'https://pigweed.dev/'
194*61c4878aSAndroid Build Coastguard Worker
195*61c4878aSAndroid Build Coastguard Worker# Hide "Section Navigation" on homepage and changelog.
196*61c4878aSAndroid Build Coastguard Workerhtml_sidebars = {'index': [], 'changelog': []}
197*61c4878aSAndroid Build Coastguard Worker
198*61c4878aSAndroid Build Coastguard Workerhtml_context = {
199*61c4878aSAndroid Build Coastguard Worker    'default_mode': 'dark',
200*61c4878aSAndroid Build Coastguard Worker}
201*61c4878aSAndroid Build Coastguard Worker
202*61c4878aSAndroid Build Coastguard Worker# https://sphinx-sitemap.readthedocs.io/en/latest/advanced-configuration.html
203*61c4878aSAndroid Build Coastguard Workersitemap_url_scheme = '{link}'
204*61c4878aSAndroid Build Coastguard Worker
205*61c4878aSAndroid Build Coastguard Workermermaid_init_js = '''
206*61c4878aSAndroid Build Coastguard Workermermaid.initialize({
207*61c4878aSAndroid Build Coastguard Worker  // Mermaid is manually started in //docs/_static/js/pigweed.js.
208*61c4878aSAndroid Build Coastguard Worker  startOnLoad: false,
209*61c4878aSAndroid Build Coastguard Worker  // sequenceDiagram Note text alignment
210*61c4878aSAndroid Build Coastguard Worker  noteAlign: "left",
211*61c4878aSAndroid Build Coastguard Worker  // Set mermaid theme to the current furo theme
212*61c4878aSAndroid Build Coastguard Worker  theme: localStorage.getItem("theme") == "dark" ? "dark" : "default"
213*61c4878aSAndroid Build Coastguard Worker});
214*61c4878aSAndroid Build Coastguard Worker'''
215*61c4878aSAndroid Build Coastguard Worker
216*61c4878aSAndroid Build Coastguard Worker# Output file base name for HTML help builder.
217*61c4878aSAndroid Build Coastguard Workerhtmlhelp_basename = 'Pigweeddoc'
218*61c4878aSAndroid Build Coastguard Worker
219*61c4878aSAndroid Build Coastguard Worker# Client-side redirects. See //docs/contributing/docs/website.rst.
220*61c4878aSAndroid Build Coastguard Worker# Use relative URLs and provide the full path to ensure that the
221*61c4878aSAndroid Build Coastguard Worker# redirects work when developing locally. An example of using the
222*61c4878aSAndroid Build Coastguard Worker# full path is `./example/docs.html`. Using just `./example/`
223*61c4878aSAndroid Build Coastguard Worker# assumes that the redirect will work, which may not be true during
224*61c4878aSAndroid Build Coastguard Worker# local development.
225*61c4878aSAndroid Build Coastguard Workerredirects = {
226*61c4878aSAndroid Build Coastguard Worker    'docs/contributing': './contributing/index.html',
227*61c4878aSAndroid Build Coastguard Worker    'docs/contributing/changelog': './docs/changelog.html',
228*61c4878aSAndroid Build Coastguard Worker    'docs/contributing/module_docs': './docs/modules.html',
229*61c4878aSAndroid Build Coastguard Worker    'docs/getting_started': './get_started/index.html',
230*61c4878aSAndroid Build Coastguard Worker    'docs/infra/github': '../get_started/github.html',
231*61c4878aSAndroid Build Coastguard Worker    'docs/os_abstraction_layers': './os/index.html',
232*61c4878aSAndroid Build Coastguard Worker    'docs/release_notes/index': '../../changelog.html',
233*61c4878aSAndroid Build Coastguard Worker    'docs/release_notes/2022_jan': '../../changelog.html',
234*61c4878aSAndroid Build Coastguard Worker    'live/index': 'https://docs.google.com/document/d/1zcXQoMX6NDSe4cdxzt8afLbDcs8GSmI_Bsy5hTF_RVM/edit',
235*61c4878aSAndroid Build Coastguard Worker    'module_guides': './modules.html',
236*61c4878aSAndroid Build Coastguard Worker    'pw_sys_io_pico/docs': '../pw_sys_io_rp2040/docs.html',
237*61c4878aSAndroid Build Coastguard Worker    'pw_tokenizer/cli': './docs.html',
238*61c4878aSAndroid Build Coastguard Worker    'pw_tokenizer/guides': './docs.html',
239*61c4878aSAndroid Build Coastguard Worker    'seed/0000-index': './0000.html',
240*61c4878aSAndroid Build Coastguard Worker    'seed/0001-the-seed-process': './0001.html',
241*61c4878aSAndroid Build Coastguard Worker    'seed/0002-template': './0002.html',
242*61c4878aSAndroid Build Coastguard Worker    'seed/0101-pigweed.json': './0101.html',
243*61c4878aSAndroid Build Coastguard Worker    'seed/0102-module-docs': './0102.html',
244*61c4878aSAndroid Build Coastguard Worker    'seed/0103-pw_protobuf-past-present-future': './0103.html',
245*61c4878aSAndroid Build Coastguard Worker    'seed/0104-display-support': './0104.html',
246*61c4878aSAndroid Build Coastguard Worker    'seed/0105-pw_tokenizer-pw_log-nested-tokens': './0105.html',
247*61c4878aSAndroid Build Coastguard Worker    'seed/0107-communications': './0107.html',
248*61c4878aSAndroid Build Coastguard Worker    'seed/0108-pw_emu-emulators-frontend': './0108.html',
249*61c4878aSAndroid Build Coastguard Worker    'seed/0109-comms-buffers': './0109.html',
250*61c4878aSAndroid Build Coastguard Worker    'seed/0110-memory-allocation-interfaces': './0110.html',
251*61c4878aSAndroid Build Coastguard Worker    'seed/0111-build-systems': './0111.html',
252*61c4878aSAndroid Build Coastguard Worker    'seed/0112-async-poll': './0112.html',
253*61c4878aSAndroid Build Coastguard Worker    'seed/0113-bazel-cc-toolchain-api': './0113.html',
254*61c4878aSAndroid Build Coastguard Worker    'seed/0114-channels': './0114.html',
255*61c4878aSAndroid Build Coastguard Worker    'seed/0117-pw_i3c': './0117.html',
256*61c4878aSAndroid Build Coastguard Worker    'seed/0119-pw-sensor': './0119.html',
257*61c4878aSAndroid Build Coastguard Worker    'seed/0120-pw-sensor-config': './0120.html',
258*61c4878aSAndroid Build Coastguard Worker    'seed/0122-code-samples': './0122.html',
259*61c4878aSAndroid Build Coastguard Worker    'seed/0124-multisink-size-info': './0124.html',
260*61c4878aSAndroid Build Coastguard Worker    'seed/0128-abstracting-thread-creation': './0128.html',
261*61c4878aSAndroid Build Coastguard Worker    'seed/0130-update-sphinx-theme': './0130.html',
262*61c4878aSAndroid Build Coastguard Worker    'seeds/index': '../seed/0000-index.html',
263*61c4878aSAndroid Build Coastguard Worker    'sense/index': '../docs/showcases/sense/',
264*61c4878aSAndroid Build Coastguard Worker    'tour/index': '../docs/showcases/sense/',
265*61c4878aSAndroid Build Coastguard Worker}
266*61c4878aSAndroid Build Coastguard Worker
267*61c4878aSAndroid Build Coastguard Worker# One entry per manual page. List of tuples
268*61c4878aSAndroid Build Coastguard Worker# (source start file, name, description, authors, manual section).
269*61c4878aSAndroid Build Coastguard Workerman_pages = [('index', 'pigweed', 'Pigweed', ['Google'], 1)]
270*61c4878aSAndroid Build Coastguard Worker
271*61c4878aSAndroid Build Coastguard Worker# Grouping the document tree into Texinfo files. List of tuples
272*61c4878aSAndroid Build Coastguard Worker# (source start file, target name, title, author,
273*61c4878aSAndroid Build Coastguard Worker#  dir menu entry, description, category)
274*61c4878aSAndroid Build Coastguard Workertexinfo_documents = [
275*61c4878aSAndroid Build Coastguard Worker    (
276*61c4878aSAndroid Build Coastguard Worker        'index',
277*61c4878aSAndroid Build Coastguard Worker        'Pigweed',
278*61c4878aSAndroid Build Coastguard Worker        'Pigweed',
279*61c4878aSAndroid Build Coastguard Worker        'Google',
280*61c4878aSAndroid Build Coastguard Worker        'Pigweed',
281*61c4878aSAndroid Build Coastguard Worker        'Firmware framework',
282*61c4878aSAndroid Build Coastguard Worker        'Miscellaneous',
283*61c4878aSAndroid Build Coastguard Worker    ),
284*61c4878aSAndroid Build Coastguard Worker]
285*61c4878aSAndroid Build Coastguard Worker
286*61c4878aSAndroid Build Coastguard Workertemplates_path = ['docs/layout']
287*61c4878aSAndroid Build Coastguard Workerexclude_patterns = ['docs/templates/**']
288*61c4878aSAndroid Build Coastguard Worker
289*61c4878aSAndroid Build Coastguard Workerbreathe_projects = {
290*61c4878aSAndroid Build Coastguard Worker    # Assuming doxygen output is at out/docs/doxygen/
291*61c4878aSAndroid Build Coastguard Worker    # This dir should be relative to out/docs/gen/docs/pw_docgen_tree/
292*61c4878aSAndroid Build Coastguard Worker    "Pigweed": "./../../../doxygen/xml/",
293*61c4878aSAndroid Build Coastguard Worker}
294*61c4878aSAndroid Build Coastguard Workerbreathe_default_project = "Pigweed"
295*61c4878aSAndroid Build Coastguard Workerbreathe_debug_trace_directives = True
296*61c4878aSAndroid Build Coastguard Worker# (b/295023422) Disable the inaccurate `#include` statements that are generated
297*61c4878aSAndroid Build Coastguard Worker# when `doxygennamespace` is used.
298*61c4878aSAndroid Build Coastguard Workerbreathe_show_include = False
299*61c4878aSAndroid Build Coastguard Worker
300*61c4878aSAndroid Build Coastguard Worker# Treat these as valid attributes in function signatures.
301*61c4878aSAndroid Build Coastguard Workercpp_id_attributes = [
302*61c4878aSAndroid Build Coastguard Worker    "PW_EXTERN_C_START",
303*61c4878aSAndroid Build Coastguard Worker    "PW_NO_LOCK_SAFETY_ANALYSIS",
304*61c4878aSAndroid Build Coastguard Worker]
305*61c4878aSAndroid Build Coastguard Worker# This allows directives like this to work:
306*61c4878aSAndroid Build Coastguard Worker# .. cpp:function:: inline bool try_lock_for(
307*61c4878aSAndroid Build Coastguard Worker#     chrono::SystemClock::duration timeout) PW_EXCLUSIVE_TRYLOCK_FUNCTION(true)
308*61c4878aSAndroid Build Coastguard Workercpp_paren_attributes = [
309*61c4878aSAndroid Build Coastguard Worker    "PW_EXCLUSIVE_TRYLOCK_FUNCTION",
310*61c4878aSAndroid Build Coastguard Worker    "PW_EXCLUSIVE_LOCK_FUNCTION",
311*61c4878aSAndroid Build Coastguard Worker    "PW_UNLOCK_FUNCTION",
312*61c4878aSAndroid Build Coastguard Worker    "PW_NO_SANITIZE",
313*61c4878aSAndroid Build Coastguard Worker]
314*61c4878aSAndroid Build Coastguard Worker# inclusive-language: disable
315*61c4878aSAndroid Build Coastguard Worker# Info on cpp_id_attributes and cpp_paren_attributes
316*61c4878aSAndroid Build Coastguard Worker# https://www.sphinx-doc.org/en/master/usage/configuration.html#confval-cpp_id_attributes
317*61c4878aSAndroid Build Coastguard Worker# inclusive-language: enable
318*61c4878aSAndroid Build Coastguard Worker
319*61c4878aSAndroid Build Coastguard Worker# Disable Python type hints
320*61c4878aSAndroid Build Coastguard Worker# autodoc_typehints = 'none'
321*61c4878aSAndroid Build Coastguard Worker
322*61c4878aSAndroid Build Coastguard Worker# Break class and function signature arguments into one arg per line if the
323*61c4878aSAndroid Build Coastguard Worker# total length exceeds 130 characters. 130 seems about right for keeping one or
324*61c4878aSAndroid Build Coastguard Worker# two parameters on a single line.
325*61c4878aSAndroid Build Coastguard Workermaximum_signature_line_length = 130
326*61c4878aSAndroid Build Coastguard Worker
327*61c4878aSAndroid Build Coastguard Worker
328*61c4878aSAndroid Build Coastguard Workerdef do_not_skip_init(app, what, name, obj, would_skip, options):
329*61c4878aSAndroid Build Coastguard Worker    if name == "__init__":
330*61c4878aSAndroid Build Coastguard Worker        return False  # never skip __init__ functions
331*61c4878aSAndroid Build Coastguard Worker    return would_skip
332*61c4878aSAndroid Build Coastguard Worker
333*61c4878aSAndroid Build Coastguard Worker
334*61c4878aSAndroid Build Coastguard Worker# Problem: CSS files aren't copied after modifying them. Solution:
335*61c4878aSAndroid Build Coastguard Worker# https://github.com/sphinx-doc/sphinx/issues/2090#issuecomment-572902572
336*61c4878aSAndroid Build Coastguard Workerdef env_get_outdated(app, env, added, changed, removed):
337*61c4878aSAndroid Build Coastguard Worker    return ['index']
338*61c4878aSAndroid Build Coastguard Worker
339*61c4878aSAndroid Build Coastguard Worker
340*61c4878aSAndroid Build Coastguard Workerdef setup(app):
341*61c4878aSAndroid Build Coastguard Worker    app.add_css_file('css/pigweed.css')
342*61c4878aSAndroid Build Coastguard Worker    app.connect('env-get-outdated', env_get_outdated)
343*61c4878aSAndroid Build Coastguard Worker    app.connect("autodoc-skip-member", do_not_skip_init)
344