minirst: convert ``foo`` into "foo" upon display
authorMartin Geisler <mg@lazybytes.net>
Tue, 20 Oct 2009 22:16:27 +0200
changeset 9623 32727ce029de
parent 9622 9d1a480ca6ea
child 9624 585d2ffe969b
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.
mercurial/minirst.py
--- 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)