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

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

Issue 10854054: Extensions Docs Server: Fix handling of nodocs (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: return samples Created 8 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/converter.py
diff --git a/chrome/common/extensions/docs/server2/converter.py b/chrome/common/extensions/docs/server2/converter.py
index 07f799aaf41f081a509f2ac476d930194a2b13cc..2320663b7d18038141076d71e0cc554be4f8d76a 100755
--- a/chrome/common/extensions/docs/server2/converter.py
+++ b/chrome/common/extensions/docs/server2/converter.py
@@ -30,9 +30,7 @@ IGNORED_FILES = [
'experimental',
'samples',
'index',
- # These are APIs that should not have docs.
- 'test',
- 'experimental_idltest',
+ 'devtools', # Has an intro, but marked as nodoc.
]
# These are mappings for APIs that have no intros. They are needed because the
@@ -186,6 +184,22 @@ def _FormatFile(contents, path, name, image_dest, replace, is_api):
contents = ('<h1 class="page_title">%s</h1>' % title) + contents
return contents
+def _GetNoDocs(api_dir, api_files):
+ exclude = []
+ for api in api_files:
+ try:
+ with open(os.path.join(api_dir, api), 'r') as f:
+ if os.path.splitext(api)[-1] == '.idl':
+ if '[nodoc] namespace' in f.read():
+ exclude.append(_UnixName(api))
+ else:
+ api_json = json.loads(json_comment_eater.Nom(f.read()))
+ if api_json[0].get('nodoc', False):
+ exclude.append(_UnixName(api))
+ except Exception:
+ pass
+ return exclude
+
def _ProcessName(name):
processed_name = []
if name.startswith('experimental_'):
@@ -216,6 +230,7 @@ def _MoveAllFiles(source_dir,
original_files.extend(files)
if replace:
_CleanAPIs(source_dir, api_dir, intros_dest, template_dest, exclude_files)
+ exclude_files.extend(_GetNoDocs(api_dir, api_files))
files = set(os.listdir(source_dir))
unix_files = [_UnixName(f) for f in files]
for name in [SanitizeAPIName(f) for f in _ListAllAPIs(api_dir)]:

Powered by Google App Engine
This is Rietveld 408576698