From 4c13001a6f48f9d5acf76757dbe0fe942d0b9652 Mon Sep 17 00:00:00 2001 From: Richard Berger Date: Sun, 24 Nov 2019 19:49:59 -0700 Subject: [PATCH] Add extension errors that stop the build --- doc/src/_ext/table_from_list.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/doc/src/_ext/table_from_list.py b/doc/src/_ext/table_from_list.py index 44c85fc378..715a3c2488 100644 --- a/doc/src/_ext/table_from_list.py +++ b/doc/src/_ext/table_from_list.py @@ -4,6 +4,7 @@ from docutils.nodes import Element, Node from typing import Any, Dict, List from sphinx import addnodes from sphinx.util import logging +from sphinx.errors import SphinxError class TableFromList(SphinxDirective): has_content = True @@ -22,8 +23,12 @@ class TableFromList(SphinxDirective): if len(node.children) != 1 or not isinstance(node.children[0], nodes.bullet_list): reporter = self.state.document.reporter - return [reporter.warning('.. table_from_list content is not a list', line=self.lineno)] + raise SphinxError('table_from_list content is not a list') fulllist = node.children[0] + + if (len(fulllist) % ncolumns) != 0: + raise SphinxError('number of list elements not a multiple of column number') + table = nodes.table() tgroup = nodes.tgroup(cols=ncolumns) table += tgroup