From f302c123ea8d0b989fe6aa6517e26783f69d62b1 Mon Sep 17 00:00:00 2001 From: Xavier Morel Date: Mon, 17 Nov 2014 14:07:36 +0100 Subject: [PATCH] [IMP] doc: indexify index * opt-in toc navification * unhide index toctree, it's now back to a list of documents * remove text thing --- doc/_themes/odoodoc/layout.html | 5 +-- doc/_themes/odoodoc/sphinx_monkeypatch.py | 39 +++++++++------------- doc/images/view-on-github.png | Bin 1493 -> 0 bytes doc/index.rst | 28 ++-------------- doc/reference/cmdline.rst | 2 +- 5 files changed, 22 insertions(+), 52 deletions(-) delete mode 100644 doc/images/view-on-github.png diff --git a/doc/_themes/odoodoc/layout.html b/doc/_themes/odoodoc/layout.html index 7685d8af25f..1a68d31814a 100644 --- a/doc/_themes/odoodoc/layout.html +++ b/doc/_themes/odoodoc/layout.html @@ -32,7 +32,7 @@
{{ toctree(maxdepth=4, collapse=False, includehidden=True, - main_navbar=False, titles_only=False) }} + navbar='side', titles_only=False) }} {% if github_link %}

Edit on GitHub @@ -72,7 +72,8 @@ {% endif %}

