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