diff --git a/common/lib/capa/capa/inputtypes.py b/common/lib/capa/capa/inputtypes.py index 790e93679d..d638b41350 100644 --- a/common/lib/capa/capa/inputtypes.py +++ b/common/lib/capa/capa/inputtypes.py @@ -46,6 +46,7 @@ import re import shlex # for splitting quoted strings import sys import pyparsing +import html5lib from .registry import TagRegistry from chem import chemcalc @@ -286,7 +287,18 @@ class InputTypeBase(object): context = self._get_render_context() html = self.capa_system.render_template(self.template, context) - return etree.XML(html) + + try: + output = etree.XML(html) + except etree.XMLSyntaxError as ex: + # If `html` contains attrs with no values, like `controls` in