mirror of
https://github.com/reddit-archive/reddit.git
synced 2026-01-23 22:08:11 -05:00
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.
This commit is contained in:
@@ -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):
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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 @@ ${unsafe(txt)}
|
||||
%elif thing.editted:
|
||||
<em>*</em>
|
||||
%endif
|
||||
</%def>
|
||||
</%def>
|
||||
|
||||
<%def name="_md(text, wrap=False)">
|
||||
${unsafe(safemarkdown(_(text), wrap=wrap))}
|
||||
</%def>
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user