diff options
author | Julian Berman <Julian@GrayVines.com> | 2022-11-30 13:16:02 -0500 |
---|---|---|
committer | Julian Berman <Julian@GrayVines.com> | 2022-11-30 13:16:02 -0500 |
commit | 57f2948447b51979d273149708a4f9cdb3ea64df (patch) | |
tree | 2b9429fa7e62235fca9fc52676c1dfc96e1b3038 /docs/conf.py | |
parent | ea1c71abbe70f426ee4667d965ab9aa2b1f07d4b (diff) | |
download | jsonschema-57f2948447b51979d273149708a4f9cdb3ea64df.tar.gz |
Handle the TypeVar for format checker callables.
Mostly follows sphinx-doc/sphinx#10785
Diffstat (limited to 'docs/conf.py')
-rw-r--r-- | docs/conf.py | 27 |
1 files changed, 27 insertions, 0 deletions
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 = """ |