r261644 - Support language selection for \code blocks.
Alexander Kornienko via cfe-commits
cfe-commits at lists.llvm.org
Tue Feb 23 08:11:57 PST 2016
Author: alexfh
Date: Tue Feb 23 10:11:55 2016
New Revision: 261644
URL: http://llvm.org/viewvc/llvm-project?rev=261644&view=rev
Log:
Support language selection for \code blocks.
Modified:
cfe/trunk/docs/tools/dump_format_style.py
Modified: cfe/trunk/docs/tools/dump_format_style.py
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/tools/dump_format_style.py?rev=261644&r1=261643&r2=261644&view=diff
==============================================================================
--- cfe/trunk/docs/tools/dump_format_style.py (original)
+++ cfe/trunk/docs/tools/dump_format_style.py Tue Feb 23 10:11:55 2016
@@ -79,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' % (
@@ -88,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'
More information about the cfe-commits
mailing list