|
21 | 21 | # documentation root, use os.path.abspath to make it absolute, like shown here. |
22 | 22 | #sys.path.insert(0, os.path.abspath('.')) |
23 | 23 |
|
| 24 | +# Work out the port to generate the docs for |
| 25 | +from collections import OrderedDict |
| 26 | +micropy_port = os.getenv('MICROPY_PORT') or 'pyboard' |
| 27 | +tags.add('port_' + micropy_port) |
| 28 | +ports = OrderedDict(( |
| 29 | + ("unix", "unix"), |
| 30 | + ("pyboard", "the pyboard"), |
| 31 | + ("wipy", "the WiPy"), |
| 32 | + ("esp8266", "esp8266"), |
| 33 | +)) |
| 34 | + |
| 35 | +# The members of the html_context dict are available inside topindex.html |
| 36 | +url_prefix = os.getenv('MICROPY_URL_PREFIX') or '/' |
| 37 | +html_context = { |
| 38 | + 'port':micropy_port, |
| 39 | + 'port_name':ports[micropy_port], |
| 40 | + 'all_ports':[(n, url_prefix + p) for p, n in ports.items()], |
| 41 | +} |
| 42 | + |
| 43 | + |
| 44 | +# Specify a custom master document based on the port name |
| 45 | +master_doc = micropy_port + '_' + 'index' |
| 46 | + |
24 | 47 | # -- General configuration ------------------------------------------------ |
25 | 48 |
|
26 | 49 | # If your documentation needs a minimal Sphinx version, state it here. |
|
213 | 236 | # (source start file, target name, title, |
214 | 237 | # author, documentclass [howto, manual, or own class]). |
215 | 238 | latex_documents = [ |
216 | | - ('index', 'MicroPython.tex', 'MicroPython Documentation', |
| 239 | + (master_doc, 'MicroPython.tex', 'MicroPython Documentation', |
217 | 240 | 'Damien P. George', 'manual'), |
218 | 241 | ] |
219 | 242 |
|
|
257 | 280 | # (source start file, target name, title, author, |
258 | 281 | # dir menu entry, description, category) |
259 | 282 | texinfo_documents = [ |
260 | | - ('index', 'MicroPython', 'MicroPython Documentation', |
| 283 | + (master_doc, 'MicroPython', 'MicroPython Documentation', |
261 | 284 | 'Damien P. George', 'MicroPython', 'One line description of project.', |
262 | 285 | 'Miscellaneous'), |
263 | 286 | ] |
|
278 | 301 | # Example configuration for intersphinx: refer to the Python standard library. |
279 | 302 | intersphinx_mapping = {'http://docs.python.org/': None} |
280 | 303 |
|
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 | | -} |
300 | | - |
301 | 304 | # Append the other ports' specific folders/files to the exclude pattern |
302 | 305 | exclude_patterns.extend([port + '*' for port in ports if port != micropy_port]) |
303 | 306 | # Exclude pyb module if the port is the WiPy |
304 | 307 | if micropy_port == 'wipy': |
305 | 308 | exclude_patterns.append('library/pyb*') |
306 | 309 | else: # exclude machine |
307 | 310 | exclude_patterns.append('library/machine*') |
308 | | - |
309 | | -# Specify a custom master document based on the port name |
310 | | -master_doc = micropy_port + '_' + 'index' |
0 commit comments