diff --git a/util/wiki/.gitignore b/util/wiki/.gitignore new file mode 100644 index 0000000000..8ed110b15a --- /dev/null +++ b/util/wiki/.gitignore @@ -0,0 +1,2 @@ +vercors.wiki/ +wiki.pdf diff --git a/util/wiki/generate_wiki_pdf.py b/util/wiki/generate_wiki_pdf.py index acde651630..3fdaa132c7 100755 --- a/util/wiki/generate_wiki_pdf.py +++ b/util/wiki/generate_wiki_pdf.py @@ -10,6 +10,7 @@ import optparse import time import uuid +import sys class SnippetTestcase: """ @@ -195,8 +196,15 @@ def collect_testcases(document, cases): for block in document['blocks']: # Code blocks preceded by a label are added to the labeled testcase if block['t'] == 'CodeBlock' and code_block_label is not None: - cases[code_block_label].add_content(block['c'][1].strip()) - cases[code_block_label].language = block['c'][0][1][0] + code_txt = block['c'][1] + cases[code_block_label].add_content(code_txt) + + languages = block['c'][0][1] + if len(languages) == 0: + print(f"Error: language was not specified for code block.\nLabel: {code_block_label}\nText in code block:\n{code_txt}") + sys.exit(1) + + cases[code_block_label].language = languages[0] block['_case_label'] = code_block_label code_block_label = None