mirror of
https://github.com/reddit-archive/reddit.git
synced 2026-01-26 23:39:11 -05:00
Generalize link arguments in text_with_links util.
This commit is contained in:
@@ -46,10 +46,10 @@
|
||||
${text_with_links(
|
||||
_("Use of this site constitutes acceptance of our "
|
||||
"%(user_agreement)s and %(privacy_policy)s"), nocname=True,
|
||||
user_agreement= (_("User Agreement {Genitive}"),
|
||||
"http://reddit.com/help/useragreement"),
|
||||
privacy_policy = (_("Privacy Policy {Genitive}"),
|
||||
"http://reddit.com/help/privacypolicy"))}.
|
||||
user_agreement = dict(link_text=_("User Agreement {Genitive}"),
|
||||
path="http://reddit.com/help/useragreement"),
|
||||
privacy_policy = dict(link_text=_("Privacy Policy {Genitive}"),
|
||||
path="http://reddit.com/help/privacypolicy"))}.
|
||||
© ${_("%(year)d reddit inc. All rights reserved.") % \
|
||||
dict(year=datetime.datetime.now().timetuple()[0])}
|
||||
</p>
|
||||
|
||||
@@ -171,8 +171,10 @@ ${first_defined(kw[1:])}
|
||||
<%def name="text_with_links(txt, _sr_path = False, nocname=False, **kw)">
|
||||
<%
|
||||
from r2.lib.filters import _force_unicode
|
||||
for key, (text, href) in kw.iteritems():
|
||||
kw[key]=spaceCompress(capture(plain_link, text, href, _sr_path=_sr_path, nocname=nocname))
|
||||
for key, link_args in kw.iteritems():
|
||||
link_args.setdefault("_sr_path", _sr_path)
|
||||
link_args.setdefault("nocname", nocname)
|
||||
kw[key]=spaceCompress(capture(plain_link, **link_args))
|
||||
txt = _force_unicode(txt) % kw
|
||||
txt = txt.replace(" <", " <").replace("> ", "> ")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user