diff options
author | Ben Longbons <b.r.longbons@gmail.com> | 2013-09-29 16:13:41 -0700 |
---|---|---|
committer | Ben Longbons <b.r.longbons@gmail.com> | 2013-09-30 08:37:40 -0700 |
commit | 410fa54908f4a4de6800a12de370a46ebb35629a (patch) | |
tree | ab7690ae440d61d327818f7bf7d15e8bd265524d | |
parent | 0fb50c8cd60f764f5d4e89bb789056e56d666af0 (diff) | |
download | serverdata-410fa54908f4a4de6800a12de370a46ebb35629a.tar.gz serverdata-410fa54908f4a4de6800a12de370a46ebb35629a.tar.bz2 serverdata-410fa54908f4a4de6800a12de370a46ebb35629a.tar.xz serverdata-410fa54908f4a4de6800a12de370a46ebb35629a.zip |
Add list tags to the news generator
-rw-r--r-- | tools/_news_colors.py | 63 | ||||
-rw-r--r-- | world/map/news.d/24-code-release.txt | 32 | ||||
-rw-r--r-- | world/map/news.html | 32 |
3 files changed, 73 insertions, 54 deletions
diff --git a/tools/_news_colors.py b/tools/_news_colors.py index e98f73bf..5d693233 100644 --- a/tools/_news_colors.py +++ b/tools/_news_colors.py @@ -64,6 +64,10 @@ def make_html_colors_dict(): 'date': HtmlDate(), 'link': HtmlLink(), 'author': HtmlSignature(), + 'ul' : '<ul>', + '/ul': '</ul>', + 'li' : '<li>', + '/li': '</li>', } for k, v in color_dict.items(): r[k] = '<font color="#%06x">' % v.rgb @@ -76,30 +80,37 @@ def make_txt_colors_dict(): return dict(generate_txt_colors()) class StackPusher(object): - __slots__ = ('stack', 'txt') - def __init__(self, stack, txt): - self.stack = stack + __slots__ = ('tag_stack', 'tag', 'txt_stack', 'txt') + def __init__(self, tag_stack, tag, txt_stack, txt): + self.tag_stack = tag_stack + self.tag = tag + self.txt_stack = txt_stack self.txt = txt def __format__(self, fmt): assert fmt == '' - txt = self.txt - self.stack.append(txt) - return txt + self.tag_stack.append(self.tag) + if self.txt_stack is not None: + self.txt_stack.append(self.txt) + return self.txt class StackPopper(object): - __slots__ = ('stack', 'txt') - def __init__(self, stack, txt): - self.stack = stack + __slots__ = ('tag_stack', 'tag', 'txt_stack', 'txt') + def __init__(self, tag_stack, tag, txt_stack, txt): + self.tag_stack = tag_stack + self.tag = tag + self.txt_stack = txt_stack self.txt = txt def __format__(self, fmt): assert fmt == '' - txt = self.txt - if len(self.stack) <= 1: - raise SyntaxError('Unmatched {/%s}' % txt) - prev = self.stack.pop() - if txt != prev: - raise SyntaxError('Mismatched {/%s} from {%s}' % (txt, prev)) - return self.stack[-1] + if len(self.tag_stack) <= 0: + raise SyntaxError('Unmatched {/%s}' % self.tag) + prev = self.tag_stack.pop() + if self.tag != prev: + raise SyntaxError('Mismatched {/%s} from {%s}' % (self.tag, prev)) + if self.txt_stack is not None: + self.txt_stack.pop() + return self.txt_stack[-1] + return self.txt class TxtDate(object): __slots__ = ('stack') @@ -124,10 +135,18 @@ class TxtSignature(object): return '-##2' + author + self.stack[-1] def generate_txt_colors(): - stack = ['##0'] # don't let stack become empty + tag_stack = [] + color_stack = ['##0'] # don't let color stack become empty for k,v in color_dict.items(): - yield k, StackPusher(stack, v.txt) - yield '/' + k, StackPopper(stack, v.txt) - yield 'date', TxtDate(stack) - yield 'link', TxtLink(stack) - yield 'author', TxtSignature(stack) + yield k, StackPusher(tag_stack, k, color_stack, v.txt) + e = '/' + k + yield e, StackPopper(tag_stack, k, color_stack, v.txt) + yield 'date', TxtDate(color_stack) + yield 'link', TxtLink(color_stack) + yield 'author', TxtSignature(color_stack) + + yield 'ul', StackPusher(tag_stack, 'ul', None, '') + yield '/ul', StackPopper(tag_stack, 'ul', None, '') + + yield 'li', StackPusher(tag_stack, 'li', None, '* ') + yield '/li', StackPopper(tag_stack, 'li', None, '') diff --git a/world/map/news.d/24-code-release.txt b/world/map/news.d/24-code-release.txt index 9b3e01fd..824cab45 100644 --- a/world/map/news.d/24-code-release.txt +++ b/world/map/news.d/24-code-release.txt @@ -10,22 +10,22 @@ but we'll outline below what's relevant. The restart didn't work as smoothly as expected but we are working hard on fixing all the issues which turned up. -Currently known bugs that affect players: - * None - -Other bugs: - * Update stats from the new CDN. - * GM logs are now full-buffered (faster) instead of line-buffered. - * Admin documentation is wrong. - -Fixed bugs: - * Problems with startup speed (possibly not new, fixed anyway). - * Guildbot wouldn't start. - * Some accounts and storages with corrupted items were deleted. - * You can turn every direction except right. - * Inability to trade, except when naked. - * Warp bug related to the new Orum/Waric quest. - * Elemental bonus/malus not applied to magic. +Currently known bugs that affect players:{ul} + {li}None{/li}{/ul} + +Other bugs:{ul} + {li}Update stats from the new CDN.{/li} + {li}GM logs are now full-buffered (faster) instead of line-buffered.{/li} + {li}Admin documentation is wrong.{/li}{/ul} + +Fixed bugs:{ul} + {li}Problems with startup speed (possibly not new, fixed anyway).{/li} + {li}Guildbot wouldn't start.{/li} + {li}Some accounts and storages with corrupted items were deleted.{/li} + {li}You can turn every direction except right.{/li} + {li}Inability to trade, except when naked.{/li} + {li}Warp bug related to the new Orum/Waric quest.{/li} + {li}Elemental bonus/malus not applied to magic.{/li}{/ul} {red}If you encounter any more bugs or problems please report back immediately. Post on the forums diff --git a/world/map/news.html b/world/map/news.html index 05dfc5d1..d3b68518 100644 --- a/world/map/news.html +++ b/world/map/news.html @@ -13,22 +13,22 @@ but we'll outline below what's relevant. The restart didn't work as smoothly as expected but we are working hard on fixing all the issues which turned up. <p/> -Currently known bugs that affect players: - * None -<p/> -Other bugs: - * Update stats from the new CDN. - * GM logs are now full-buffered (faster) instead of line-buffered. - * Admin documentation is wrong. -<p/> -Fixed bugs: - * Problems with startup speed (possibly not new, fixed anyway). - * Guildbot wouldn't start. - * Some accounts and storages with corrupted items were deleted. - * You can turn every direction except right. - * Inability to trade, except when naked. - * Warp bug related to the new Orum/Waric quest. - * Elemental bonus/malus not applied to magic. +Currently known bugs that affect players:<ul> + <li>None</li></ul> +<p/> +Other bugs:<ul> + <li>Update stats from the new CDN.</li> + <li>GM logs are now full-buffered (faster) instead of line-buffered.</li> + <li>Admin documentation is wrong.</li></ul> +<p/> +Fixed bugs:<ul> + <li>Problems with startup speed (possibly not new, fixed anyway).</li> + <li>Guildbot wouldn't start.</li> + <li>Some accounts and storages with corrupted items were deleted.</li> + <li>You can turn every direction except right.</li> + <li>Inability to trade, except when naked.</li> + <li>Warp bug related to the new Orum/Waric quest.</li> + <li>Elemental bonus/malus not applied to magic.</li></ul> <p/> <font color="#ff0000">If you encounter any more bugs or problems please report back immediately. Post on the forums |