Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Adding checks for things that commonly go wrong during template conve…
…rsion.

1. Checking that `index.md` has `root` set to '.'
2. Checking that `_config.yml` has `root` set to '..'
  • Loading branch information
Greg Wilson committed Sep 15, 2016
1 parent 68c1493 commit f0a9475
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions bin/lesson_check.py
Expand Up @@ -155,6 +155,10 @@ def check_config(reporter, source_dir):
reporter.check_field(config_file, 'configuration', config, 'title')
reporter.check_field(config_file, 'configuration', config, 'email')

reporter.check({'values': {'root': '..'}} in config.get('defaults', []),
'configuration',
'"root" not set to ".." in configuration')


def read_all_markdown(source_dir, parser):
"""Read source files, returning
Expand Down Expand Up @@ -424,6 +428,12 @@ class CheckIndex(CheckBase):
super(CheckIndex, self).__init__(args, filename, metadata, metadata_len, text, lines, doc)
self.layout = 'lesson'

def check_metadata(self):
super(CheckIndex, self).check_metadata()
self.reporter.check(self.metadata.get('root', '') == '.',
self.filename,
'Root not set to "."')


class CheckEpisode(CheckBase):
"""Check an episode page."""
Expand Down

0 comments on commit f0a9475

Please sign in to comment.