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

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

Issue 22854025: Use the externally_connectable schema from manifest_types.json to generate its (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: cleanup Created 7 years, 4 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
Index: chrome/common/extensions/docs/server2/api_data_source.py
diff --git a/chrome/common/extensions/docs/server2/api_data_source.py b/chrome/common/extensions/docs/server2/api_data_source.py
index fcc39c1695c61f20a9924f812390e877d87bb996..eec18e6b1ce24c81d217faf7e2c5e9131479ec2e 100644
--- a/chrome/common/extensions/docs/server2/api_data_source.py
+++ b/chrome/common/extensions/docs/server2/api_data_source.py
@@ -165,15 +165,23 @@ class _JSCModel(object):
def ToDict(self):
if self._namespace is None:
return {}
- return {
+ as_dict = {
'name': self._namespace.name,
'types': self._GenerateTypes(self._namespace.types.values()),
'functions': self._GenerateFunctions(self._namespace.functions),
'events': self._GenerateEvents(self._namespace.events),
'properties': self._GenerateProperties(self._namespace.properties),
- 'intro_list': self._GetIntroTableList(),
- 'channel_warning': self._GetChannelWarning()
+ 'introList': self._GetIntroTableList(),
+ 'channelWarning': self._GetChannelWarning(),
+ 'byName': {},
}
+ # Make every type/function/event/property also accessible by name for
+ # rendering specific API entities rather than the whole thing at once, for
+ # example {{apis.manifestTypes.byName.ExternallyConnectable}}.
+ for item_type in ('types', 'functions', 'events', 'properties'):
+ as_dict['byName'].update(
+ (item['name'], item) for item in as_dict[item_type])
+ return as_dict
def _GetIntroTableList(self):
"""Create a generic data structure that can be traversed by the templates

Powered by Google App Engine
This is Rietveld 408576698