From 63335120a5800142ebe827bd10a1a0106c24b8d8 Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Sun, 16 Dec 2018 01:13:02 +0100 Subject: building with tabulator --- megapixels/app/site/parser.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'megapixels') diff --git a/megapixels/app/site/parser.py b/megapixels/app/site/parser.py index 5f373937..6c6ad688 100644 --- a/megapixels/app/site/parser.py +++ b/megapixels/app/site/parser.py @@ -55,8 +55,10 @@ def format_metadata(section): return "
{}
".format(''.join(meta)) def format_applet(section, s3_path): - payload = section.replace('```', '').strip().split('\n') + print(section) + payload = section.strip('```').strip().split('\n') applet = {} + print(payload) if ': ' in payload[0]: command, opt = payload[0].split(': ') else: @@ -85,7 +87,14 @@ def parse_markdown(sections, s3_path, skip_h1=False): continue elif section.startswith('```'): groups.append(format_section(current_group, s3_path)) - groups.append(format_applet(section, s3_path)) + current_group = [] + current_group.append(section) + if section.endswith('```'): + groups.append(format_applet("\n\n".join(current_group), s3_path)) + current_group = [] + elif section.endswith('```'): + current_group.append(section) + groups.append(format_applet("\n\n".join(current_group), s3_path)) current_group = [] elif section.startswith('+ '): groups.append(format_section(current_group, s3_path)) -- cgit v1.2.3-70-g09d2