mercurial/minirst.py
changeset 31146 50a49ead4db4
parent 31145 6582b3716ae0
child 31147 bbdd712e9adb
--- a/mercurial/minirst.py	Wed Feb 15 16:42:17 2017 -0800
+++ b/mercurial/minirst.py	Wed Feb 15 11:47:14 2017 -0800
@@ -411,18 +411,31 @@
             i += 1
     return blocks
 
-_admonitionre = re.compile(r"\.\. (admonition|attention|caution|danger|"
-                           r"error|hint|important|note|tip|warning)::",
-                           flags=re.IGNORECASE)
+
+_admonitions = set([
+    'admonition',
+    'attention',
+    'caution',
+    'danger',
+    'error',
+    'hint',
+    'important',
+    'note',
+    'tip',
+    'warning',
+])
 
 def findadmonitions(blocks):
     """
     Makes the type of the block an admonition block if
     the first line is an admonition directive
     """
+    admonitionre = re.compile(r'\.\. (%s)::' % '|'.join(sorted(_admonitions)),
+                              flags=re.IGNORECASE)
+
     i = 0
     while i < len(blocks):
-        m = _admonitionre.match(blocks[i]['lines'][0])
+        m = admonitionre.match(blocks[i]['lines'][0])
         if m:
             blocks[i]['type'] = 'admonition'
             admonitiontitle = blocks[i]['lines'][0][3:m.end() - 2].lower()