aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjwansek <eddie.atten.ea29@gmail.com>2021-04-18 16:04:17 +0100
committerjwansek <eddie.atten.ea29@gmail.com>2021-04-18 16:04:17 +0100
commit95dface9e7cd2956d0fd4a9b9041fca61afa4fe5 (patch)
treeabba78485988bf73e5458dd199989d370ac5263c
parent097ad33a05a3089dd6e684a494e6f61ab539d56c (diff)
downloadboymoder.blog-95dface9e7cd2956d0fd4a9b9041fca61afa4fe5.tar.gz
boymoder.blog-95dface9e7cd2956d0fd4a9b9041fca61afa4fe5.zip
added linking to markdown images
-rwxr-xr-xparser.py6
-rw-r--r--templates/thoughts.html14
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<blockquote>'
for line in houdini.escape_html(content.strip()).split("\n"):
out += '\n<span class="quote">{}</span><br>'.format(line)
- print(out)
return out + '\n</blockquote>'
+ def image(self, link, title, alt):
+ return "<a href='%s' target='_blank'><img alt='%s' src='%s'></a>" % (
+ 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() %}
- <h2 id={{category_name.replace(' ', '_')}}>{{category_name}}</h2>
- <dl>
- {% for id_, title, dt in thoughts %}
- <dt><a href={{'/thought?id=%i' % id_}}>{{title}}</a></dt>
- <dd>{{dt}}</dd>
- {% endfor %}
- </dl>
+ <h3 id="{{category_name.replace(' ', '_')}}">{{category_name}}</h3>
+ <dl>
+ {% for id_, title, dt in thoughts %}
+ <dt><a href="{{'/thought?id=%i' % id_}}">{{title}}</a></dt>
+ <dd>{{dt}}</dd>
+ {% endfor %}
+ </dl>
{% endfor %}
{% endblock %} \ No newline at end of file