diff --git a/docs/conf.py b/docs/conf.py index 5261bc5a4cce740c40259070e2d97b38d5c94988..a3de50d81a2bfa74f3676d3262ddcdaa7d8d6e0c 100755 --- a/docs/conf.py +++ b/docs/conf.py @@ -134,7 +134,7 @@ else: # The name of an image file (relative to this directory) to place at the top # of the sidebar. -#html_logo = '../logo/trans-logo.png' +#html_logo = '../../logo/trans-logo.png' # The name of an image file (within the static path) to use as favicon of the # docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32 @@ -277,3 +277,23 @@ texinfo_documents = [ # Example configuration for intersphinx: refer to the Python standard library. intersphinx_mapping = {'http://docs.python.org/': None} + + +# Work out the port to generate the docs for +from collections import OrderedDict +micropy_port = os.getenv('MICROPY_PORT') or 'pyboard' +tags.add('port_' + micropy_port) +ports = OrderedDict(( + ("unix", "unix"), + ("pyboard", "the pyboard"), + ("wipy", "the WiPy"), + ("esp8266", "esp8266"), +)) + +# The members of the html_context dict are available inside topindex.html +url_prefix = os.getenv('MICROPY_URL_PREFIX') or '/' +html_context = { + 'port':micropy_port, + 'port_name':ports[micropy_port], + 'all_ports':[(n, url_prefix + p) for p, n in ports.items()], +} diff --git a/docs/contents.rst b/docs/contents.rst index e5d3ad32975945828db839631c220f3f0d2a1094..b35e80d85fc95677b6c4c4715ccd8fbfa5cc386d 100644 --- a/docs/contents.rst +++ b/docs/contents.rst @@ -1,11 +1,20 @@ Micro Python documentation contents =================================== -.. toctree:: - - quickref.rst - general.rst - tutorial/index.rst - library/index.rst - hardware/index.rst - license.rst +.. only:: port_pyboard + + .. toctree:: + + pyboard/quickref.rst + pyboard/general.rst + pyboard/tutorial/index.rst + library/index.rst + pyboard/hardware/index.rst + license.rst + +.. only:: port_esp8266 + + .. toctree:: + + library/index.rst + license.rst diff --git a/docs/index.rst b/docs/index.rst index c11677efd5557e98ece21db14e217932a15c3e93..e86ff857b7a797cd0133c1975bcb9ea0abc7642b 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -1,15 +1,25 @@ Micro Python documentation and references ========================================= -.. toctree:: - - quickref.rst - general.rst - tutorial/index.rst - library/index.rst - hardware/index.rst - license.rst - contents.rst +.. only:: port_pyboard + + .. toctree:: + + pyboard/quickref.rst + pyboard/general.rst + pyboard/tutorial/index.rst + library/index.rst + pyboard/hardware/index.rst + license.rst + contents.rst + +.. only:: port_esp8266 + + .. toctree:: + + library/index.rst + license.rst + contents.rst Indices and tables ================== diff --git a/docs/general.rst b/docs/pyboard/general.rst similarity index 100% rename from docs/general.rst rename to docs/pyboard/general.rst diff --git a/docs/hardware/index.rst b/docs/pyboard/hardware/index.rst similarity index 100% rename from docs/hardware/index.rst rename to docs/pyboard/hardware/index.rst diff --git a/docs/quickref.rst b/docs/pyboard/quickref.rst similarity index 100% rename from docs/quickref.rst rename to docs/pyboard/quickref.rst diff --git a/docs/tutorial/accel.rst b/docs/pyboard/tutorial/accel.rst similarity index 100% rename from docs/tutorial/accel.rst rename to docs/pyboard/tutorial/accel.rst diff --git a/docs/tutorial/amp_skin.rst b/docs/pyboard/tutorial/amp_skin.rst similarity index 100% rename from docs/tutorial/amp_skin.rst rename to docs/pyboard/tutorial/amp_skin.rst diff --git a/docs/tutorial/assembler.rst b/docs/pyboard/tutorial/assembler.rst similarity index 100% rename from docs/tutorial/assembler.rst rename to docs/pyboard/tutorial/assembler.rst diff --git a/docs/tutorial/debounce.rst b/docs/pyboard/tutorial/debounce.rst similarity index 100% rename from docs/tutorial/debounce.rst rename to docs/pyboard/tutorial/debounce.rst diff --git a/docs/tutorial/fading_led.rst b/docs/pyboard/tutorial/fading_led.rst similarity index 100% rename from docs/tutorial/fading_led.rst rename to docs/pyboard/tutorial/fading_led.rst diff --git a/docs/tutorial/img/fading_leds_breadboard_fritzing.png b/docs/pyboard/tutorial/img/fading_leds_breadboard_fritzing.png similarity index 100% rename from docs/tutorial/img/fading_leds_breadboard_fritzing.png rename to docs/pyboard/tutorial/img/fading_leds_breadboard_fritzing.png diff --git a/docs/tutorial/img/pyboard_servo.jpg b/docs/pyboard/tutorial/img/pyboard_servo.jpg similarity index 100% rename from docs/tutorial/img/pyboard_servo.jpg rename to docs/pyboard/tutorial/img/pyboard_servo.jpg diff --git a/docs/tutorial/img/pyboard_usb_micro.jpg b/docs/pyboard/tutorial/img/pyboard_usb_micro.jpg similarity index 100% rename from docs/tutorial/img/pyboard_usb_micro.jpg rename to docs/pyboard/tutorial/img/pyboard_usb_micro.jpg diff --git a/docs/tutorial/img/skin_amp_1.jpg b/docs/pyboard/tutorial/img/skin_amp_1.jpg similarity index 100% rename from docs/tutorial/img/skin_amp_1.jpg rename to docs/pyboard/tutorial/img/skin_amp_1.jpg diff --git a/docs/tutorial/img/skin_amp_2.jpg b/docs/pyboard/tutorial/img/skin_amp_2.jpg similarity index 100% rename from docs/tutorial/img/skin_amp_2.jpg rename to docs/pyboard/tutorial/img/skin_amp_2.jpg diff --git a/docs/tutorial/img/skin_lcd_1.jpg b/docs/pyboard/tutorial/img/skin_lcd_1.jpg similarity index 100% rename from docs/tutorial/img/skin_lcd_1.jpg rename to docs/pyboard/tutorial/img/skin_lcd_1.jpg diff --git a/docs/tutorial/img/skin_lcd_2.jpg b/docs/pyboard/tutorial/img/skin_lcd_2.jpg similarity index 100% rename from docs/tutorial/img/skin_lcd_2.jpg rename to docs/pyboard/tutorial/img/skin_lcd_2.jpg diff --git a/docs/tutorial/index.rst b/docs/pyboard/tutorial/index.rst similarity index 100% rename from docs/tutorial/index.rst rename to docs/pyboard/tutorial/index.rst diff --git a/docs/tutorial/intro.rst b/docs/pyboard/tutorial/intro.rst similarity index 100% rename from docs/tutorial/intro.rst rename to docs/pyboard/tutorial/intro.rst diff --git a/docs/tutorial/lcd_skin.rst b/docs/pyboard/tutorial/lcd_skin.rst similarity index 100% rename from docs/tutorial/lcd_skin.rst rename to docs/pyboard/tutorial/lcd_skin.rst diff --git a/docs/tutorial/leds.rst b/docs/pyboard/tutorial/leds.rst similarity index 100% rename from docs/tutorial/leds.rst rename to docs/pyboard/tutorial/leds.rst diff --git a/docs/tutorial/pass_through.rst b/docs/pyboard/tutorial/pass_through.rst similarity index 100% rename from docs/tutorial/pass_through.rst rename to docs/pyboard/tutorial/pass_through.rst diff --git a/docs/tutorial/power_ctrl.rst b/docs/pyboard/tutorial/power_ctrl.rst similarity index 100% rename from docs/tutorial/power_ctrl.rst rename to docs/pyboard/tutorial/power_ctrl.rst diff --git a/docs/tutorial/repl.rst b/docs/pyboard/tutorial/repl.rst similarity index 100% rename from docs/tutorial/repl.rst rename to docs/pyboard/tutorial/repl.rst diff --git a/docs/tutorial/reset.rst b/docs/pyboard/tutorial/reset.rst similarity index 100% rename from docs/tutorial/reset.rst rename to docs/pyboard/tutorial/reset.rst diff --git a/docs/tutorial/script.rst b/docs/pyboard/tutorial/script.rst similarity index 100% rename from docs/tutorial/script.rst rename to docs/pyboard/tutorial/script.rst diff --git a/docs/tutorial/servo.rst b/docs/pyboard/tutorial/servo.rst similarity index 100% rename from docs/tutorial/servo.rst rename to docs/pyboard/tutorial/servo.rst diff --git a/docs/tutorial/switch.rst b/docs/pyboard/tutorial/switch.rst similarity index 100% rename from docs/tutorial/switch.rst rename to docs/pyboard/tutorial/switch.rst diff --git a/docs/tutorial/timer.rst b/docs/pyboard/tutorial/timer.rst similarity index 100% rename from docs/tutorial/timer.rst rename to docs/pyboard/tutorial/timer.rst diff --git a/docs/tutorial/usb_mouse.rst b/docs/pyboard/tutorial/usb_mouse.rst similarity index 100% rename from docs/tutorial/usb_mouse.rst rename to docs/pyboard/tutorial/usb_mouse.rst diff --git a/docs/topindex.html b/docs/topindex.html index fb1e048d40a765ff4564e059427858c1c5aa172b..a810f61c4ff1bf9658bac1fa2127b2b59829d467 100644 --- a/docs/topindex.html +++ b/docs/topindex.html @@ -8,36 +8,53 @@ v{{ release|e }}{% if last_updated %}, {{ _('last updated') }} {{ last_updated|e }}{% endif %}. </p> + <p> + MicroPython runs on a variety of systems and each has their own specific + documentation. You are currently viewing the documentation for + <strong>{{ port_name }}</strong>. + </p> + + <!--p> + Documentation for other systems are available: + {% for p in all_ports %} + <a href="{{ p[1] }}">{{ p[0] }}</a>{% if not loop.last %}, {% endif %} + {% endfor %}. + </p--> + <p><strong>Documentation for Micro Python and the pyboard:</strong></p> <table class="contentstable"><tr> <td width="40%" style="padding-left:2em;"> - <p class="biglink"> - <a class="biglink" href="{{ pathto("quickref") }}">Quick reference for the pyboard</a><br/> - <span class="linkdescr">pinout for the pyboard and snippets of useful code</span> - </p> - <p class="biglink"> - <a class="biglink" href="{{ pathto("general") }}">General information about the pyboard</a><br/> - <span class="linkdescr">read this first for a quick overview</span> - </p> - <p class="biglink"> - <a class="biglink" href="{{ pathto("tutorial/index") }}">Tutorials and code examples</a><br/> - <span class="linkdescr">start here</span> - </p> + {% if port == "pyboard" %} + <p class="biglink"> + <a class="biglink" href="{{ pathto(port + "/quickref") }}">Quick reference for {{ port_name }}</a><br/> + <span class="linkdescr">pinout for {{ port_name }} and snippets of useful code</span> + </p> + <p class="biglink"> + <a class="biglink" href="{{ pathto(port + "/general") }}">General information about {{ port_name }}</a><br/> + <span class="linkdescr">read this first for a quick overview</span> + </p> + <p class="biglink"> + <a class="biglink" href="{{ pathto(port + "/tutorial/index") }}">Tutorials and code examples</a><br/> + <span class="linkdescr">start here</span> + </p> + {% endif %} <p class="biglink"> <a class="biglink" href="{{ pathto("library/index") }}">Library Reference</a><br/> <span class="linkdescr">Micro Python libraries, including the <a href="{{ pathto("library/pyb") }}">pyb module</a></span> </p> </td> <td width="40%" style="padding-left:2em;"> - <p class="biglink"> - <a class="biglink" href="{{ pathto("hardware/index") }}">The pyboard hardware</a><br/> - <span class="linkdescr">schematics, dimensions and component datasheets</span> - </p> - <p class="biglink"> - <a class="biglink" href="http://micropython.org/resources/Micro-Python-Windows-setup.pdf">Guide for pyboard on Windows (PDF)</a><br/> - <span class="linkdescr">including DFU programming</span> - </p> + {% if port == "pyboard" %} + <p class="biglink"> + <a class="biglink" href="{{ pathto(port + "/hardware/index") }}">The {{ port }} hardware</a><br/> + <span class="linkdescr">schematics, dimensions and component datasheets</span> + </p> + <p class="biglink"> + <a class="biglink" href="http://micropython.org/resources/Micro-Python-Windows-setup.pdf">Guide for {{ port_name }} on Windows (PDF)</a><br/> + <span class="linkdescr">including DFU programming</span> + </p> + {% endif %} <p class="biglink"> <a class="biglink" href="{{ pathto("license") }}">License</a><br/> <span class="linkdescr">Micro Python license information</span> @@ -62,10 +79,6 @@ <a class="biglink" href="{{ pathto("contents") }}">Table of contents</a><br/> <span class="linkdescr">a list of all sections and subsections</span> </p> - <p class="biglink"> - <a class="biglink" href="{{ pathto("search") }}">Search page</a><br/> - <span class="linkdescr">search this documentation</span> - </p> </td></tr> </table>