[PATCH 2 of 8] minirst: do not fail on an empty admonition block

Simon Heimberg simohe at besonet.ch
Sat Nov 2 06:36:02 CDT 2013


# HG changeset patch
# User Simon Heimberg <simohe at besonet.ch>
# Date 1383387952 -3600
#      Sat Nov 02 11:25:52 2013 +0100
# Branch stable
# Node ID 9949d93cb1e4d43dd1579ad7b7ee3f73e305ff72
# Parent  b1cb8e807eb0a5b5a53ed4c4c36bf3d91eaeaa6e
minirst: do not fail on an empty admonition block

diff -r b1cb8e807eb0 -r 9949d93cb1e4 mercurial/minirst.py
--- a/mercurial/minirst.py	Sat Nov 02 11:25:52 2013 +0100
+++ b/mercurial/minirst.py	Sat Nov 02 11:25:52 2013 +0100
@@ -453,6 +453,8 @@
     indent = ' ' * block['indent']
     if block['type'] == 'admonition':
         admonition = _admonitiontitles[block['admonitiontitle']]
+        if not block['lines']:
+            return indent + admonition + '\n'
         hang = len(block['lines'][-1]) - len(block['lines'][-1].lstrip())
 
         defindent = indent + hang * ' '


More information about the Mercurial-devel mailing list