changeset 9623:32727ce029de

minirst: convert ``foo`` into "foo" upon display This lets us markup many more occurances of inline literals since they no longer look strange in the terminal output.
author Martin Geisler <mg@lazybytes.net>
date Tue, 20 Oct 2009 22:16:27 +0200
parents 9d1a480ca6ea
children 585d2ffe969b
files mercurial/minirst.py
diffstat 1 files changed, 8 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/minirst.py	Tue Oct 20 22:42:49 2009 +0200
+++ b/mercurial/minirst.py	Tue Oct 20 22:16:27 2009 +0200
@@ -260,6 +260,13 @@
     return blocks
 
 
+def inlineliterals(blocks):
+    for b in blocks:
+        if b['type'] == 'paragraph':
+            b['lines'] = [l.replace('``', '"') for l in b['lines']]
+    return blocks
+
+
 def addmargins(blocks):
     """Adds empty blocks for vertical spacing.
 
@@ -316,6 +323,7 @@
     for b in blocks:
         b['indent'] += indent
     blocks = findliteralblocks(blocks)
+    blocks = inlineliterals(blocks)
     blocks = findsections(blocks)
     blocks = findbulletlists(blocks)
     blocks = findoptionlists(blocks)