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

login
register
mail settings
Submitter Simon Heimberg
Date Nov. 5, 2013, 8:06 a.m.
Message ID <b3e86f657b1445828666.1383638795@lapsi.heimberg.home>
Download mbox | patch
Permalink /patch/2850/
State Accepted
Commit 0f6e360b14f2dcc28c215949dea28badfbb0c96b
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 b3e86f657b1445828666bff219d2f1c55ae91ef9
# Parent  396da61610f78a8374a58550cc0f00878133fa9d
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 396da61610f7 -r b3e86f657b14 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
@@ -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