Skip to content
This repository was archived by the owner on Aug 14, 2024. It is now read-only.

Commit f0a9475

Browse files
committed
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 '..'
1 parent 68c1493 commit f0a9475

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

bin/lesson_check.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,10 @@ def check_config(reporter, source_dir):
155155
reporter.check_field(config_file, 'configuration', config, 'title')
156156
reporter.check_field(config_file, 'configuration', config, 'email')
157157

158+
reporter.check({'values': {'root': '..'}} in config.get('defaults', []),
159+
'configuration',
160+
'"root" not set to ".." in configuration')
161+
158162

159163
def read_all_markdown(source_dir, parser):
160164
"""Read source files, returning
@@ -424,6 +428,12 @@ def __init__(self, args, filename, metadata, metadata_len, text, lines, doc):
424428
super(CheckIndex, self).__init__(args, filename, metadata, metadata_len, text, lines, doc)
425429
self.layout = 'lesson'
426430

431+
def check_metadata(self):
432+
super(CheckIndex, self).check_metadata()
433+
self.reporter.check(self.metadata.get('root', '') == '.',
434+
self.filename,
435+
'Root not set to "."')
436+
427437

428438
class CheckEpisode(CheckBase):
429439
"""Check an episode page."""

0 commit comments

Comments
 (0)