Skip to content

Commit 7ca1bd3

Browse files
Daniel Camporadpgeorge
authored andcommitted
docs: Generate a separate docs build for each port.
Using Damien's approach where conf.py and topindex.html are shared by all ports.
1 parent 031278f commit 7ca1bd3

32 files changed

Lines changed: 94 additions & 42 deletions

docs/conf.py

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@
134134

135135
# The name of an image file (relative to this directory) to place at the top
136136
# of the sidebar.
137-
#html_logo = '../logo/trans-logo.png'
137+
#html_logo = '../../logo/trans-logo.png'
138138

139139
# The name of an image file (within the static path) to use as favicon of the
140140
# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
@@ -277,3 +277,23 @@
277277

278278
# Example configuration for intersphinx: refer to the Python standard library.
279279
intersphinx_mapping = {'http://docs.python.org/': None}
280+
281+
282+
# Work out the port to generate the docs for
283+
from collections import OrderedDict
284+
micropy_port = os.getenv('MICROPY_PORT') or 'pyboard'
285+
tags.add('port_' + micropy_port)
286+
ports = OrderedDict((
287+
("unix", "unix"),
288+
("pyboard", "the pyboard"),
289+
("wipy", "the WiPy"),
290+
("esp8266", "esp8266"),
291+
))
292+
293+
# The members of the html_context dict are available inside topindex.html
294+
url_prefix = os.getenv('MICROPY_URL_PREFIX') or '/'
295+
html_context = {
296+
'port':micropy_port,
297+
'port_name':ports[micropy_port],
298+
'all_ports':[(n, url_prefix + p) for p, n in ports.items()],
299+
}

docs/contents.rst

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,20 @@
11
Micro Python documentation contents
22
===================================
33

4-
.. toctree::
5-
6-
quickref.rst
7-
general.rst
8-
tutorial/index.rst
9-
library/index.rst
10-
hardware/index.rst
11-
license.rst
4+
.. only:: port_pyboard
5+
6+
.. toctree::
7+
8+
pyboard/quickref.rst
9+
pyboard/general.rst
10+
pyboard/tutorial/index.rst
11+
library/index.rst
12+
pyboard/hardware/index.rst
13+
license.rst
14+
15+
.. only:: port_esp8266
16+
17+
.. toctree::
18+
19+
library/index.rst
20+
license.rst

docs/index.rst

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,25 @@
11
Micro Python documentation and references
22
=========================================
33

4-
.. toctree::
5-
6-
quickref.rst
7-
general.rst
8-
tutorial/index.rst
9-
library/index.rst
10-
hardware/index.rst
11-
license.rst
12-
contents.rst
4+
.. only:: port_pyboard
5+
6+
.. toctree::
7+
8+
pyboard/quickref.rst
9+
pyboard/general.rst
10+
pyboard/tutorial/index.rst
11+
library/index.rst
12+
pyboard/hardware/index.rst
13+
license.rst
14+
contents.rst
15+
16+
.. only:: port_esp8266
17+
18+
.. toctree::
19+
20+
library/index.rst
21+
license.rst
22+
contents.rst
1323

1424
Indices and tables
1525
==================
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)