home » zplus/freepost.git
Author zPlus <zplus@peers.community> 2018-07-18 22:00:55
Committer zPlus <zplus@peers.community> 2018-07-18 22:00:55
Commit ea4180a (patch)
Tree 4bc7ce8
Parent(s)

Add "markdown to text" filter for jinja. modified: freepost/__init__.py modified: freepost/templates/homepage.html


commits diff: ee46645..ea4180a
2 files changed, 4 insertions, 1 deletiondownload


Diffstat
-rwxr-xr-x freepost/__init__.py 3
-rwxr-xr-x freepost/templates/homepage.html 2

Diff options
View
Side
Whitespace
Context lines
Inter-hunk lines
+3/-0 M   freepost/__init__.py
index 7958ca7..60a9b36
old size: 22K - new size: 23K
@@ -33,6 +33,9 @@ template = functools.partial (
33 33 'ago': lambda date: timeago.format (date),
34 34 'datetime': lambda date: date.strftime ('%b %-d, %Y - %H:%M%p%z%Z'),
35 35 'title': lambda date: date.strftime ('%b %-d, %Y - %H:%M%z%Z'),
36 + # Convert markdown to plain text
37 + 'md2txt': lambda text: bleach.clean (markdown.markdown (text),
38 + tags=[], attributes={}, styles=[], strip=True),
36 39 # Convert markdown to html
37 40 'md2html': lambda text: bleach.clean (markdown.markdown (
38 41 text,

+1/-1 M   freepost/templates/homepage.html
index fee6def..5d2a3c6
old size: 3K - new size: 3K
@@ -29,7 +29,7 @@
29 29 {% if post.text %}
30 30 <img
31 31 alt=""
32 - title="{{ post.text }}"
32 + title="{{ post.text|md2txt }}"
33 33 src="{{ url ('static', filename='images/text.svg') }}"
34 34 class="text_preview" />
35 35 {% endif %}