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

Mads Kiilerich mads at kiilerich.com
Tue May 5 19:57:31 EDT 2015


On 05/05/2015 05:39 PM, Andrew Shadura wrote:
> # 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

I don't think I have seen this - can you point at a "before" example? 
Perhaps also describe it in the commit message.

What was the problem - why were the spaces needed yet not needed anyway?

/Mads

> 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)
> _______________________________________________
> kallithea-general mailing list
> kallithea-general at sfconservancy.org
> http://lists.sfconservancy.org/mailman/listinfo/kallithea-general



More information about the kallithea-general mailing list