# HG changeset patch
# User neko259
# Date 2015-03-31 08:47:29
# Node ID 8f4f78df4936fe062ead4abda6c0832546ab60ff
# Parent c1bcb1e670931b4a0deedc3fdfef0a6a8d5f4cef
Add ">" char at every line inside quote
diff --git a/boards/mdx_neboard.py b/boards/mdx_neboard.py
--- a/boards/mdx_neboard.py
+++ b/boards/mdx_neboard.py
@@ -18,6 +18,7 @@ REFLINK_PATTERN = re.compile(r'^\d+$')
MULTI_NEWLINES_PATTERN = re.compile(r'(\r?\n){2,}')
ONE_NEWLINE = '\n'
REGEX_URL = re.compile(r'https?\://[a-zA-Z0-9\-\.]+\.[a-zA-Z]{2,3}(/\S*)?')
+LINE_BREAK_HTML = ''
class TextFormatter():
@@ -50,8 +51,8 @@ class AutolinkPattern():
class QuotePattern(TextFormatter):
- name = 'q'
- preview_left = ''
+ name = '>q'
+ preview_left = ''
preview_right = ''
format_left = '[quote]'
@@ -161,7 +162,10 @@ def render_quote(tag_name, value, option
if source:
result = '' % (source, value)
else:
- result = '>%s' % value
+ # Insert a ">" at the start of every line
+ result = '>{}'.format(
+ value.replace(LINE_BREAK_HTML,
+ '{}>'.format(LINE_BREAK_HTML)))
return result
@@ -197,7 +201,7 @@ class Parser:
def __init__(self):
# The newline hack is added because br's margin does not work in all
# browsers except firefox, when the div's does.
- self.parser = bbcode.Parser(newline='')
+ self.parser = bbcode.Parser(newline=LINE_BREAK_HTML)
self.parser.add_formatter('post', render_reflink, strip=True)
self.parser.add_formatter('thread', render_multithread, strip=True)
diff --git a/boards/templates/boards/staticpages/help.html b/boards/templates/boards/staticpages/help.html
--- a/boards/templates/boards/staticpages/help.html
+++ b/boards/templates/boards/staticpages/help.html
@@ -15,7 +15,8 @@
[thread]123[/thread] — {% trans 'Add post to this thread' %}
[s]{% trans 'Strikethrough text' %}[/s]
[comment][/comment]
- [quote]{% trans 'Quote' %}[/quote]
+ [quote]>{% trans 'Quote' %}[/quote]
+ [quote source=src]
[/quote]
{% trans 'You can try pasting the text and previewing the result here:' %} {% trans 'Preview' %}
{% endblock %}