# HG changeset patch # User neko259 # Date 2014-08-05 13:24:56 # Node ID 8eb55ab8dcedaedef846923719fb21cc1da49cae # Parent 6cc0010d214a41d86f056f302ee44e26cec8955f Added source parameter to quotes diff --git a/boards/mdx_neboard.py b/boards/mdx_neboard.py --- a/boards/mdx_neboard.py +++ b/boards/mdx_neboard.py @@ -77,6 +77,7 @@ class CommentPattern(TextFormatter): format_right = '[/comment]' +# TODO Use tag here class StrikeThroughPattern(TextFormatter): name = 's' preview_left = '' @@ -128,6 +129,20 @@ def render_reflink(tag_name, value, opti return u'>>%s' % value +def render_quote(tag_name, value, options, parent, context): + source = u'' + if 'source' in options: + source = options['source'] + + result = u'' + if source: + result = u'
%s
%s
' % (source, value) + else: + result = u'
%s
' % value + + return result + + def preparse_text(text): """ Performs manual parsing before the bbcode parser is used. @@ -139,8 +154,7 @@ def preparse_text(text): def bbcode_extended(markup): parser = bbcode.Parser() parser.add_formatter('post', render_reflink, strip=True) - parser.add_simple_formatter('quote', - u'%(value)s', strip=True) + parser.add_formatter('quote', render_quote, strip=True) parser.add_simple_formatter('comment', u'//%(value)s') parser.add_simple_formatter('spoiler', diff --git a/boards/static/css/md/base_page.css b/boards/static/css/md/base_page.css --- a/boards/static/css/md/base_page.css +++ b/boards/static/css/md/base_page.css @@ -430,6 +430,14 @@ ul { padding-left: 0px; } +.quote-header { + border-bottom: 2px solid #ddd; + margin-bottom: 1ex; + padding-bottom: .5ex; + color: #ddd; + font-size: 1.2em; +} + /* Reflink preview */ .post_preview { border-left: 1px solid #777;