# HG changeset patch # User neko259 # Date 2019-01-07 09:33:26 # Node ID 0208042a34f477ed466272b15a85ef2416654215 # Parent 8f7d163724c159147137db3cab1b3929e8b44070 Fixed multiline quote. Simplified the quote source retrieving diff --git a/boards/mdx_neboard.py b/boards/mdx_neboard.py --- a/boards/mdx_neboard.py +++ b/boards/mdx_neboard.py @@ -26,6 +26,8 @@ ONE_NEWLINE = '\n' REGEX_URL = re.compile(r'https?\://[a-zA-Z0-9\-\.]+\.[a-zA-Z]{2,3}(/\S*)?') LINE_BREAK_HTML = '
' SPOILER_SPACE = ' ' +REGEX_ANY_LINE_BREAK = re.compile(r'(' + LINE_BREAK_HTML + '|\r|\n)') +QUOTE_REPLACEMENT = '\g<1>>' MAX_SPOILER_MULTIPLIER = 2 MAX_SPOILER_SPACE_COUNT = 20 @@ -167,19 +169,14 @@ def render_reflink(tag_name, value, opti def render_quote(tag_name, value, options, parent, context): - source = '' - if 'source' in options: - source = options['source'] - elif 'quote' in options: - source = options['quote'] + source = options.get('quote') or options.get('source') if source: result = '
%s
%s
' % (source, value) else: # Insert a ">" at the start of every line result = '>{}'.format( - value.replace(LINE_BREAK_HTML, - '{}>'.format(LINE_BREAK_HTML))) + REGEX_ANY_LINE_BREAK.sub(QUOTE_REPLACEMENT, value)) return result