diff options
author | Ben Longbons <b.r.longbons@gmail.com> | 2013-10-21 14:57:18 -0700 |
---|---|---|
committer | Ben Longbons <b.r.longbons@gmail.com> | 2013-10-21 14:57:20 -0700 |
commit | 99e410da1483768c8819d64b7e3edd2623b9c8cc (patch) | |
tree | d9c2703f77c08225e073ed2ffa681cdcb0d5ea68 /tools | |
parent | be4eeffa47eec94adbc4910501960e49fcbed7fb (diff) | |
download | serverdata-99e410da1483768c8819d64b7e3edd2623b9c8cc.tar.gz serverdata-99e410da1483768c8819d64b7e3edd2623b9c8cc.tar.bz2 serverdata-99e410da1483768c8819d64b7e3edd2623b9c8cc.tar.xz serverdata-99e410da1483768c8819d64b7e3edd2623b9c8cc.zip |
Add support for news titles
We really need someone to do proper CSS ... or look at the old CSS
Diffstat (limited to 'tools')
-rw-r--r-- | tools/_news_colors.py | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/tools/_news_colors.py b/tools/_news_colors.py index 5d693233..329a6b82 100644 --- a/tools/_news_colors.py +++ b/tools/_news_colors.py @@ -59,11 +59,19 @@ class HtmlSignature(object): def __format__(self, author): return '-<font color="#009000">%s</font>' % author +class HtmlTitle(object): + __slots__ = () + def __format__(self, title): + # no color here + # (we really need someone to do CSS) + return '<b>%s</b>' % title + def make_html_colors_dict(): r = { 'date': HtmlDate(), 'link': HtmlLink(), 'author': HtmlSignature(), + 'title': HtmlTitle(), 'ul' : '<ul>', '/ul': '</ul>', 'li' : '<li>', @@ -134,6 +142,13 @@ class TxtSignature(object): def __format__(self, author): return '-##2' + author + self.stack[-1] +class TxtTitle(object): + __slots__ = ('stack') + def __init__(self, stack): + self.stack = stack + def __format__(self, title): + return '##7' + title + self.stack[-1] + def generate_txt_colors(): tag_stack = [] color_stack = ['##0'] # don't let color stack become empty @@ -144,6 +159,7 @@ def generate_txt_colors(): yield 'date', TxtDate(color_stack) yield 'link', TxtLink(color_stack) yield 'author', TxtSignature(color_stack) + yield 'title', TxtTitle(color_stack) yield 'ul', StackPusher(tag_stack, 'ul', None, '') yield '/ul', StackPopper(tag_stack, 'ul', None, '') |