From 95dface9e7cd2956d0fd4a9b9041fca61afa4fe5 Mon Sep 17 00:00:00 2001 From: jwansek Date: Sun, 18 Apr 2021 16:04:17 +0100 Subject: added linking to markdown images --- parser.py | 6 +++++- templates/thoughts.html | 14 +++++++------- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/parser.py b/parser.py index 1ba94cd..9071a11 100755 --- a/parser.py +++ b/parser.py @@ -33,9 +33,13 @@ class HighlighterRenderer(misaka.SaferHtmlRenderer): out = '\n
' for line in houdini.escape_html(content.strip()).split("\n"): out += '\n{}
'.format(line) - print(out) return out + '\n
' + def image(self, link, title, alt): + return "%s" % ( + urlparse(link)._replace(query='').geturl(), alt, link + ) + def get_thought_from_id(db, id_): category_name, title, dt, markdown = db.get_thought(id_) return category_name, title, dt, parse_text(markdown) diff --git a/templates/thoughts.html b/templates/thoughts.html index 0d768e4..bdbe854 100644 --- a/templates/thoughts.html +++ b/templates/thoughts.html @@ -1,12 +1,12 @@ {% extends "template.html" %} {% block content %} {% for category_name, thoughts in tree.items() %} -

{{category_name}}

-
- {% for id_, title, dt in thoughts %} -
{{title}}
-
{{dt}}
- {% endfor %} -
+

{{category_name}}

+
+ {% for id_, title, dt in thoughts %} +
{{title}}
+
{{dt}}
+ {% endfor %} +
{% endfor %} {% endblock %} \ No newline at end of file -- cgit v1.2.3