diff options
Diffstat (limited to 'builder')
| -rw-r--r-- | builder/README.md | 3 | ||||
| -rw-r--r-- | builder/builder.py | 10 | ||||
| -rw-r--r-- | builder/parser.py | 4 |
3 files changed, 10 insertions, 7 deletions
diff --git a/builder/README.md b/builder/README.md index 1a6d3a1e..57c024cb 100644 --- a/builder/README.md +++ b/builder/README.md @@ -19,3 +19,6 @@ authors: Adam Harvey, Berit Gilma, Matthew Stender Static assets: `v1/site/about/assets/picture.jpg` Dataset assets: `v1/datasets/lfw/assets/picture.jpg` + +## Markup + diff --git a/builder/builder.py b/builder/builder.py index 0e404b88..620fc710 100644 --- a/builder/builder.py +++ b/builder/builder.py @@ -29,10 +29,12 @@ def build_page(fn, research_posts): output_path = public_path + metadata['url'] output_fn = os.path.join(output_path, "index.html") - is_research = False + skip_h1 = False - if 'research/' in fn: - is_research = True + if metadata['url'] == '/': + template = env.get_template("home.html") + elif 'research/' in fn: + skip_h1 = True template = env.get_template("research.html") else: template = env.get_template("page.html") @@ -47,7 +49,7 @@ def build_page(fn, research_posts): if 'index.md' in fn: s3.sync_directory(dirname, s3_dir, metadata) - content = parser.parse_markdown(sections, s3_path, skip_h1=is_research) + content = parser.parse_markdown(sections, s3_path, skip_h1=skip_h1) html = template.render( metadata=metadata, diff --git a/builder/parser.py b/builder/parser.py index da3044a0..dd3643bf 100644 --- a/builder/parser.py +++ b/builder/parser.py @@ -46,15 +46,13 @@ def format_metadata(section): def parse_markdown(sections, s3_path, skip_h1=False): groups = [] current_group = [] - seen_metadata = False for section in sections: if skip_h1 and section.startswith('# '): continue - elif section.startswith('+ ') and not seen_metadata: + elif section.startswith('+ '): groups.append(format_section(current_group, s3_path)) groups.append(format_metadata(section)) current_group = [] - seen_metadata = True elif '![wide:' in section: groups.append(format_section(current_group, s3_path)) groups.append(format_section([section], s3_path, type='wide')) |
