summaryrefslogtreecommitdiff
path: root/spoiler.py
diff options
context:
space:
mode:
authorBotond Hende <nettingman@gmail.com>2024-09-22 21:03:39 +0200
committerBotond Hende <nettingman@gmail.com>2024-09-22 21:03:39 +0200
commit0e4fe058953c53278a28de7605a7e40ec7f778b0 (patch)
tree983d5eabdf5852c56ad9a675563e13f863f29bc1 /spoiler.py
parent172401092bc5bb1ec309031f9b61e72e47e52961 (diff)
spoiler keeps the whitespacesHEADmaster
Diffstat (limited to 'spoiler.py')
-rw-r--r--spoiler.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/spoiler.py b/spoiler.py
index ff762ef..a2c1397 100644
--- a/spoiler.py
+++ b/spoiler.py
@@ -25,7 +25,7 @@ class SpoilerElement(inline.InlineElement):
class SpoilerRenderer:
def render_spoiler_element(self, element: SpoilerElement):
content = self.render_children(element)
- return f'<span><input type="checkbox" class="spoiler" id="{element.id}"><label class="spoiler-on" for="{element.id}"><span>{"▉" * len(unescape(content))}</span></label><label class="spoiler-off" for="{element.id}"><span>{content}</span></label></span>'
+ return f'<span><input type="checkbox" class="spoiler" id="{element.id}"><label class="spoiler-on" for="{element.id}"><span>{"".join(["▉" if char != " " else " " for char in unescape(content)])}</span></label><label class="spoiler-off" for="{element.id}"><span>{content}</span></label></span>'
Spoiler = MarkoExtension(