Index: chrome/common/extensions/docs/server2/schema_util.py |
diff --git a/chrome/common/extensions/docs/server2/schema_util.py b/chrome/common/extensions/docs/server2/schema_util.py |
index 866591d60002739087a5b2d2d2b16928ec90ca79..0cd59cd4a969d3c4f8156aca42a52c4056160419 100644 |
--- a/chrome/common/extensions/docs/server2/schema_util.py |
+++ b/chrome/common/extensions/docs/server2/schema_util.py |
@@ -54,8 +54,9 @@ def DetectInlineableTypes(schema): |
type_['inline_doc'] = True |
-def InlineDocs(schema): |
+def InlineDocs(schema, remove_nodes): |
'''Replace '$ref's that refer to inline_docs with the json for those docs. |
+ If |remove_nodes| is true, then the inlined nodes are removed from the schema. |
''' |
types = schema.get('types') |
if types is None: |
@@ -68,11 +69,13 @@ def InlineDocs(schema): |
for type_ in types: |
if type_.get('inline_doc'): |
inline_docs[type_['id']] = type_ |
- for k in ('description', 'id', 'inline_doc'): |
- type_.pop(k, None) |
+ if remove_nodes: |
+ for k in ('description', 'id', 'inline_doc'): |
+ type_.pop(k, None) |
else: |
types_without_inline_doc.append(type_) |
- schema['types'] = types_without_inline_doc |
+ if remove_nodes: |
+ schema['types'] = types_without_inline_doc |
def apply_inline(node): |
if isinstance(node, list): |
@@ -89,10 +92,10 @@ def InlineDocs(schema): |
apply_inline(schema) |
-def ProcessSchema(path, file_data, inline=False): |
+def ProcessSchema(path, file_data, full_inline=False): |
not at google - send to devlin
2014/07/15 21:12:04
can you make this actually be explicit? "full_inli
not at google - send to devlin
2014/07/15 22:43:20
I would prefer retain_inlined_nodes actually (reve
ahernandez
2014/07/15 22:49:51
I believe this line: https://code.google.com/p/chr
|
'''Parses |file_data| using a method determined by checking the extension of |
- the file at the given |path|. Then, trims 'nodoc' and if |inline| is given |
- and True, handles inlineable types from the parsed schema data. |
+ the file at the given |path|. Then, trims 'nodoc' and if |full_inline| is |
+ given and True, removes inlineable types from the parsed schema data. |
''' |
def trim_and_inline(schema, is_idl=False): |
'''Modifies an API schema in place by removing nodes that shouldn't be |
@@ -102,10 +105,9 @@ def ProcessSchema(path, file_data, inline=False): |
# A return of True signifies that the entire schema should not be |
# documented. Otherwise, only nodes that request 'nodoc' are removed. |
return None |
- if inline: |
- if is_idl: |
- DetectInlineableTypes(schema) |
- InlineDocs(schema) |
+ if is_idl: |
+ DetectInlineableTypes(schema) |
+ InlineDocs(schema, full_inline) |
return schema |
if path.endswith('.idl'): |