From 20e4e00af2bcead88a8e34a1611a2b76f93b7296 Mon Sep 17 00:00:00 2001
From: Alexander Kornienko <alexfh@google.com>
Date: Tue, 23 Feb 2016 16:11:55 +0000
Subject: [PATCH] Support language selection for \code blocks.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@261644 91177308-0d34-0410-b5e6-96231b3b80d8
---
 docs/tools/dump_format_style.py | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/docs/tools/dump_format_style.py b/docs/tools/dump_format_style.py
index 42e957044fd..6e149394981 100755
--- a/docs/tools/dump_format_style.py
+++ b/docs/tools/dump_format_style.py
@@ -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'
-- 
GitLab