Skip to content

Commit 91031b6

Browse files
committed
docs/conf.py: Active sphinx_selective_exclude extensions.
For modindex_exclude extension, per-port module excludes are also added. With these changes, it's possible to generate docs for a particular port devoid of any superfluous and unrelated content, including in indexes and full-text search - with small caveat: when generating PDF docs after HTML, or vice-versa cached internal doctree representation (build/*/doctrees/) must be removed first.
1 parent f6d01b8 commit 91031b6

File tree

1 file changed

+21
-4
lines changed

1 file changed

+21
-4
lines changed

docs/conf.py

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
# If extensions (or modules to document with autodoc) are in another directory,
2020
# add these directories to sys.path here. If the directory is relative to the
2121
# documentation root, use os.path.abspath to make it absolute, like shown here.
22-
#sys.path.insert(0, os.path.abspath('.'))
22+
sys.path.insert(0, os.path.abspath('.'))
2323

2424
# Work out the port to generate the docs for
2525
from collections import OrderedDict
@@ -71,6 +71,9 @@
7171
'sphinx.ext.intersphinx',
7272
'sphinx.ext.todo',
7373
'sphinx.ext.coverage',
74+
'sphinx_selective_exclude.modindex_exclude',
75+
'sphinx_selective_exclude.eager_only',
76+
'sphinx_selective_exclude.search_auto_exclude',
7477
]
7578

7679
# Add any paths that contain templates here, relative to this directory.
@@ -316,6 +319,20 @@
316319

317320
# Append the other ports' specific folders/files to the exclude pattern
318321
exclude_patterns.extend([port + '*' for port in ports if port != micropy_port])
319-
# Exclude pyb module if the port is the WiPy
320-
if micropy_port == 'wipy':
321-
exclude_patterns.append('library/pyb*')
322+
323+
modules_port_specific = {
324+
'pyboard': ['pyb'],
325+
'wipy': ['wipy'],
326+
'esp8266': ['esp'],
327+
}
328+
329+
modindex_exclude = []
330+
331+
for p, l in modules_port_specific.items():
332+
if p != micropy_port:
333+
modindex_exclude += l
334+
335+
# Exclude extra modules per port
336+
modindex_exclude += {
337+
'esp8266': ['cmath', 'select'],
338+
}.get(micropy_port, [])

0 commit comments

Comments
 (0)