Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Add _md template util for translation of complex text.

Added whitespace disabling wrapping around md with wrap=False -- this
should have been in the original commit that added the wrap argument.
  • Loading branch information...
commit 1ebddc5185f819def2ba5c2ccfd994307ec6b264 1 parent e28541d
@chromakode chromakode authored
View
2  r2/r2/lib/filters.py
@@ -226,7 +226,7 @@ def safemarkdown(text, nofollow=False, wrap=True, **kwargs):
if wrap:
return SC_OFF + MD_START + text + MD_END + SC_ON
else:
- return text
+ return SC_OFF + text + SC_ON
def keep_space(text):
View
6 r2/r2/templates/oauth2authorization.html
@@ -21,12 +21,12 @@
################################################################################
<%!
from r2.lib.template_helpers import static, s3_https_if_secure
- from r2.lib.filters import safemarkdown
%>
+<%namespace file="utils.html" import="_md" />
<div class="content oauth2-authorize">
<img class="icon" src="${s3_https_if_secure(thing.client.icon_url)}" alt="${thing.client.name} icon" />
- ${unsafe(safemarkdown(_("#[%(app_name)s](%(app_about_url)s) requests to connect with your reddit account.")
- % dict(app_name=thing.client.name, app_about_url=thing.client.about_url), wrap=False))}
+ ${_md("#[%(app_name)s](%(app_about_url)s) requests to connect with your reddit account."
+ % dict(app_name=thing.client.name, app_about_url=thing.client.about_url))}
<div class="access">
<h2>${_("Allow %(app_name)s to:") % dict(app_name=thing.client.name)}</h2>
<ul>
View
8 r2/r2/templates/utils.html
@@ -23,7 +23,7 @@
<%!
import json
from r2.models import FakeSubreddit
- from r2.lib.filters import spaceCompress, unsafe
+ from r2.lib.filters import spaceCompress, unsafe, safemarkdown
from r2.lib.template_helpers import add_sr, js_config, static
from r2.lib.utils import cols, long_datetime, timesince
from r2.lib.tracking import UserInfo
@@ -561,4 +561,8 @@
%elif thing.editted:
<em>*</em>
%endif
-</%def>
+</%def>
+
+<%def name="_md(text, wrap=False)">
+ ${unsafe(safemarkdown(_(text), wrap=wrap))}
+</%def>
View
2  r2/setup.cfg
@@ -35,6 +35,6 @@ make-dirs=1
[extract_messages]
add_comments = TRANSLATORS:
-keywords = P_:1,2
+keywords = P_:1,2 _md
mapping_file = babel.cfg
width = 80
Please sign in to comment.
Something went wrong with that request. Please try again.