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

login
register
mail settings
Submitter Simon Heimberg
Date Nov. 5, 2013, 8:06 a.m.
Message ID <0459044d01ca779b9f6c.1383638793@lapsi.heimberg.home>
Download mbox | patch
Permalink /patch/2856/
State Accepted
Commit 03ec85b9cfc4e0474c230c810278593101ea367d
Headers show

Comments

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

Patch

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