summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Longbons <b.r.longbons@gmail.com>2013-10-21 14:57:18 -0700
committerBen Longbons <b.r.longbons@gmail.com>2013-10-21 14:57:20 -0700
commitb09a57ef44acbb81fc209d2fc7fb31f75bfce294 (patch)
treed8a88dcdbd8db16f75a17d7272ad3e721509b07e
parent961c88010968ae078c4852da4d73e419d7c148a7 (diff)
downloadtools-b09a57ef44acbb81fc209d2fc7fb31f75bfce294.tar.gz
tools-b09a57ef44acbb81fc209d2fc7fb31f75bfce294.tar.bz2
tools-b09a57ef44acbb81fc209d2fc7fb31f75bfce294.tar.xz
tools-b09a57ef44acbb81fc209d2fc7fb31f75bfce294.zip
Add support for news titles
We really need someone to do proper CSS ... or look at the old CSS
-rw-r--r--_news_colors.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/_news_colors.py b/_news_colors.py
index 5d69323..329a6b8 100644
--- a/_news_colors.py
+++ b/_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, '')