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
commit99e410da1483768c8819d64b7e3edd2623b9c8cc (patch)
treed9c2703f77c08225e073ed2ffa681cdcb0d5ea68
parentbe4eeffa47eec94adbc4910501960e49fcbed7fb (diff)
downloadserverdata-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
-rw-r--r--tools/_news_colors.py16
-rw-r--r--world/map/news.d/news.template7
2 files changed, 23 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, '')
diff --git a/world/map/news.d/news.template b/world/map/news.d/news.template
index cc7bfe29..13f4569c 100644
--- a/world/map/news.d/news.template
+++ b/world/map/news.d/news.template
@@ -1,3 +1,4 @@
+{title:Exciting News!}
{date:YYYY-MM-DD}
This is a really exciting news entry!
@@ -8,4 +9,10 @@ each line at about 50 characters.
If you ever need to use actual curly braces, just
use {{ and }}.
+{ul}
+{li}You can also do lists{/li}
+{li}But they're kind of annoying{/li}
+{/ul}
+{li}And don't do as much error checking as they should{/li}
+
{author:demo}