Show More
@@ -18,6 +18,7 b' PostingDelay = 30' | |||
|
18 | 18 | Autoban = false |
|
19 | 19 | DefaultTag = test |
|
20 | 20 | MaxFileCount = 1 |
|
21 | AdditionalSpoilerSpaces = false | |
|
21 | 22 | |
|
22 | 23 | [Messages] |
|
23 | 24 | # Thread bumplimit |
@@ -10,6 +10,7 b' from django.core.exceptions import Objec' | |||
|
10 | 10 | from django.core.urlresolvers import reverse |
|
11 | 11 | |
|
12 | 12 | import boards |
|
13 | from boards import settings | |
|
13 | 14 | |
|
14 | 15 | |
|
15 | 16 | __author__ = 'neko259' |
@@ -24,6 +25,7 b' LINE_BREAK_HTML = \'<div class="br"></div' | |||
|
24 | 25 | SPOILER_SPACE = ' ' |
|
25 | 26 | |
|
26 | 27 | MAX_SPOILER_MULTIPLIER = 2 |
|
28 | MAX_SPOILER_SPACE_COUNT = 20 | |
|
27 | 29 | |
|
28 | 30 | |
|
29 | 31 | class TextFormatter(): |
@@ -202,11 +204,15 b' def render_tag(tag_name, value, options,' | |||
|
202 | 204 | |
|
203 | 205 | |
|
204 | 206 | def render_spoiler(tag_name, value, options, parent, context): |
|
205 | text_len = len(value) | |
|
206 | space_count = random.randint(0, text_len * MAX_SPOILER_MULTIPLIER) | |
|
207 | side_spaces = SPOILER_SPACE * (space_count // 2) | |
|
208 | return '<span class="spoiler">{}{}{}</span>'.format(side_spaces, value, | |
|
209 | side_spaces) | |
|
207 | if settings.get_bool('Forms', 'AdditionalSpoilerSpaces'): | |
|
208 | text_len = len(value) | |
|
209 | space_count = min(random.randint(0, text_len * MAX_SPOILER_MULTIPLIER), | |
|
210 | MAX_SPOILER_SPACE_COUNT) | |
|
211 | side_spaces = SPOILER_SPACE * (space_count // 2) | |
|
212 | else: | |
|
213 | side_spaces = '' | |
|
214 | return '<span class="spoiler">{}{}{}</span>'.format(side_spaces, | |
|
215 | value, side_spaces) | |
|
210 | 216 | |
|
211 | 217 | |
|
212 | 218 | formatters = [ |
General Comments 0
You need to be logged in to leave comments.
Login now