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

Unified Diff: tools/json_schema_compiler/idl_schema.py

Issue 12996003: Dynamically generate a heading for Extension Docs API pages (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressing comments - Patch currently being broken up Created 7 years, 6 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: tools/json_schema_compiler/idl_schema.py
diff --git a/tools/json_schema_compiler/idl_schema.py b/tools/json_schema_compiler/idl_schema.py
index 519ae56e5a8b819b99e06d347f9bc94c347e77aa..bedc2b347bfc4db84ad17a6d6aa6cee5da5163b8 100644
--- a/tools/json_schema_compiler/idl_schema.py
+++ b/tools/json_schema_compiler/idl_schema.py
@@ -309,7 +309,8 @@ class Namespace(object):
dictionary that the JSON schema compiler expects to see.
'''
- def __init__(self, namespace_node, nodoc=False, internal=False):
+ def __init__(self, namespace_node, nodoc=False, internal=False,
+ description=None):
self.namespace = namespace_node
self.nodoc = nodoc
self.internal = internal
@@ -317,6 +318,7 @@ class Namespace(object):
self.functions = []
self.types = []
self.callbacks = OrderedDict()
+ self.description = description
def process(self):
for node in self.namespace.children:
@@ -334,6 +336,7 @@ class Namespace(object):
else:
sys.exit('Did not process %s %s' % (node.cls, node))
return {'namespace': self.namespace.GetName(),
+ 'description': self.description,
'nodoc': self.nodoc,
'types': self.types,
'functions': self.functions,
@@ -361,16 +364,19 @@ class IDLSchema(object):
namespaces = []
nodoc = False
internal = False
+ description = None
for node in self.idl:
if node.cls == 'Namespace':
- namespace = Namespace(node, nodoc, internal)
+ namespace = Namespace(node, nodoc, internal, description)
namespaces.append(namespace.process())
nodoc = False
internal = False
elif node.cls == 'Copyright':
continue
elif node.cls == 'Comment':
- continue
+ description = node.GetName()
+ if description == '':
+ description = None
elif node.cls == 'ExtAttribute':
if node.name == 'nodoc':
nodoc = bool(node.value)
« no previous file with comments | « chrome/common/extensions/docs/templates/public/extensions/webstore.html ('k') | tools/json_schema_compiler/model.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698