From 57f2948447b51979d273149708a4f9cdb3ea64df Mon Sep 17 00:00:00 2001 From: Julian Berman Date: Wed, 30 Nov 2022 13:16:02 -0500 Subject: Handle the TypeVar for format checker callables. Mostly follows sphinx-doc/sphinx#10785 --- docs/conf.py | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'docs/conf.py') diff --git a/docs/conf.py b/docs/conf.py index 3f1f4a9..d691aaf 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -36,6 +36,33 @@ pygments_dark_style = "one-dark" html_theme = "furo" +# See sphinx-doc/sphinx#10785 +_TYPE_ALIASES = { + "jsonschema._format._F", # format checkers +} + + +def _resolve_type_aliases(app, env, node, contnode): + if ( + node["refdomain"] == "py" + and node["reftype"] == "class" + and node["reftarget"] in _TYPE_ALIASES + ): + return app.env.get_domain("py").resolve_xref( + env, + node["refdoc"], + app.builder, + "data", + node["reftarget"], + node, + contnode, + ) + + +def setup(app): + app.connect("missing-reference", _resolve_type_aliases) + + # = Builders = doctest_global_setup = """ -- cgit v1.2.1