Skip to content
This repository has been archived by the owner on Nov 9, 2017. It is now read-only.

Commit

Permalink
Markdownify goldvertisements.
Browse files Browse the repository at this point in the history
  • Loading branch information
chromakode committed Dec 7, 2012
1 parent 91a34e5 commit 4024dd5
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 16 deletions.
5 changes: 2 additions & 3 deletions r2/example.ini
Original file line number Diff line number Diff line change
Expand Up @@ -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" (<br>) 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)"
2 changes: 1 addition & 1 deletion r2/r2/lib/configparse.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ def days(v, key=None, data=None):
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):
Expand Down
4 changes: 2 additions & 2 deletions r2/r2/lib/pages/pages.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

12 changes: 2 additions & 10 deletions r2/r2/templates/goldvertisement.html
Original file line number Diff line number Diff line change
Expand Up @@ -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"/>

<div class="goldvertisement">
<div class="inner">
<p>
<strong>
${text_with_links(thing.blurb_title,
reddit_gold=dict(link_text="reddit gold", path="/gold/about"))}
</strong>
% if thing.blurb_aside:
<br><i>${thing.blurb_aside}</i>
% endif
</p>
${md(thing.blurb)}
</div>
</div>

0 comments on commit 4024dd5

Please sign in to comment.