summaryrefslogtreecommitdiff
path: root/megapixels/app/site
diff options
context:
space:
mode:
authorJules Laplace <julescarbon@gmail.com>2019-02-28 17:39:22 +0100
committerJules Laplace <julescarbon@gmail.com>2019-02-28 17:39:22 +0100
commit18e595bdaf64417622d12fcbe9b5af96ac935ab3 (patch)
treeee2c38aad8e711a0966d857c36d2a653b10f8e0a /megapixels/app/site
parentc33406d4da0f03a986db62b0d6b75c5a70114abe (diff)
special case adam/jules sideimages
Diffstat (limited to 'megapixels/app/site')
-rw-r--r--megapixels/app/site/parser.py9
1 files changed, 6 insertions, 3 deletions
diff --git a/megapixels/app/site/parser.py b/megapixels/app/site/parser.py
index b8bbf289..c17d3b8a 100644
--- a/megapixels/app/site/parser.py
+++ b/megapixels/app/site/parser.py
@@ -144,7 +144,7 @@ def intro_section(metadata, s3_path):
def fix_images(lines, s3_path):
"""
- do our own tranformation of the markdown around images to handle wide images etc
+ do our own transformation of the markdown around images to handle wide images etc
lines: markdown lines
"""
real_lines = []
@@ -154,10 +154,13 @@ def fix_images(lines, s3_path):
line = line.replace('![', '')
alt_text, tail = line.split('](', 1)
url, tail = tail.split(')', 1)
+ tag = ''
if ':' in alt_text:
- tail, alt_text = alt_text.split(':', 1)
+ tag, alt_text = alt_text.split(':', 1)
img_tag = "<img src='{}' alt='{}'>".format(s3_path + url, alt_text.replace("'", ""))
- if len(alt_text):
+ if 'sideimage' in tag:
+ line = "<div class='sideimage'>{}<div>{}</div></div>".format(img_tag, markdown(tail))
+ elif len(alt_text):
line = "<div class='image'>{}<div class='caption'>{}</div></div>".format(img_tag, alt_text)
else:
line = "<div class='image'>{}</div>".format(img_tag, alt_text)