From 9ec276ec3ddbbaad554657333453317947f98d63 Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Sun, 16 Dec 2018 12:42:21 +0100 Subject: generate single page with -i --- megapixels/app/site/parser.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'megapixels/app/site/parser.py') diff --git a/megapixels/app/site/parser.py b/megapixels/app/site/parser.py index ca6ac77b..44186be6 100644 --- a/megapixels/app/site/parser.py +++ b/megapixels/app/site/parser.py @@ -73,7 +73,8 @@ def format_applet(section, s3_path): if command == 'load file': if opt[0] != '/': applet['opt'] = s3_path + opt - applet['fields'] = payload[1] + if len(payload) > 1: + applet['fields'] = payload[1] return "
".format(json.dumps(applet)) def parse_markdown(sections, s3_path, skip_h1=False): @@ -85,14 +86,14 @@ def parse_markdown(sections, s3_path, skip_h1=False): for section in sections: if skip_h1 and section.startswith('# '): continue - elif section.startswith('```'): + elif section.strip().startswith('```'): groups.append(format_section(current_group, s3_path)) current_group = [] current_group.append(section) - if section.endswith('```'): + if section.strip().endswith('```'): groups.append(format_applet("\n\n".join(current_group), s3_path)) current_group = [] - elif section.endswith('```'): + elif section.strip().endswith('```'): current_group.append(section) groups.append(format_applet("\n\n".join(current_group), s3_path)) current_group = [] -- cgit v1.2.3-70-g09d2