[PATCH 1 of 2] rst: in @mention parser, escape spaces so they don't go to HTML

Andrew Shadura andrew at shadura.me
Tue May 5 11:39:19 EDT 2015


# HG changeset patch
# User Andrew Shadura <andrew at shadura.me>
# Date 1430840290 -7200
#      Tue May 05 17:38:10 2015 +0200
# Node ID 4a68442ad0a1898c08ea4a249b032bb73cd8c90e
# Parent  7dca6303d91ddb98bcc62f085d5342609a4d40b2
rst: in @mention parser, escape spaces so they don't go to HTML

This eliminates extra spaces around @mentions.
See http://docutils.sf.net/docs/ref/rst/restructuredtext.html#character-level-inline-markup

diff --git a/kallithea/lib/markup_renderer.py b/kallithea/lib/markup_renderer.py
--- a/kallithea/lib/markup_renderer.py
+++ b/kallithea/lib/markup_renderer.py
@@ -193,6 +193,6 @@ class MarkupRenderer(object):
 
         def wrapp(match_obj):
             uname = match_obj.groups()[0]
-            return ' **@%(uname)s** ' % {'uname': uname}
+            return '\ **@%(uname)s**\ ' % {'uname': uname}
         mention_hl = mention_pat.sub(wrapp, source).strip()
         return cls.rst(mention_hl)


More information about the kallithea-general mailing list