Add config key for toc

This commit is contained in:
Jake Howard 2017-05-17 20:29:03 +01:00
parent 2c7679fb2f
commit 00badaa7e2
2 changed files with 10 additions and 1 deletions

View file

@ -69,12 +69,20 @@ def validate_context(config):
raise ConfigValidationException("Context keys must be plain. Invalid values: {}".format(", ".join(invalid_values))) raise ConfigValidationException("Context keys must be plain. Invalid values: {}".format(", ".join(invalid_values)))
def validate_toc(config):
if 'toc' not in config:
return
if type(config['toc']) != bool:
raise ConfigValidationException("Table of contents key should be either true or false")
def validate_config(config): def validate_config(config):
for validator in [ for validator in [
check_required_keys, check_required_keys,
test_input, test_input,
test_output, test_output,
validate_bibliography, validate_bibliography,
validate_context validate_context,
validate_toc
]: ]:
validator(config) validator(config)

View file

@ -12,3 +12,4 @@ context:
student_number: 123456 student_number: 123456
turnitin_number: 789123 turnitin_number: 789123
title: test title title: test title
toc: true