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

Simon Heimberg simohe at besonet.ch
Tue Nov 5 02:06:35 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 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

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


More information about the Mercurial-devel mailing list