From 18e595bdaf64417622d12fcbe9b5af96ac935ab3 Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Thu, 28 Feb 2019 17:39:22 +0100 Subject: special case adam/jules sideimages --- megapixels/app/site/parser.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'megapixels/app') 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 = "{}".format(s3_path + url, alt_text.replace("'", "")) - if len(alt_text): + if 'sideimage' in tag: + line = "
{}
{}
".format(img_tag, markdown(tail)) + elif len(alt_text): line = "
{}
{}
".format(img_tag, alt_text) else: line = "
{}
".format(img_tag, alt_text) -- cgit v1.2.3-70-g09d2