diff options
author | Krasimir Georgiev <krasimir@google.com> | 2017-06-23 11:29:40 +0000 |
---|---|---|
committer | Krasimir Georgiev <krasimir@google.com> | 2017-06-23 11:29:40 +0000 |
commit | 90b4ce38cb30c5ceaf8695abf7186ed81dfc6d39 (patch) | |
tree | 44d9f3c9015a22a579195cee890583b31147b5e8 /clang/docs/tools/dump_format_style.py | |
parent | 5d3d716815d7ee98d9020dc1e2a46846b633e1b7 (diff) | |
download | bcm5719-llvm-90b4ce38cb30c5ceaf8695abf7186ed81dfc6d39.tar.gz bcm5719-llvm-90b4ce38cb30c5ceaf8695abf7186ed81dfc6d39.zip |
[clang-format] Update dump_format_style.py to indent nested fields
Summary:
This updates the format options documentation script to indent the
documentation of nested fields. The previous format caused some problems,
as when a bulleted list ends with a multiline comment. See the buildbot failure
http://lab.llvm.org:8011/builders/clang-sphinx-docs/builds/10020/steps/docs-clang-html/logs/stdio
Reviewers: djasper
Reviewed By: djasper
Subscribers: cfe-commits
Differential Revision: https://reviews.llvm.org/D34552
llvm-svn: 306093
Diffstat (limited to 'clang/docs/tools/dump_format_style.py')
-rwxr-xr-x | clang/docs/tools/dump_format_style.py | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/clang/docs/tools/dump_format_style.py b/clang/docs/tools/dump_format_style.py index 81a5af6ef42..e2571f46448 100755 --- a/clang/docs/tools/dump_format_style.py +++ b/clang/docs/tools/dump_format_style.py @@ -24,10 +24,10 @@ def doxygen2rst(text): text = re.sub(r'\\\w+ ', '', text) return text -def indent(text, columns): +def indent(text, columns, indent_first_line=True): indent = ' ' * columns s = re.sub(r'\n([^\n])', '\n' + indent + '\\1', text, flags=re.S) - if s.startswith('\n'): + if not indent_first_line or s.startswith('\n'): return s return indent + s @@ -64,7 +64,9 @@ class NestedField: self.comment = comment.strip() def __str__(self): - return '\n* ``%s`` %s' % (self.name, doxygen2rst(self.comment)) + return '\n* ``%s`` %s' % ( + self.name, + doxygen2rst(indent(self.comment, 2, indent_first_line=False))) class Enum: def __init__(self, name, comment): @@ -179,7 +181,7 @@ def read_options(header): if enums.has_key(option.type): option.enum = enums[option.type] elif nested_structs.has_key(option.type): - option.nested_struct = nested_structs[option.type]; + option.nested_struct = nested_structs[option.type] else: raise Exception('Unknown type: %s' % option.type) return options @@ -195,4 +197,3 @@ contents = substitute(contents, 'FORMAT_STYLE_OPTIONS', options_text) with open(DOC_FILE, 'wb') as output: output.write(contents) - |