Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1780)

Unified Diff: native_client_sdk/src/doc/_sphinxext/chromesite_builder.py

Issue 146203002: [NaCl SDK Docs] Remove table-of-contents from generated pages. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: add .gitignore for .buildinfo Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « native_client_sdk/doc_generated/rest-devsite-examples.html ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: native_client_sdk/src/doc/_sphinxext/chromesite_builder.py
diff --git a/native_client_sdk/src/doc/_sphinxext/chromesite_builder.py b/native_client_sdk/src/doc/_sphinxext/chromesite_builder.py
index 4b3cac3bb712c605695ce118a6c0416cdbc09477..5a5436958d11f96f92ad51ae828b5505ffb8c009 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.
« no previous file with comments | « native_client_sdk/doc_generated/rest-devsite-examples.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698