Show More
@@ -26,6 +26,8 b" ONE_NEWLINE = '\\n'" | |||||
26 | REGEX_URL = re.compile(r'https?\://[a-zA-Z0-9\-\.]+\.[a-zA-Z]{2,3}(/\S*)?') |
|
26 | REGEX_URL = re.compile(r'https?\://[a-zA-Z0-9\-\.]+\.[a-zA-Z]{2,3}(/\S*)?') | |
27 | LINE_BREAK_HTML = '<div class="br"></div>' |
|
27 | LINE_BREAK_HTML = '<div class="br"></div>' | |
28 | SPOILER_SPACE = ' ' |
|
28 | SPOILER_SPACE = ' ' | |
|
29 | REGEX_ANY_LINE_BREAK = re.compile(r'(' + LINE_BREAK_HTML + '|\r|\n)') | |||
|
30 | QUOTE_REPLACEMENT = '\g<1>>' | |||
29 |
|
31 | |||
30 | MAX_SPOILER_MULTIPLIER = 2 |
|
32 | MAX_SPOILER_MULTIPLIER = 2 | |
31 | MAX_SPOILER_SPACE_COUNT = 20 |
|
33 | MAX_SPOILER_SPACE_COUNT = 20 | |
@@ -167,19 +169,14 b' def render_reflink(tag_name, value, opti' | |||||
167 |
|
169 | |||
168 |
|
170 | |||
169 | def render_quote(tag_name, value, options, parent, context): |
|
171 | def render_quote(tag_name, value, options, parent, context): | |
170 | source = '' |
|
172 | source = options.get('quote') or options.get('source') | |
171 | if 'source' in options: |
|
|||
172 | source = options['source'] |
|
|||
173 | elif 'quote' in options: |
|
|||
174 | source = options['quote'] |
|
|||
175 |
|
173 | |||
176 | if source: |
|
174 | if source: | |
177 | result = '<div class="multiquote"><div class="quote-header">%s</div><div class="quote-text">%s</div></div>' % (source, value) |
|
175 | result = '<div class="multiquote"><div class="quote-header">%s</div><div class="quote-text">%s</div></div>' % (source, value) | |
178 | else: |
|
176 | else: | |
179 | # Insert a ">" at the start of every line |
|
177 | # Insert a ">" at the start of every line | |
180 | result = '<span class="quote">>{}</span>'.format( |
|
178 | result = '<span class="quote">>{}</span>'.format( | |
181 | value.replace(LINE_BREAK_HTML, |
|
179 | REGEX_ANY_LINE_BREAK.sub(QUOTE_REPLACEMENT, value)) | |
182 | '{}>'.format(LINE_BREAK_HTML))) |
|
|||
183 |
|
180 | |||
184 | return result |
|
181 | return result | |
185 |
|
182 |
General Comments 0
You need to be logged in to leave comments.
Login now