diff options
author | binji@chromium.org <binji@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-01-24 18:06:13 +0000 |
---|---|---|
committer | binji@chromium.org <binji@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-01-24 18:06:13 +0000 |
commit | 26420f2967a73fdde68f8cf0b0de71519cc79825 (patch) | |
tree | 2633b9db15b8faabe76c3d759870a659bb1b5170 /native_client_sdk/src | |
parent | 2851d30b8ce81121ae826a764bd00ad073df4753 (diff) | |
download | chromium_src-26420f2967a73fdde68f8cf0b0de71519cc79825.zip chromium_src-26420f2967a73fdde68f8cf0b0de71519cc79825.tar.gz chromium_src-26420f2967a73fdde68f8cf0b0de71519cc79825.tar.bz2 |
[NaCl SDK Docs] Remove table-of-contents from generated pages.
We don't want the TOC at the top of the chromesite pages, but we do for the
devsite pages. The table-of-contents is in the .rst file, but we don't want to
remove it in case we need to generate devsite documentation again. The easy
hack for now is to set the style of the element to "display: none".
Also, remove doc_generated/.buildinfo. This file should not be checked in.
BUG=none
R=sbc@chromium.org
Review URL: https://codereview.chromium.org/146203002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@246928 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'native_client_sdk/src')
-rw-r--r-- | native_client_sdk/src/doc/_sphinxext/chromesite_builder.py | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/native_client_sdk/src/doc/_sphinxext/chromesite_builder.py b/native_client_sdk/src/doc/_sphinxext/chromesite_builder.py index 4b3cac3..5a54369 100644 --- a/native_client_sdk/src/doc/_sphinxext/chromesite_builder.py +++ b/native_client_sdk/src/doc/_sphinxext/chromesite_builder.py @@ -53,6 +53,8 @@ class ChromesiteHTMLTranslator(HTMLTranslator): # direct parent invocation. HTMLTranslator.__init__(self, builder, *args, **kwds) + self.within_toc = False + def visit_bullet_list(self, node): # Use our own class attribute for <ul>. Don't care about compacted lists. self.body.append(self.starttag(node, 'ul', **{'class': 'small-gap'})) @@ -128,6 +130,25 @@ class ChromesiteHTMLTranslator(HTMLTranslator): else: HTMLTranslator.depart_reference(self, node) + def visit_topic(self, node): + if 'contents' in node['classes']: + # TODO(binji): + # Detect a TOC: we want to hide these from chromesite, but still keep + # them in devsite. An easy hack is to add display: none to the element + # here. + # When we remove devsite support, we can remove this hack. + self.within_toc = True + attrs = {'style': 'display: none'} + self.body.append(self.starttag(node, 'div', **attrs)) + else: + HTMLTranslator.visit_topic(self, node) + + def depart_topic(self, node): + if self.within_toc: + self.body.append('\n</div>') + else: + HTMLTranslator.visit_topic(self, node) + def write_colspecs(self): # Override this method from docutils to do nothing. We don't need those # pesky <col width=NN /> tags in our markup. |