From 08a12ca6016c34d9476d2e93bd0f2dc9ae60abc5 Mon Sep 17 00:00:00 2001 From: Mark Daoust Date: Wed, 11 Apr 2018 09:50:40 -0700 Subject: [PATCH] Add a clear error message for when a doc does not have a title. PiperOrigin-RevId: 192463583 --- tensorflow/tools/docs/generate_lib.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tensorflow/tools/docs/generate_lib.py b/tensorflow/tools/docs/generate_lib.py index 34dd419..9cc261d 100644 --- a/tensorflow/tools/docs/generate_lib.py +++ b/tensorflow/tools/docs/generate_lib.py @@ -308,6 +308,10 @@ def build_doc_index(src_dir): continue title_parser = _GetMarkdownTitle() title_parser.process(os.path.join(dirpath, base_name)) + if title_parser.title is None: + msg = ('`{}` has no markdown title (# title)'.format( + os.path.join(dirpath, base_name))) + raise ValueError(msg) key_parts = os.path.join(suffix, base_name[:-3]).split('/') if key_parts[-1] == 'index': key_parts = key_parts[:-1] -- 2.7.4