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

login
register
mail settings
Submitter Simon Heimberg
Date Nov. 2, 2013, 11:36 a.m.
Message ID <9949d93cb1e4d43dd157.1383392162@lapsi.heimberg.home>
Download mbox | patch
Permalink /patch/2840/
State Superseded, archived
Headers show

Comments

Simon Heimberg - Nov. 2, 2013, 11:36 a.m.
# HG changeset patch
# User Simon Heimberg <simohe@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

Patch

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 * ' '