diff --git a/doc/_themes/odoodoc/sphinx_monkeypatch.py b/doc/_themes/odoodoc/sphinx_monkeypatch.py index 13c3a305988..94e063e1f44 100644 --- a/doc/_themes/odoodoc/sphinx_monkeypatch.py +++ b/doc/_themes/odoodoc/sphinx_monkeypatch.py @@ -1,7 +1,6 @@ # -*- coding: utf-8 -*- import sphinx.roles import sphinx.environment -from sphinx.builders.html import StandaloneHTMLBuilder from sphinx.writers.html import HTMLTranslator from docutils.writers.html4css1 import HTMLTranslator as DocutilsTranslator @@ -9,27 +8,17 @@ def patch(): # navify toctree (oh god) @monkey(sphinx.environment.BuildEnvironment) def resolve_toctree(old_resolve, self, *args, **kwargs): - """ If main_navbar, bootstrapify TOC to yield a navbar + """ If navbar, bootstrapify TOC to yield a navbar """ - main_navbar = kwargs.pop('main_navbar', False) + navbar = kwargs.pop('navbar', None) toc = old_resolve(self, *args, **kwargs) if toc is None: return None - navbarify(toc[0], main_navbar=main_navbar) + navbarify(toc[0], navbar=navbar) return toc - @monkey(StandaloneHTMLBuilder) - def _get_local_toctree(old_local, self, *args, **kwargs): - """ _get_local_toctree generates a documentation toctree for the local - document (?), called from handle_page - """ - # so can call toctree(main_navbar=False) - d = {'main_navbar': True} - d.update(kwargs) - return old_local(self, *args, **d) - # monkeypatch visit_table to remove border and add .table HTMLTranslator.visit_table = visit_table # disable colspec crap @@ -37,11 +26,18 @@ def patch(): # copy data- attributes straight from source to dest HTMLTranslator.starttag = starttag_data -def navbarify(node, main_navbar=False): - # add classes to toplevel - if not main_navbar: - navify([node]) - else: +def navbarify(node, navbar=None): + """ + :param node: toctree node to navbarify + :param navbar: Whether this toctree is a 'main' navbar, a 'side' navbar or + not a navbar at all + """ + if navbar == 'side': + for n in node.traverse(): + if n.tagname == 'bullet_list': + n['classes'].append('nav') + elif navbar == 'main': + # add classes to just toplevel node['classes'].extend(['nav', 'navbar-nav', 'navbar-right']) for list_item in node.children: # bullet_list @@ -59,11 +55,6 @@ def navbarify(node, main_navbar=False): link.attributes['data-toggle'] = 'dropdown' # list_item.bullet_list list_item.children[1]['classes'].append('dropdown-menu') -def navify(nodes): - for node in nodes: - if node.tagname == 'bullet_list': - node['classes'].append('nav') - navify(node.children) def visit_table(self, node): """ diff --git a/doc/images/view-on-github.png b/doc/images/view-on-github.png deleted file mode 100644 index 65a8d42363de1b3414c175ca606491f74ca30b8d..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1493 zcmV;`1uFW9P)E#qEfixqm!?j-ouZ!$83qFc*e1Co|>7NnwzQk`TD7yny9|uov6m$z^3-( z#K__Iy1cyW)VbjF{p;)M|Nr#t`~Shv^3>1S!>5`3_uS*z-_*CuexokL000FrNklGt*M7|qa1qmX; zfv`lt&pTRl2+O>qI9X3j0%nsOgvY`PGZ!aenPd2I1(3Bm@PfN2>Mt-M%ud=4WsGz( z*d1^{?reEV4mkk@(h|MqV|W#UYz0yr^3B-TXc5KvT?&Ged?@M4w6cK;T-peq;LU-M zy1RLYw=(Aj^w{BVwNE-y@l2MZ_fM%#mR;LtWzp$O zMc8(%Y`dK;3LhcMGb;sQ;t%;wa8%IEk}GeH9gy4;-dxzciTY7O0i>D3G4yN#LBZ|w zMw%yUYW{pvxyH{_LZ0op`dzO$WE*dwH`CD2(9qD((9qD(&{0ZR&T!HE^IFdzDU)_5 z%+}I$UCVmQDRqKQ=qe!Xf6QEeo_0l0(l|T0jLANyOZQ;&oFaU(Ij*m#_I*W|DiB_5 z^K^B|-inRWA7!f!@Yc++PggktNzRjvDd{9T!lFhu&YZcZZq;i-Gg{}FMd%ZkFS8*l zVXM$DYly}*eMtyptB`Vzm$9mu$TS-WHumWGCxPcG*TQt0}8?`<*lK( z|3OwQ15J$TpMG}UA~}TQc+Kr*jttkR8G9WMrP}cHJ_I8KysI-028eR2RKMn2mKaVlRDXUj47Y|N)dN} zkye@5clbEAS}e`=rhIAZRX4{rkg&})mH=&l;)#Ydniq^_g@w1|9G8=M!Pu2X*pbhfEY vZE91S+VojRf1BDg8jVJy(P%UpjYjhemMMbnS8-)|00000NkvXXu0mjfAWiiM diff --git a/doc/index.rst b/doc/index.rst index 3c1696020d6..0cd25cdd904 100644 --- a/doc/index.rst +++ b/doc/index.rst @@ -4,34 +4,12 @@ odoo developer documentation Welcome to the Odoo developer documentation. -This documentation is incomplete and may contain errors, if you wish to -contribute, every page should have a :guilabel:`View on Github` link: - -.. image:: images/view-on-github.* - :align: center - -Through this link you can edit documents and submit changes for review using -`github's web interface -`_. -Contributions are welcome and appreciated. - .. todo:: what's the documentation's license? -The documentation is currently organized in four sections: - -* :doc:`tutorials`, aimed at introducing the primary areas of developing Odoo - modules -* :doc:`reference`, which ought be the complete and canonical documentation - for Odoo subsystems -* :doc:`modules`, documenting useful specialized modules and integration - methods (and currently empty) - -.. hidden toctree w/o titlesonly otherwise the titlesonly "sticks" to - in-document toctrees and we can't have a toctree showing both "sibling" - pages and current document sections - +.. titlesonly breaks level 3 (~in-document) toc of left navbar, so use + maxdepth instead .. toctree:: - :hidden: + :maxdepth: 2 tutorials reference diff --git a/doc/reference/cmdline.rst b/doc/reference/cmdline.rst index 32c1ef48729..1ec7d96ae9d 100644 --- a/doc/reference/cmdline.rst +++ b/doc/reference/cmdline.rst @@ -71,7 +71,7 @@ Scaffolding is available via the :command:`odoo.py scaffold` subcommand. .. option:: -t