]> granicus.if.org Git - clang/commitdiff
Support language selection for \code blocks.
authorAlexander Kornienko <alexfh@google.com>
Tue, 23 Feb 2016 16:11:55 +0000 (16:11 +0000)
committerAlexander Kornienko <alexfh@google.com>
Tue, 23 Feb 2016 16:11:55 +0000 (16:11 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@261644 91177308-0d34-0410-b5e6-96231b3b80d8

docs/tools/dump_format_style.py

index 42e957044fd2b0015658351f1b25e3b19d152ad8..6e149394981553879f5e325fe7cf467d88573c7f 100755 (executable)
@@ -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'