Merge lp:~rvb/maas/version-switcher-1.3 into lp:maas/1.3

Proposed by Raphaël Badin
Status: Merged
Merged at revision: 1475
Proposed branch: lp:~rvb/maas/version-switcher-1.3
Merge into: lp:maas/1.3
Prerequisite: lp:~rvb/maas/docs-1.3
Diff against target: 120 lines (+58/-3)
4 files modified
Makefile (+3/-0)
docs/_templates/maas/layout.html (+7/-1)
docs/_templates/maas/relations.html (+12/-0)
docs/conf.py (+36/-2)
To merge this branch: bzr merge lp:~rvb/maas/version-switcher-1.3
Reviewer Review Type Date Requested Status
Raphaël Badin (community) Approve
Review via email: mp+215605@code.launchpad.net

Commit message

Backport 2258: Add the bzr last revision, last revision date, and build date to the documentation pages.
Backport 2238: Add version switcher.

This only affects the documentation (i.e. not part of what gets packaged).

To post a comment you must log in.
Revision history for this message
Raphaël Badin (rvb) wrote :

Simple backport, self-approving.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'Makefile'
--- Makefile 2012-11-22 23:39:27 +0000
+++ Makefile 2014-04-14 07:56:25 +0000
@@ -139,6 +139,9 @@
139doc: bin/sphinx docs/api.rst139doc: bin/sphinx docs/api.rst
140 bin/sphinx140 bin/sphinx
141141
142doc-with-versions: bin/sphinx
143 cd docs/_build; make SPHINXOPTS="-A add_version_switcher=true" html
144
142man: $(patsubst docs/man/%.rst,man/%,$(wildcard docs/man/*.rst))145man: $(patsubst docs/man/%.rst,man/%,$(wildcard docs/man/*.rst))
143146
144man/%: docs/man/%.rst | bin/sphinx-build147man/%: docs/man/%.rst | bin/sphinx-build
145148
=== modified file 'docs/_templates/maas/layout.html'
--- docs/_templates/maas/layout.html 2014-04-14 07:56:25 +0000
+++ docs/_templates/maas/layout.html 2014-04-14 07:56:25 +0000
@@ -5,6 +5,7 @@
5<a style="border:0" title="MAAS Documentation Homepage" href="{{ pathto('index.html', 1) }}"><img src="{{ pathto('_static/maas-logo-200.png',1) }}" alt="MAAS logo"/></a>5<a style="border:0" title="MAAS Documentation Homepage" href="{{ pathto('index.html', 1) }}"><img src="{{ pathto('_static/maas-logo-200.png',1) }}" alt="MAAS logo"/></a>
6<h2 style="text-align:center;">MAAS</h2>6<h2 style="text-align:center;">MAAS</h2>
7<p style="font-style:italic;font-size:0.9em; text-align:center; margin-bottom:1.5em">Metal As A Service.</p>7<p style="font-style:italic;font-size:0.9em; text-align:center; margin-bottom:1.5em">Metal As A Service.</p>
8<span id="version_switcher"></span>
8<br/>9<br/>
9<br/>10<br/>
10{% endblock %}11{% endblock %}
@@ -13,7 +14,12 @@
13<footer class="global clearfix">14<footer class="global clearfix">
14 <div class="legal clearfix">15 <div class="legal clearfix">
15 <p>&copy; Copyright {{ copyright }}. Ubuntu and Canonical are registered trademarks of16 <p>&copy; Copyright {{ copyright }}. Ubuntu and Canonical are registered trademarks of
16 <a href="http://canonical.com">Canonical Ltd</a></p>17 <a href="http://canonical.com">Canonical Ltd</a>.
18 </p>
19 <p>
20 Revision {{ bzr_last_revision_number}} ({{ bzr_last_revision_date }}).
21 Documentation generation date: {{ bzr_build_date }}.
22 </p>
17 </div>23 </div>
18</footer>24</footer>
19{%- endblock %}25{%- endblock %}
2026
=== modified file 'docs/_templates/maas/relations.html'
--- docs/_templates/maas/relations.html 2014-04-14 07:56:25 +0000
+++ docs/_templates/maas/relations.html 2014-04-14 07:56:25 +0000
@@ -1,3 +1,15 @@
1<script type="text/javascript">
2$(document).ready(function () {
3 if ({{ add_version_switcher }}) {
4 $.ajaxSetup({cache: true});
5 $.getScript('{{ versions_json_path }}', function() {
6 console.log( "Versions script loaded." );
7 set_up_version_switcher('#version_switcher', '{{ doc_prefix }}');
8 });
9}
10});
11</script>
12
1<h3>Related Topics</h3>13<h3>Related Topics</h3>
2<ul>14<ul>
3 <li><a href="{{ pathto(master_doc) }}">Documentation overview</a><ul>15 <li><a href="{{ pathto(master_doc) }}">Documentation overview</a><ul>
416
=== modified file 'docs/conf.py'
--- docs/conf.py 2014-04-14 07:56:25 +0000
+++ docs/conf.py 2014-04-14 07:56:25 +0000
@@ -23,6 +23,23 @@
2323
24# -- General configuration -----------------------------------------------------24# -- General configuration -----------------------------------------------------
2525
26# Add a widget to switch between different versions of the documentation to
27# each generated page.
28add_version_switcher = False
29
30# In order for the version widget to be able to redirect correctly to the
31# other versions of the documentation, each version of the documentation
32# has to be accessible at the following addresses:
33# /<doc_prefix>/ -> documentation for trunk.
34# /<doc_prefix>1.4/ -> documentation for 1.4.
35# etc.
36doc_prefix = 'docs'
37
38# Path of the JSON document, relative to homepage of the documentation for trunk
39# (i.e. '/<doc_prefix>/'), with the list of the versions to include in the
40# version switcher widget.
41versions_path = '_static/versions.js'
42
26# If your documentation needs a minimal Sphinx version, state it here.43# If your documentation needs a minimal Sphinx version, state it here.
27#needs_sphinx = '1.0'44#needs_sphinx = '1.0'
2845
@@ -58,9 +75,9 @@
58# built documents.75# built documents.
59#76#
60# The short X.Y version.77# The short X.Y version.
61version = '12.10'78version = '1.3'
62# The full version, including alpha/beta/rc tags.79# The full version, including alpha/beta/rc tags.
63release = '12.10b'80release = '1.3'
6481
65# The language for content autogenerated by Sphinx. Refer to documentation82# The language for content autogenerated by Sphinx. Refer to documentation
66# for a list of supported languages.83# for a list of supported languages.
@@ -240,3 +257,20 @@
240257
241# Example configuration for intersphinx: refer to the Python standard library.258# Example configuration for intersphinx: refer to the Python standard library.
242intersphinx_mapping = {'http://docs.python.org/': None}259intersphinx_mapping = {'http://docs.python.org/': None}
260
261# Gather information about the branch and the build date.
262from subprocess import check_output
263bzr_last_revision_number = check_output(['bzr', 'revno'])
264bzr_last_revision_date = check_output(['bzr', 'version-info', '--template={date}', '--custom'])
265bzr_build_date = check_output(['bzr', 'version-info', '--template={build_date}', '--custom'])
266
267# Populate html_context with the variables used in the templates.
268html_context = {
269 'add_version_switcher': 'true' if add_version_switcher else 'false',
270 'versions_json_path': '/'.join(['', doc_prefix, versions_path]),
271 'doc_prefix': doc_prefix,
272 'bzr_last_revision_date': bzr_last_revision_date,
273 'bzr_last_revision_number': bzr_last_revision_number,
274 'bzr_build_date': bzr_build_date,
275}
276

Subscribers

People subscribed via source and target branches