From 4024dd5e8a76ecdee2d869fe8a9e82997a4e85f1 Mon Sep 17 00:00:00 2001 From: Max Goodman Date: Fri, 7 Dec 2012 14:49:41 -0800 Subject: [PATCH] Markdownify goldvertisements. --- r2/example.ini | 5 ++--- r2/r2/lib/configparse.py | 2 +- r2/r2/lib/pages/pages.py | 4 ++-- r2/r2/templates/goldvertisement.html | 12 ++---------- 4 files changed, 7 insertions(+), 16 deletions(-) diff --git a/r2/example.ini b/r2/example.ini index a520edadd..614d68435 100644 --- a/r2/example.ini +++ b/r2/example.ini @@ -557,7 +557,6 @@ spotlight_interest_nosub_p = .1 # map of comment tree version to how frequently it should be chosen relative to # the others comment_tree_version_weights = 1:1, 2:0 -# message blurbs for the front page sidebar gold ad. -# use a '|' character to separate the title line from the smaller aside. -# in the title line, '%(reddit_gold)s' will be replaced by a link. +# markdown message blurbs for the front page sidebar gold ad. +# use **strong** markup for a larger font, and " \n" (
) to separate lines. goldvertisement_blurbs = "Make reddit better. Try %(reddit_gold)." "This year, give the gift of %(reddit_gold)s.|(and you should probably also give some other, better gifts)" diff --git a/r2/r2/lib/configparse.py b/r2/r2/lib/configparse.py index 64692e1dd..f2b2174ac 100644 --- a/r2/r2/lib/configparse.py +++ b/r2/r2/lib/configparse.py @@ -73,7 +73,7 @@ class ConfigValue(object): messages_re = re.compile(r'"([^"]+)"') @staticmethod def messages(v, key=None, data=None): - return ConfigValue.messages_re.findall(v) + return ConfigValue.messages_re.findall(v.decode("string_escape")) class ConfigValueParser(dict): diff --git a/r2/r2/lib/pages/pages.py b/r2/r2/lib/pages/pages.py index b5a2082a5..bbb8bcf76 100755 --- a/r2/r2/lib/pages/pages.py +++ b/r2/r2/lib/pages/pages.py @@ -3713,5 +3713,5 @@ class Goldvertisement(Templated): def __init__(self): Templated.__init__(self) blurbs = g.live_config["goldvertisement_blurbs"] - blurb = random.choice(blurbs) - self.blurb_title, sep, self.blurb_aside = blurb.partition("|") + self.blurb = random.choice(blurbs) + diff --git a/r2/r2/templates/goldvertisement.html b/r2/r2/templates/goldvertisement.html index 757f89f29..dbd3a1bad 100644 --- a/r2/r2/templates/goldvertisement.html +++ b/r2/r2/templates/goldvertisement.html @@ -20,18 +20,10 @@ ## reddit Inc. All Rights Reserved. ############################################################################### -<%namespace file="utils.html" import="tags, text_with_links"/> +<%namespace file="utils.html" import="text_with_links, md"/>
-

- - ${text_with_links(thing.blurb_title, - reddit_gold=dict(link_text="reddit gold", path="/gold/about"))} - - % if thing.blurb_aside: -
${thing.blurb_aside} - % endif -

+ ${md(thing.blurb)}