Merge lp:~rvb/maas/add-version-switcher-1.5 into lp:maas/1.5

Proposed by Raphaël Badin
Status: Merged
Approved by: Raphaël Badin
Approved revision: no longer in the source branch.
Merged at revision: 2229
Proposed branch: lp:~rvb/maas/add-version-switcher-1.5
Merge into: lp:maas/1.5
Diff against target: 85 lines (+41/-0)
4 files modified
Makefile (+3/-0)
docs/_templates/maas/layout.html (+1/-0)
docs/_templates/maas/relations.html (+12/-0)
docs/conf.py (+25/-0)
To merge this branch: bzr merge lp:~rvb/maas/add-version-switcher-1.5
Reviewer Review Type Date Requested Status
Julian Edwards (community) Approve
Review via email: mp+214422@code.launchpad.net

Commit message

Add the version switcher widget. Add the new `doc-with-versions` make target to generate a version of the documentation that includes the version switcher widget.

Description of the change

This works in conjunction with https://code.launchpad.net/~rvb/maas/multiple-versions-doc-1.6/+merge/214424.

The change to the 1.5 branch should be a one-off. No further modification should be required, even when publishing a new version of the documentation.

If 'add_version_switcher' is set to True, the code in docs/_templates/maas/relations.html dynamically fetches the Javascript file used to generate the version switcher widget from the trunk documentation.

See the result at http://162.213.35.95:8000/docs

To post a comment you must log in.
Revision history for this message
Julian Edwards (julian-edwards) wrote :

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

 review: approve

Nice work Raphers! Just a question and a suggestion:

On 07/04/14 02:32, Raphaël Badin wrote:
> Raphaël Badin has proposed merging
> lp:~rvb/maas/add-version-switcher-1.5 into lp:maas/1.5.
>
> Commit message: Add the version switcher widget. Add the new
> `doc-with-versions` make target to generate a version of the
> documentation that includes the version switcher widget.

Is there a reason to make this conditional?

> This works in conjunction with
> https://code.launchpad.net/~rvb/maas/multiple-versions-doc-1.6/+merge/214424.
>
> The change to the 1.5 branch should be a one-off. No further
> modification should be required, even when publishing a new version
> of the documentation.
>
> If 'add_version_switcher' is set to True, the code in
> docs/_templates/maas/relations.html dynamically fetches the
> Javascript file used to generate the version switcher widget from
> the trunk documentation.
>
> See the result at http://162.213.35.95:8000/docs
>

I think it would look better if you could put the switcher at the top
somewhere so that it's more prominent. Also, its title should be
"Documentation for MAAS version:"

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iEYEARECAAYFAlNCVUAACgkQWhGlTF8G/Hc9CQCdESXPX3wM1L41K9GXftUY5Xiw
0asAn1po0JklTowRClocmJarUHRTm9P8
=yGGO
-----END PGP SIGNATURE-----

review: Approve
Revision history for this message
Raphaël Badin (rvb) wrote :

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> review: approve
>
> Nice work Raphers! Just a question and a suggestion:
>
> On 07/04/14 02:32, Raphaël Badin wrote:
> > Raphaël Badin has proposed merging
> > lp:~rvb/maas/add-version-switcher-1.5 into lp:maas/1.5.
> >
> > Commit message: Add the version switcher widget. Add the new
> > `doc-with-versions` make target to generate a version of the
> > documentation that includes the version switcher widget.
>
> Is there a reason to make this conditional?

Yes, I want to keep a way to generate the documentation *without* the version switcher widget. This is the documentation we will someday package in a maas-doc package.

> I think it would look better if you could put the switcher at the top
> somewhere so that it's more prominent. Also, its title should be
> "Documentation for MAAS version:"

Okay, I'll that.

Revision history for this message
Raphaël Badin (rvb) wrote :

> > I think it would look better if you could put the switcher at the top
> > somewhere so that it's more prominent. Also, its title should be
> > "Documentation for MAAS version:"
>
> Okay, I'll do that.

I moved the widget at the top… but I left the title as is since "Documentation for MAAS version:" really doesn't fit (it takes two lines and it's ugly).

Revision history for this message
Julian Edwards (julian-edwards) wrote :

On 08/04/14 03:37, Raphaël Badin wrote:
>
>>> I think it would look better if you could put the switcher at the top
>>> somewhere so that it's more prominent. Also, its title should be
>>> "Documentation for MAAS version:"
>>
>> Okay, I'll do that.
>
> I moved the widget at the top… but I left the title as is since "Documentation for MAAS version:" really doesn't fit (it takes two lines and it's ugly).
>
>

Please, the title needs to change, make the text smaller if you have to.

"Version" doesn't mean much on its own like that. "Version what?" was
my first thought, especially when I clicked on it it was initially empty
and only loaded later. Maybe its default values should say "loading...".

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'Makefile'
--- Makefile 2014-03-27 04:02:16 +0000
+++ Makefile 2014-04-07 17:12:29 +0000
@@ -164,6 +164,9 @@
164doc: bin/sphinx docs/api.rst164doc: bin/sphinx docs/api.rst
165 bin/sphinx165 bin/sphinx
166166
167doc-with-versions: bin/sphinx
168 cd docs/_build; make SPHINXOPTS="-A add_version_switcher=true" html
169
167man: $(patsubst docs/man/%.rst,man/%,$(wildcard docs/man/*.rst))170man: $(patsubst docs/man/%.rst,man/%,$(wildcard docs/man/*.rst))
168171
169man/%: docs/man/%.rst | bin/sphinx-build172man/%: docs/man/%.rst | bin/sphinx-build
170173
=== modified file 'docs/_templates/maas/layout.html'
--- docs/_templates/maas/layout.html 2013-12-06 15:11:12 +0000
+++ docs/_templates/maas/layout.html 2014-04-07 17:12:29 +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 %}
1112
=== modified file 'docs/_templates/maas/relations.html'
--- docs/_templates/maas/relations.html 2013-12-06 15:11:12 +0000
+++ docs/_templates/maas/relations.html 2014-04-07 17:12:29 +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-03-05 22:17:59 +0000
+++ docs/conf.py 2014-04-07 17:12:29 +0000
@@ -22,6 +22,23 @@
2222
23# -- General configuration -----------------------------------------------------23# -- General configuration -----------------------------------------------------
2424
25# Add a widget to switch between different versions of the documentation to
26# each generated page.
27add_version_switcher = False
28
29# In order for the version widget to be able to redirect correctly to the
30# other versions of the documentation, each version of the documentation
31# has to be accessible at the following addresses:
32# /<doc_prefix>/ -> documentation for trunk.
33# /<doc_prefix>1.4/ -> documentation for 1.4.
34# etc.
35doc_prefix = 'docs'
36
37# Path of the JSON document, relative to homepage of the documentation for trunk
38# (i.e. '/<doc_prefix>/'), with the list of the versions to include in the
39# version switcher widget.
40versions_path = '_static/versions.js'
41
25# If your documentation needs a minimal Sphinx version, state it here.42# If your documentation needs a minimal Sphinx version, state it here.
26#needs_sphinx = '1.0'43#needs_sphinx = '1.0'
2744
@@ -240,3 +257,11 @@
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# Populate html_context with the variables used in the templates.
262html_context = {
263 'add_version_switcher': 'true' if add_version_switcher else 'false',
264 'versions_json_path': '/'.join(['', doc_prefix, versions_path]),
265 'doc_prefix': doc_prefix,
266}
267

Subscribers

People subscribed via source and target branches

to all changes: