Patchwork [4,of,8] minirst: do not add a 2nd empty paragraph

login
register
mail settings
Submitter Simon Heimberg
Date Nov. 2, 2013, 11:36 a.m.
Message ID <59763c10f53c0494f636.1383392164@lapsi.heimberg.home>
Download mbox | patch
Permalink /patch/2842/
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 59763c10f53c0494f6364536001112164ac1b2fc
# Parent  d6c56b64a342cbf3a75e8280e528c842ea570ed9
minirst: do not add a 2nd empty paragraph

This does not add a separating block after a separated note directive.

.. note::

    text

is formatted to

Note:
    text

Patch

diff -r d6c56b64a342 -r 59763c10f53c 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
@@ -381,6 +381,9 @@ 
         if (blocks[i]['type'] == blocks[i - 1]['type'] and
             blocks[i]['type'] in ('bullet', 'option', 'field')):
             i += 1
+        elif not blocks[i - 1]['lines']:
+            # no lines in previous block, do not seperate
+            i += 1
         else:
             blocks.insert(i, dict(lines=[''], indent=0, type='margin'))
             i += 2