docs: Add list of supported board to module page

This commit is contained in:
Jeff Epler 2021-07-24 14:11:04 -05:00
parent fa906357fa
commit f2b9e98a21
2 changed files with 22 additions and 1 deletions

11
conf.py
View File

@ -24,6 +24,7 @@ import subprocess
import sys
import urllib.parse
import time
from collections import defaultdict
from sphinx.transforms import SphinxTransform
from docutils import nodes
@ -47,9 +48,15 @@ subprocess.check_output(["make", "stubs"])
#modules_support_matrix = shared_bindings_matrix.support_matrix_excluded_boards()
modules_support_matrix = shared_bindings_matrix.support_matrix_by_board()
modules_support_matrix_reverse = defaultdict(list)
for board, modules in modules_support_matrix.items():
for module in modules:
modules_support_matrix_reverse[module].append(board)
modules_support_matrix_reverse = dict((module, ", ".join(boards)) for module, boards in modules_support_matrix_reverse.items())
html_context = {
'support_matrix': modules_support_matrix
'support_matrix': modules_support_matrix,
'support_matrix_reverse': modules_support_matrix_reverse
}
# -- General configuration ------------------------------------------------
@ -94,6 +101,8 @@ autoapi_template_dir = 'docs/autoapi/templates'
autoapi_python_class_content = "both"
autoapi_python_use_implicit_namespaces = True
autoapi_root = "shared-bindings"
def autoapi_prepare_jinja_env(jinja_env):
jinja_env.globals['support_matrix_reverse'] = modules_support_matrix_reverse
redirects_file = 'docs/redirects.txt'

View File

@ -14,6 +14,18 @@
{% endif %}
{% if support_matrix_reverse[obj.name] is defined %}
.. raw:: html
<p>
<details>
<summary>Module Availability</summary>
Available on: {{ support_matrix_reverse[obj.name] }}
</details>
</p>
{% endif %}
{% block subpackages %}
{% set visible_subpackages = obj.subpackages|selectattr("display")|list %}
{% if visible_subpackages %}