From b09a57ef44acbb81fc209d2fc7fb31f75bfce294 Mon Sep 17 00:00:00 2001 From: Ben Longbons Date: Mon, 21 Oct 2013 14:57:18 -0700 Subject: Add support for news titles We really need someone to do proper CSS ... or look at the old CSS --- _news_colors.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) 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 '-%s' % author +class HtmlTitle(object): + __slots__ = () + def __format__(self, title): + # no color here + # (we really need someone to do CSS) + return '%s' % title + def make_html_colors_dict(): r = { 'date': HtmlDate(), 'link': HtmlLink(), 'author': HtmlSignature(), + 'title': HtmlTitle(), 'ul' : '', '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, '') -- cgit v1.2.3-60-g2f50