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

Simon Heimberg simohe at besonet.ch
Tue Nov 5 02:06:33 CST 2013


# HG changeset patch
# User Simon Heimberg <simohe at besonet.ch>
# Date 1383556986 -3600
#      Mon Nov 04 10:23:06 2013 +0100
# Branch stable
# Node ID 0459044d01ca779b9f6ced6857bc9ec07538540b
# Parent  a9c6dcbbf60245a7b95dd880d908e25620e5a446
minirst: do not fail on an empty admonition block

diff -r a9c6dcbbf602 -r 0459044d01ca mercurial/minirst.py
--- a/mercurial/minirst.py	Mon Nov 04 10:23:06 2013 +0100
+++ b/mercurial/minirst.py	Mon Nov 04 10:23:06 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