diff options
| author | Jules Laplace <julescarbon@gmail.com> | 2018-12-16 01:13:02 +0100 |
|---|---|---|
| committer | Jules Laplace <julescarbon@gmail.com> | 2018-12-16 01:13:02 +0100 |
| commit | 63335120a5800142ebe827bd10a1a0106c24b8d8 (patch) | |
| tree | f8d21cdfa3bea51ae00eb769cb16d1a4e0bda708 /megapixels/app/site | |
| parent | a890e18a12f2b3bb39eb2f1303de71d6fbb3915c (diff) | |
building with tabulator
Diffstat (limited to 'megapixels/app/site')
| -rw-r--r-- | megapixels/app/site/parser.py | 13 |
1 files changed, 11 insertions, 2 deletions
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 "<section><div class='meta'>{}</div></section>".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)) |
