def docutils_sucks(spec):
base_url = VALIDATION_SPEC<EOL>ref_url = "<STR_LIT>"<EOL>schema_url = "<STR_LIT>"<EOL>def validator(name, raw_text, text, lineno, inliner):<EOL><INDENT>"""<STR_LIT>"""<EOL>if text == "<STR_LIT>":<EOL><INDENT>return [nodes.reference(raw_text, text, refuri=ref_url)], []<EOL><DEDENT>elif text == "<STR_LIT>":<EOL><INDENT>return [nodes.reference(raw_text, text, refuri=schema_url)], []<EOL><DEDENT>header = spec.xpath("<STR_LIT>".format(text))<EOL>if len(header) == <NUM_LIT:0>:<EOL><INDENT>inliner.reporter.warning(<EOL>"<STR_LIT>".format(text),<EOL>)<EOL>uri = base_url<EOL><DEDENT>else:<EOL><INDENT>if len(header) > <NUM_LIT:1>:<EOL><INDENT>inliner.reporter.info(<EOL>"<STR_LIT>".format(text),<EOL>)<EOL><DEDENT>uri = base_url + header[<NUM_LIT:0>].find('<STR_LIT:a>').attrib["<STR_LIT>"]<EOL><DEDENT>reference = nodes.reference(raw_text, text, refuri=uri)<EOL>return [reference], []<EOL><DEDENT>return validator<EOL>
Yeah.

It doesn't allow using a class because it does stupid stuff like try to set
attributes on the callable object rather than just keeping a dict.