From c33406d4da0f03a986db62b0d6b75c5a70114abe Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Thu, 28 Feb 2019 17:29:16 +0100 Subject: sidebar on about pages --- megapixels/app/site/parser.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'megapixels/app/site/parser.py') diff --git a/megapixels/app/site/parser.py b/megapixels/app/site/parser.py index 9e904e00..b8bbf289 100644 --- a/megapixels/app/site/parser.py +++ b/megapixels/app/site/parser.py @@ -43,17 +43,19 @@ def parse_markdown(metadata, sections, s3_path, skip_h1=False): footnotes.append(section) elif ignoring: continue - elif '### Statistics' in section: + elif '### statistics' in section.lower() or '### sidebar' in section.lower(): if len(current_group): groups.append(format_section(current_group, s3_path)) current_group = [] - current_group.append(section) + if 'sidebar' not in section.lower(): + current_group.append(section) in_stats = True - elif in_stats and not section.strip().startswith('## '): + elif in_stats and not section.strip().startswith('## ') and 'end sidebar' not in section.lower(): current_group.append(section) - elif in_stats and section.strip().startswith('## '): + elif in_stats and section.strip().startswith('## ') or 'end sidebar' in section.lower(): current_group = [format_section(current_group, s3_path, 'right-sidebar', tag='div')] - current_group.append(section) + if 'end sidebar' not in section.lower(): + current_group.append(section) in_stats = False elif section.strip().startswith('```'): groups.append(format_section(current_group, s3_path)) -- cgit v1.2.3-70-g09d2