diff options
| author | Dimitry Andric <dim@FreeBSD.org> | 2016-07-23 20:44:14 +0000 |
|---|---|---|
| committer | Dimitry Andric <dim@FreeBSD.org> | 2016-07-23 20:44:14 +0000 |
| commit | 2b6b257f4e5503a7a2675bdb8735693db769f75c (patch) | |
| tree | e85e046ae7003fe3bcc8b5454cd0fa3f7407b470 /docs/tools/dump_format_style.py | |
| parent | b4348ed0b7e90c0831b925fbee00b5f179a99796 (diff) | |
Notes
Diffstat (limited to 'docs/tools/dump_format_style.py')
| -rw-r--r-- | docs/tools/dump_format_style.py | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/docs/tools/dump_format_style.py b/docs/tools/dump_format_style.py index b61d2017d05f..6e1493949815 100644 --- a/docs/tools/dump_format_style.py +++ b/docs/tools/dump_format_style.py @@ -4,11 +4,13 @@ # Run from the directory in which this file is located to update the docs. import collections +import os import re import urllib2 -FORMAT_STYLE_FILE = '../../include/clang/Format/Format.h' -DOC_FILE = '../ClangFormatStyleOptions.rst' +CLANG_DIR = os.path.join(os.path.dirname(__file__), '../..') +FORMAT_STYLE_FILE = os.path.join(CLANG_DIR, 'include/clang/Format/Format.h') +DOC_FILE = os.path.join(CLANG_DIR, 'docs/ClangFormatStyleOptions.rst') def substitute(text, tag, contents): @@ -77,7 +79,7 @@ class Enum: class EnumValue: def __init__(self, name, comment): self.name = name - self.comment = comment.strip() + self.comment = comment def __str__(self): return '* ``%s`` (in configuration: ``%s``)\n%s' % ( @@ -86,8 +88,12 @@ class EnumValue: doxygen2rst(indent(self.comment, 2))) def clean_comment_line(line): - if line == '/// \\code': - return '\n.. code-block:: c++\n\n' + match = re.match(r'^/// \\code(\{.(\w+)\})?$', line) + if match: + lang = match.groups()[1] + if not lang: + lang = 'c++' + return '\n.. code-block:: %s\n\n' % lang if line == '/// \\endcode': return '' return line[4:] + '\n' |
