diff --git a/md_pdf/config/validate.py b/md_pdf/config/validate.py index a9d5623..22e20cf 100644 --- a/md_pdf/config/validate.py +++ b/md_pdf/config/validate.py @@ -69,12 +69,20 @@ def validate_context(config): 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): for validator in [ check_required_keys, test_input, test_output, validate_bibliography, - validate_context + validate_context, + validate_toc ]: validator(config) diff --git a/test-files/mdp.yml b/test-files/mdp.yml index 411e971..661ce22 100644 --- a/test-files/mdp.yml +++ b/test-files/mdp.yml @@ -12,3 +12,4 @@ context: student_number: 123456 turnitin_number: 789123 title: test title +toc: true