diff --git a/catalog/templates/item_mark_list.html b/catalog/templates/item_mark_list.html
index b7a3f50d..eeb61650 100644
--- a/catalog/templates/item_mark_list.html
+++ b/catalog/templates/item_mark_list.html
@@ -51,7 +51,7 @@
{% endif %}
{% if others_mark.mark.text %}
-
{{ others_mark.mark.text }}
+
{{ others_mark.mark.comment_html|safe }}
{% endif %}
{% empty %}
diff --git a/common/static/sass/_MdContent.sass b/common/static/sass/_MdContent.sass
index ebfa1c45..79bac1ad 100644
--- a/common/static/sass/_MdContent.sass
+++ b/common/static/sass/_MdContent.sass
@@ -64,10 +64,12 @@
background: unset;
text-decoration: underline;
- & .spoiler
- filter: blur(8px);
- cursor: pointer;
+.spoiler
+ background: grey;
+ filter: blur(2px);
+ cursor: pointer;
- & .spoiler .revealed
- filter: unset;
- color: inherit;
+.spoiler.revealed
+ background: unset;
+ filter: unset;
+ color: inherit;
diff --git a/journal/models.py b/journal/models.py
index c5979ba9..caf2ab2b 100644
--- a/journal/models.py
+++ b/journal/models.py
@@ -22,7 +22,7 @@ from django.utils.baseconv import base62
from django.db.models import Q
from catalog.models import *
from django.contrib.contenttypes.models import ContentType
-from .renderers import render_md
+from .renderers import render_md, render_text
from catalog.common import jsondata
from journal import renderers
@@ -188,6 +188,10 @@ class Memo(Content):
class Comment(Content):
text = models.TextField(blank=False, null=False)
+ @property
+ def html(self):
+ return render_text(self.text)
+
@staticmethod
def comment_item_by_user(item, user, text, visibility=0):
comment = Comment.objects.filter(owner=user, item=item).first()
@@ -949,6 +953,10 @@ class Mark:
def text(self):
return self.comment.text if self.comment else None
+ @property
+ def comment_html(self):
+ return self.comment.html if self.comment else None
+
@cached_property
def review(self):
return Review.objects.filter(owner=self.owner, item=self.item).first()
diff --git a/journal/renderers.py b/journal/renderers.py
index 1110e689..d6aaa01e 100644
--- a/journal/renderers.py
+++ b/journal/renderers.py
@@ -1,7 +1,7 @@
from typing import cast
import mistune
import re
-
+from django.utils.html import escape
MARKDOWNX_MARKDOWNIFY_FUNCTION = "journal.renderers.render_md"
@@ -30,5 +30,19 @@ def render_md(s) -> str:
return cast(str, _markdown(s))
+def _spolier(s):
+ l = s.split(">!", 1)
+ if len(l) == 1:
+ return escape(s)
+ r = l[1].split("!<", 1)
+ return (
+ escape(l[0])
+ + '
'
+ + escape(r[0])
+ + ""
+ + (_spolier(r[1]) if len(r) == 2 else "")
+ )
+
+
def render_text(s):
- return mistune.html(s)
+ return _spolier(s)
diff --git a/journal/templates/list_item_base.html b/journal/templates/list_item_base.html
index 4b6ab438..e5b27a0d 100644
--- a/journal/templates/list_item_base.html
+++ b/journal/templates/list_item_base.html
@@ -96,7 +96,7 @@
{% if mark.text %}
- {{ mark.text }}
+ {{ mark.comment_html|safe }}
{% endif %}
diff --git a/social/templates/activity/create_collection.html b/social/templates/activity/create_collection.html
index fa4f1b3a..aa1e4aa0 100644
--- a/social/templates/activity/create_collection.html
+++ b/social/templates/activity/create_collection.html
@@ -44,17 +44,5 @@
{% endfor %}