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

Unified Diff: chrome/common/extensions/docs/server2/table_of_contents_renderer.py

Issue 103413002: Docserver: Include <h4> tags in the table of contents, it's needed for the API (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years 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
Index: chrome/common/extensions/docs/server2/table_of_contents_renderer.py
diff --git a/chrome/common/extensions/docs/server2/table_of_contents_renderer.py b/chrome/common/extensions/docs/server2/table_of_contents_renderer.py
index 38580f09173c381c2aabf9731cc0ae48b482a5ac..1d6f3bb5c10963e73ebae9c803b76b8d305cd724 100644
--- a/chrome/common/extensions/docs/server2/table_of_contents_renderer.py
+++ b/chrome/common/extensions/docs/server2/table_of_contents_renderer.py
@@ -14,8 +14,12 @@ class TableOfContentsRenderer(object):
class for testability.
'''
- def __init__(self, host_file_system, compiled_fs_factory):
+ def __init__(self,
+ host_file_system,
+ compiled_fs_factory,
+ template_renderer):
self._templates = compiled_fs_factory.ForTemplates(host_file_system)
+ self._template_renderer = template_renderer
def Render(self, sections):
'''Renders a list of DocumentSections |sections| and returns a tuple
@@ -43,7 +47,9 @@ class TableOfContentsRenderer(object):
items_for_section[0]['separator'] = True
toc_items.extend(items_for_section)
- table_of_contents = table_of_contents_template.Render({
- 'items': toc_items
- })
- return table_of_contents.text, table_of_contents.errors
+ return self._template_renderer.Render(
+ self._templates.GetFromFile(
+ '%s/table_of_contents.html' % PRIVATE_TEMPLATES).Get(),
+ None, # no request
+ data_sources=('partials'),
+ additional_context={'items': toc_items})
« no previous file with comments | « chrome/common/extensions/docs/server2/server_instance.py ('k') | chrome/common/extensions/docs/server2/template_renderer.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698