Commit f0a94758 authored by Greg Wilson's avatar Greg Wilson
Browse files

Adding checks for things that commonly go wrong during template conversion.

1. Checking that `index.md` has `root` set to '.'
2. Checking that `_config.yml` has `root` set to '..'
parent 68c14937
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -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
@@ -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."""