sphinx-codeautolink 0.16.2__tar.gz → 0.17.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {sphinx_codeautolink-0.16.2 → sphinx_codeautolink-0.17.1}/MANIFEST.in +1 -0
- {sphinx_codeautolink-0.16.2/src/sphinx_codeautolink.egg-info → sphinx_codeautolink-0.17.1}/PKG-INFO +4 -5
- {sphinx_codeautolink-0.16.2 → sphinx_codeautolink-0.17.1}/contributing.rst +12 -0
- {sphinx_codeautolink-0.16.2 → sphinx_codeautolink-0.17.1}/docs/src/about.rst +1 -1
- {sphinx_codeautolink-0.16.2 → sphinx_codeautolink-0.17.1}/docs/src/conf.py +3 -0
- {sphinx_codeautolink-0.16.2 → sphinx_codeautolink-0.17.1}/docs/src/examples.rst +37 -14
- {sphinx_codeautolink-0.16.2 → sphinx_codeautolink-0.17.1}/docs/src/index.rst +4 -5
- {sphinx_codeautolink-0.16.2 → sphinx_codeautolink-0.17.1}/docs/src/reference.rst +43 -10
- {sphinx_codeautolink-0.16.2 → sphinx_codeautolink-0.17.1}/docs/src/release_notes.rst +29 -0
- sphinx_codeautolink-0.17.1/docs/src/static/custom.css +5 -0
- {sphinx_codeautolink-0.16.2 → sphinx_codeautolink-0.17.1}/pyproject.toml +2 -0
- {sphinx_codeautolink-0.16.2 → sphinx_codeautolink-0.17.1}/readme_pypi.rst +3 -4
- {sphinx_codeautolink-0.16.2 → sphinx_codeautolink-0.17.1}/src/sphinx_codeautolink/__init__.py +20 -1
- {sphinx_codeautolink-0.16.2 → sphinx_codeautolink-0.17.1}/src/sphinx_codeautolink/extension/__init__.py +15 -1
- {sphinx_codeautolink-0.16.2 → sphinx_codeautolink-0.17.1}/src/sphinx_codeautolink/extension/backref.py +16 -3
- {sphinx_codeautolink-0.16.2 → sphinx_codeautolink-0.17.1}/src/sphinx_codeautolink/extension/block.py +95 -23
- {sphinx_codeautolink-0.16.2 → sphinx_codeautolink-0.17.1}/src/sphinx_codeautolink/extension/directive.py +6 -3
- {sphinx_codeautolink-0.16.2 → sphinx_codeautolink-0.17.1}/src/sphinx_codeautolink/extension/resolve.py +2 -1
- sphinx_codeautolink-0.17.1/src/sphinx_codeautolink/extension/translation.py +6 -0
- sphinx_codeautolink-0.17.1/src/sphinx_codeautolink/locale/de/LC_MESSAGES/sphinx-codeautolink.mo +0 -0
- sphinx_codeautolink-0.17.1/src/sphinx_codeautolink/locale/de/LC_MESSAGES/sphinx-codeautolink.po +25 -0
- sphinx_codeautolink-0.17.1/src/sphinx_codeautolink/locale/es/LC_MESSAGES/sphinx-codeautolink.mo +0 -0
- sphinx_codeautolink-0.17.1/src/sphinx_codeautolink/locale/es/LC_MESSAGES/sphinx-codeautolink.po +25 -0
- sphinx_codeautolink-0.17.1/src/sphinx_codeautolink/locale/fi/LC_MESSAGES/sphinx-codeautolink.mo +0 -0
- sphinx_codeautolink-0.17.1/src/sphinx_codeautolink/locale/fi/LC_MESSAGES/sphinx-codeautolink.po +25 -0
- sphinx_codeautolink-0.17.1/src/sphinx_codeautolink/locale/it/LC_MESSAGES/sphinx-codeautolink.mo +0 -0
- sphinx_codeautolink-0.17.1/src/sphinx_codeautolink/locale/it/LC_MESSAGES/sphinx-codeautolink.po +25 -0
- sphinx_codeautolink-0.17.1/src/sphinx_codeautolink/locale/sphinx-codeautolink.pot +24 -0
- {sphinx_codeautolink-0.16.2 → sphinx_codeautolink-0.17.1}/src/sphinx_codeautolink/parse.py +150 -239
- sphinx_codeautolink-0.17.1/src/sphinx_codeautolink/static/sphinx-codeautolink.css +13 -0
- {sphinx_codeautolink-0.16.2 → sphinx_codeautolink-0.17.1/src/sphinx_codeautolink.egg-info}/PKG-INFO +4 -5
- {sphinx_codeautolink-0.16.2 → sphinx_codeautolink-0.17.1}/src/sphinx_codeautolink.egg-info/SOURCES.txt +41 -11
- {sphinx_codeautolink-0.16.2 → sphinx_codeautolink-0.17.1}/tests/extension/__init__.py +35 -2
- sphinx_codeautolink-0.17.1/tests/extension/fail/no_backreference.txt +9 -0
- sphinx_codeautolink-0.17.1/tests/extension/fail/preface_invalid_arg.txt +8 -0
- {sphinx_codeautolink-0.16.2 → sphinx_codeautolink-0.17.1}/tests/extension/fail/ref_invalid_block_type.txt +2 -2
- {sphinx_codeautolink-0.16.2 → sphinx_codeautolink-0.17.1}/tests/extension/fail/ref_invalid_syntax_complex.txt +3 -0
- sphinx_codeautolink-0.17.1/tests/extension/ref/class_mro_fix.txt +15 -0
- sphinx_codeautolink-0.17.1/tests/extension/ref/lexer_bazel.txt +13 -0
- sphinx_codeautolink-0.17.1/tests/extension/ref/lexer_default.txt +14 -0
- sphinx_codeautolink-0.17.1/tests/extension/ref/lexer_default_fail.txt +10 -0
- sphinx_codeautolink-0.17.1/tests/extension/ref/lexer_doctest_empty_input.txt +15 -0
- sphinx_codeautolink-0.17.1/tests/extension/ref/lexer_highlight_language.txt +12 -0
- sphinx_codeautolink-0.17.1/tests/extension/ref/lexer_highlight_none.txt +13 -0
- sphinx_codeautolink-0.17.1/tests/extension/ref/lexer_literal.txt +13 -0
- sphinx_codeautolink-0.16.2/tests/extension/ref/non_python_block.txt → sphinx_codeautolink-0.17.1/tests/extension/ref/lexer_non_python_block.txt +1 -1
- sphinx_codeautolink-0.17.1/tests/extension/ref/lexer_py3.txt +13 -0
- sphinx_codeautolink-0.17.1/tests/extension/ref/lexer_pycon_implicit.txt +24 -0
- sphinx_codeautolink-0.17.1/tests/extension/ref/lexer_pyi.txt +13 -0
- sphinx_codeautolink-0.17.1/tests/extension/ref/lexer_python3.txt +13 -0
- sphinx_codeautolink-0.17.1/tests/extension/ref/lexer_sage.txt +13 -0
- sphinx_codeautolink-0.17.1/tests/extension/ref/lexer_starlark.txt +13 -0
- {sphinx_codeautolink-0.16.2 → sphinx_codeautolink-0.17.1}/tests/extension/ref/preface_consumed_non_python.txt +1 -1
- sphinx_codeautolink-0.17.1/tests/extension/ref/preface_document.txt +26 -0
- {sphinx_codeautolink-0.16.2 → sphinx_codeautolink-0.17.1}/tests/extension/ref/skip_next_consumed_non_python.txt +1 -1
- sphinx_codeautolink-0.17.1/tests/extension/src/class_mro_fix.py +10 -0
- {sphinx_codeautolink-0.16.2 → sphinx_codeautolink-0.17.1}/tests/parse/__init__.py +6 -0
- {sphinx_codeautolink-0.16.2 → sphinx_codeautolink-0.17.1}/tests/parse/_util.py +5 -1
- {sphinx_codeautolink-0.16.2 → sphinx_codeautolink-0.17.1}/tests/parse/assign.py +18 -0
- {sphinx_codeautolink-0.16.2 → sphinx_codeautolink-0.17.1}/LICENSE +0 -0
- {sphinx_codeautolink-0.16.2 → sphinx_codeautolink-0.17.1}/docs/requirements.txt +0 -0
- {sphinx_codeautolink-0.16.2 → sphinx_codeautolink-0.17.1}/docs/src/404.rst +0 -0
- {sphinx_codeautolink-0.16.2 → sphinx_codeautolink-0.17.1}/docs/src/example_library.rst +0 -0
- {sphinx_codeautolink-0.16.2 → sphinx_codeautolink-0.17.1}/docs/src/lib.py +0 -0
- {sphinx_codeautolink-0.16.2 → sphinx_codeautolink-0.17.1}/requirements/build +0 -0
- {sphinx_codeautolink-0.16.2 → sphinx_codeautolink-0.17.1}/requirements/dev +0 -0
- {sphinx_codeautolink-0.16.2 → sphinx_codeautolink-0.17.1}/requirements/docs +0 -0
- {sphinx_codeautolink-0.16.2 → sphinx_codeautolink-0.17.1}/requirements/extras +0 -0
- {sphinx_codeautolink-0.16.2 → sphinx_codeautolink-0.17.1}/requirements/tests +0 -0
- {sphinx_codeautolink-0.16.2 → sphinx_codeautolink-0.17.1}/setup.cfg +0 -0
- {sphinx_codeautolink-0.16.2 → sphinx_codeautolink-0.17.1}/src/sphinx_codeautolink/extension/cache.py +0 -0
- {sphinx_codeautolink-0.16.2 → sphinx_codeautolink-0.17.1}/src/sphinx_codeautolink/warn.py +0 -0
- {sphinx_codeautolink-0.16.2 → sphinx_codeautolink-0.17.1}/src/sphinx_codeautolink.egg-info/dependency_links.txt +0 -0
- {sphinx_codeautolink-0.16.2 → sphinx_codeautolink-0.17.1}/src/sphinx_codeautolink.egg-info/requires.txt +0 -0
- {sphinx_codeautolink-0.16.2 → sphinx_codeautolink-0.17.1}/src/sphinx_codeautolink.egg-info/top_level.txt +0 -0
- {sphinx_codeautolink-0.16.2 → sphinx_codeautolink-0.17.1}/tests/__init__.py +0 -0
- {sphinx_codeautolink-0.16.2 → sphinx_codeautolink-0.17.1}/tests/extension/_check.py +0 -0
- {sphinx_codeautolink-0.16.2 → sphinx_codeautolink-0.17.1}/tests/extension/fail/concat_invalid.txt +0 -0
- {sphinx_codeautolink-0.16.2 → sphinx_codeautolink-0.17.1}/tests/extension/fail/custom_block_import_invalid.txt +0 -0
- {sphinx_codeautolink-0.16.2 → sphinx_codeautolink-0.17.1}/tests/extension/fail/custom_block_syntax_error.txt +0 -0
- {sphinx_codeautolink-0.16.2 → sphinx_codeautolink-0.17.1}/tests/extension/fail/failed_resolve_invalid_location.txt +0 -0
- {sphinx_codeautolink-0.16.2 → sphinx_codeautolink-0.17.1}/tests/extension/fail/failed_resolve_no_module.txt +0 -0
- {sphinx_codeautolink-0.16.2 → sphinx_codeautolink-0.17.1}/tests/extension/fail/failed_resolve_return_type.txt +0 -0
- {sphinx_codeautolink-0.16.2 → sphinx_codeautolink-0.17.1}/tests/extension/fail/match_block_warning.txt +0 -0
- {sphinx_codeautolink-0.16.2 → sphinx_codeautolink-0.17.1}/tests/extension/fail/missing_inventory.txt +0 -0
- {sphinx_codeautolink-0.16.2 → sphinx_codeautolink-0.17.1}/tests/extension/fail/no_module_docs.txt +0 -0
- {sphinx_codeautolink-0.16.2 → sphinx_codeautolink-0.17.1}/tests/extension/fail/ref_import_star_invalid.txt +0 -0
- {sphinx_codeautolink-0.16.2 → sphinx_codeautolink-0.17.1}/tests/extension/fail/ref_invalid_syntax.txt +0 -0
- {sphinx_codeautolink-0.16.2 → sphinx_codeautolink-0.17.1}/tests/extension/fail/ref_ipython_non-python.txt +0 -0
- {sphinx_codeautolink-0.16.2 → sphinx_codeautolink-0.17.1}/tests/extension/fail/skip_invalid.txt +0 -0
- {sphinx_codeautolink-0.16.2 → sphinx_codeautolink-0.17.1}/tests/extension/ref/concat_default.txt +0 -0
- {sphinx_codeautolink-0.16.2 → sphinx_codeautolink-0.17.1}/tests/extension/ref/concat_off.txt +0 -0
- {sphinx_codeautolink-0.16.2 → sphinx_codeautolink-0.17.1}/tests/extension/ref/concat_on_across_sections.txt +0 -0
- {sphinx_codeautolink-0.16.2 → sphinx_codeautolink-0.17.1}/tests/extension/ref/concat_on_breaks.txt +0 -0
- {sphinx_codeautolink-0.16.2 → sphinx_codeautolink-0.17.1}/tests/extension/ref/concat_section_breaks.txt +0 -0
- {sphinx_codeautolink-0.16.2 → sphinx_codeautolink-0.17.1}/tests/extension/ref/concat_section_returns_to_global.txt +0 -0
- {sphinx_codeautolink-0.16.2 → sphinx_codeautolink-0.17.1}/tests/extension/ref/custom_block.txt +0 -0
- {sphinx_codeautolink-0.16.2 → sphinx_codeautolink-0.17.1}/tests/extension/ref/custom_block_imported.txt +0 -0
- {sphinx_codeautolink-0.16.2 → sphinx_codeautolink-0.17.1}/tests/extension/ref/empty_project.txt +0 -0
- {sphinx_codeautolink-0.16.2 → sphinx_codeautolink-0.17.1}/tests/extension/ref/inventory_map_is_needed.txt +0 -0
- {sphinx_codeautolink-0.16.2 → sphinx_codeautolink-0.17.1}/tests/extension/ref/inventory_map_not_needed.txt +0 -0
- /sphinx_codeautolink-0.16.2/tests/extension/ref/ref_doctest.txt → /sphinx_codeautolink-0.17.1/tests/extension/ref/lexer_doctest.txt +0 -0
- /sphinx_codeautolink-0.16.2/tests/extension/ref/ref_extdoctest_doctest.txt → /sphinx_codeautolink-0.17.1/tests/extension/ref/lexer_extdoctest_doctest.txt +0 -0
- /sphinx_codeautolink-0.16.2/tests/extension/ref/ref_extdoctest_testcode.txt → /sphinx_codeautolink-0.17.1/tests/extension/ref/lexer_extdoctest_testcode.txt +0 -0
- /sphinx_codeautolink-0.16.2/tests/extension/ref/ref_ipython.txt → /sphinx_codeautolink-0.17.1/tests/extension/ref/lexer_ipython.txt +0 -0
- /sphinx_codeautolink-0.16.2/tests/extension/ref/ref_ipython3.txt → /sphinx_codeautolink-0.17.1/tests/extension/ref/lexer_ipython3.txt +0 -0
- /sphinx_codeautolink-0.16.2/tests/extension/ref/ref_ipython_directive.txt → /sphinx_codeautolink-0.17.1/tests/extension/ref/lexer_ipython_directive.txt +0 -0
- /sphinx_codeautolink-0.16.2/tests/extension/ref/ref_ipython_directive_comment.txt → /sphinx_codeautolink-0.17.1/tests/extension/ref/lexer_ipython_directive_comment.txt +0 -0
- /sphinx_codeautolink-0.16.2/tests/extension/ref/ref_ipython_syntax.txt → /sphinx_codeautolink-0.17.1/tests/extension/ref/lexer_ipython_syntax.txt +0 -0
- /sphinx_codeautolink-0.16.2/tests/extension/ref/ref_py.txt → /sphinx_codeautolink-0.17.1/tests/extension/ref/lexer_py.txt +0 -0
- /sphinx_codeautolink-0.16.2/tests/extension/ref/ref_pycon.txt → /sphinx_codeautolink-0.17.1/tests/extension/ref/lexer_pycon.txt +0 -0
- {sphinx_codeautolink-0.16.2 → sphinx_codeautolink-0.17.1}/tests/extension/ref/line_numbers.txt +0 -0
- {sphinx_codeautolink-0.16.2 → sphinx_codeautolink-0.17.1}/tests/extension/ref/preface_concatenated.txt +0 -0
- {sphinx_codeautolink-0.16.2 → sphinx_codeautolink-0.17.1}/tests/extension/ref/preface_global.txt +0 -0
- {sphinx_codeautolink-0.16.2 → sphinx_codeautolink-0.17.1}/tests/extension/ref/preface_global_multiline.txt +0 -0
- {sphinx_codeautolink-0.16.2 → sphinx_codeautolink-0.17.1}/tests/extension/ref/preface_global_overwritten.txt +0 -0
- {sphinx_codeautolink-0.16.2 → sphinx_codeautolink-0.17.1}/tests/extension/ref/preface_multiline.txt +0 -0
- {sphinx_codeautolink-0.16.2 → sphinx_codeautolink-0.17.1}/tests/extension/ref/preface_multiline_and_arg.txt +0 -0
- {sphinx_codeautolink-0.16.2 → sphinx_codeautolink-0.17.1}/tests/extension/ref/preface_multiple.txt +0 -0
- {sphinx_codeautolink-0.16.2 → sphinx_codeautolink-0.17.1}/tests/extension/ref/preface_single.txt +0 -0
- {sphinx_codeautolink-0.16.2 → sphinx_codeautolink-0.17.1}/tests/extension/ref/ref_assign_targets.txt +0 -0
- {sphinx_codeautolink-0.16.2 → sphinx_codeautolink-0.17.1}/tests/extension/ref/ref_builtins.txt +0 -0
- {sphinx_codeautolink-0.16.2 → sphinx_codeautolink-0.17.1}/tests/extension/ref/ref_chain.txt +0 -0
- {sphinx_codeautolink-0.16.2 → sphinx_codeautolink-0.17.1}/tests/extension/ref/ref_chain_call.txt +0 -0
- {sphinx_codeautolink-0.16.2 → sphinx_codeautolink-0.17.1}/tests/extension/ref/ref_class_attr.txt +0 -0
- {sphinx_codeautolink-0.16.2 → sphinx_codeautolink-0.17.1}/tests/extension/ref/ref_class_meth_returns_self.txt +0 -0
- {sphinx_codeautolink-0.16.2 → sphinx_codeautolink-0.17.1}/tests/extension/ref/ref_class_type_attr.txt +0 -0
- {sphinx_codeautolink-0.16.2 → sphinx_codeautolink-0.17.1}/tests/extension/ref/ref_decorator.txt +0 -0
- {sphinx_codeautolink-0.16.2 → sphinx_codeautolink-0.17.1}/tests/extension/ref/ref_fluent_attrs.txt +0 -0
- {sphinx_codeautolink-0.16.2 → sphinx_codeautolink-0.17.1}/tests/extension/ref/ref_fluent_call.txt +0 -0
- {sphinx_codeautolink-0.16.2 → sphinx_codeautolink-0.17.1}/tests/extension/ref/ref_func_args.txt +0 -0
- {sphinx_codeautolink-0.16.2 → sphinx_codeautolink-0.17.1}/tests/extension/ref/ref_func_no_module.txt +0 -0
- {sphinx_codeautolink-0.16.2 → sphinx_codeautolink-0.17.1}/tests/extension/ref/ref_import_as.txt +0 -0
- {sphinx_codeautolink-0.16.2 → sphinx_codeautolink-0.17.1}/tests/extension/ref/ref_import_from.txt +0 -0
- {sphinx_codeautolink-0.16.2 → sphinx_codeautolink-0.17.1}/tests/extension/ref/ref_import_from_complex.txt +0 -0
- {sphinx_codeautolink-0.16.2 → sphinx_codeautolink-0.17.1}/tests/extension/ref/ref_import_multiple.txt +0 -0
- {sphinx_codeautolink-0.16.2 → sphinx_codeautolink-0.17.1}/tests/extension/ref/ref_import_multiple_libs.txt +0 -0
- {sphinx_codeautolink-0.16.2 → sphinx_codeautolink-0.17.1}/tests/extension/ref/ref_import_star.txt +0 -0
- {sphinx_codeautolink-0.16.2 → sphinx_codeautolink-0.17.1}/tests/extension/ref/ref_import_submodule.txt +0 -0
- {sphinx_codeautolink-0.16.2 → sphinx_codeautolink-0.17.1}/tests/extension/ref/ref_imported_func.txt +0 -0
- {sphinx_codeautolink-0.16.2 → sphinx_codeautolink-0.17.1}/tests/extension/ref/ref_imported_func_relocated.txt +0 -0
- {sphinx_codeautolink-0.16.2 → sphinx_codeautolink-0.17.1}/tests/extension/ref/ref_inherited.txt +0 -0
- {sphinx_codeautolink-0.16.2 → sphinx_codeautolink-0.17.1}/tests/extension/ref/ref_intersphinx_only.txt +0 -0
- {sphinx_codeautolink-0.16.2 → sphinx_codeautolink-0.17.1}/tests/extension/ref/ref_invalid_func.txt +0 -0
- {sphinx_codeautolink-0.16.2 → sphinx_codeautolink-0.17.1}/tests/extension/ref/ref_invalid_typehint.txt +0 -0
- {sphinx_codeautolink-0.16.2 → sphinx_codeautolink-0.17.1}/tests/extension/ref/ref_optional.txt +0 -0
- {sphinx_codeautolink-0.16.2 → sphinx_codeautolink-0.17.1}/tests/extension/ref/ref_optional_future.txt +0 -0
- {sphinx_codeautolink-0.16.2 → sphinx_codeautolink-0.17.1}/tests/extension/ref/ref_shadow_builtin.txt +0 -0
- {sphinx_codeautolink-0.16.2 → sphinx_codeautolink-0.17.1}/tests/extension/ref/ref_simple.txt +0 -0
- {sphinx_codeautolink-0.16.2 → sphinx_codeautolink-0.17.1}/tests/extension/ref/search_css_duplicates_removed.txt +0 -0
- {sphinx_codeautolink-0.16.2 → sphinx_codeautolink-0.17.1}/tests/extension/ref/skip_file.txt +0 -0
- {sphinx_codeautolink-0.16.2 → sphinx_codeautolink-0.17.1}/tests/extension/ref/skip_next.txt +0 -0
- {sphinx_codeautolink-0.16.2 → sphinx_codeautolink-0.17.1}/tests/extension/ref/skip_off.txt +0 -0
- {sphinx_codeautolink-0.16.2 → sphinx_codeautolink-0.17.1}/tests/extension/ref/skip_section.txt +0 -0
- {sphinx_codeautolink-0.16.2 → sphinx_codeautolink-0.17.1}/tests/extension/src/future_project.py +0 -0
- {sphinx_codeautolink-0.16.2 → sphinx_codeautolink-0.17.1}/tests/extension/src/parser_func.py +0 -0
- {sphinx_codeautolink-0.16.2 → sphinx_codeautolink-0.17.1}/tests/extension/src/test_project/__init__.py +0 -0
- {sphinx_codeautolink-0.16.2 → sphinx_codeautolink-0.17.1}/tests/extension/src/test_project/sub.py +0 -0
- {sphinx_codeautolink-0.16.2 → sphinx_codeautolink-0.17.1}/tests/extension/table/tab_autodoc_empty.txt +0 -0
- {sphinx_codeautolink-0.16.2 → sphinx_codeautolink-0.17.1}/tests/extension/table/tab_autodoc_links.txt +0 -0
- {sphinx_codeautolink-0.16.2 → sphinx_codeautolink-0.17.1}/tests/extension/table/tab_manual_collapse.txt +0 -0
- {sphinx_codeautolink-0.16.2 → sphinx_codeautolink-0.17.1}/tests/extension/table/tab_manual_empty.txt +0 -0
- {sphinx_codeautolink-0.16.2 → sphinx_codeautolink-0.17.1}/tests/extension/table/tab_manual_links.txt +0 -0
- {sphinx_codeautolink-0.16.2 → sphinx_codeautolink-0.17.1}/tests/extension/table/tab_manual_links_subsection.txt +0 -0
- {sphinx_codeautolink-0.16.2 → sphinx_codeautolink-0.17.1}/tests/extension/table/tab_no_table.txt +0 -0
- {sphinx_codeautolink-0.16.2 → sphinx_codeautolink-0.17.1}/tests/parse/chain.py +0 -0
- {sphinx_codeautolink-0.16.2 → sphinx_codeautolink-0.17.1}/tests/parse/match.py +0 -0
- {sphinx_codeautolink-0.16.2 → sphinx_codeautolink-0.17.1}/tests/parse/scope.py +0 -0
- {sphinx_codeautolink-0.16.2 → sphinx_codeautolink-0.17.1}/tox.ini +0 -0
{sphinx_codeautolink-0.16.2/src/sphinx_codeautolink.egg-info → sphinx_codeautolink-0.17.1}/PKG-INFO
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.2
|
|
2
2
|
Name: sphinx-codeautolink
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.17.1
|
|
4
4
|
Summary: Automatic links from code examples to reference documentation.
|
|
5
5
|
Author-email: Felix Hildén <felix.hilden@gmail.com>
|
|
6
6
|
Maintainer-email: Felix Hildén <felix.hilden@gmail.com>
|
|
@@ -70,7 +70,6 @@ sphinx-codeautolink can be installed from the following sources:
|
|
|
70
70
|
.. code:: sh
|
|
71
71
|
|
|
72
72
|
$ pip install sphinx-codeautolink
|
|
73
|
-
# or, alternatively:
|
|
74
73
|
$ conda install -c conda-forge sphinx-codeautolink
|
|
75
74
|
|
|
76
75
|
Note that the library is in early development, so version pinning is advised.
|
|
@@ -85,9 +84,9 @@ Note that the extension name uses an underscore rather than a hyphen.
|
|
|
85
84
|
]
|
|
86
85
|
|
|
87
86
|
That's it! Now your code examples are linked.
|
|
88
|
-
For ways of concatenating
|
|
89
|
-
|
|
90
|
-
|
|
87
|
+
For ways of concatenating examples, setting default import statements,
|
|
88
|
+
or customising link style among other things,
|
|
89
|
+
see the `online documentation <https://sphinx-codeautolink.rtfd.org>`_.
|
|
91
90
|
|
|
92
91
|
.. |pyversions| image:: https://img.shields.io/pypi/pyversions/sphinx-codeautolink
|
|
93
92
|
:alt: Python versions
|
|
@@ -85,6 +85,18 @@ upload manually to `TestPyPI <https://test.pypi.org>`_ instead.
|
|
|
85
85
|
$ twine upload --repository testpypi dist/*
|
|
86
86
|
$ pip install --index-url https://test.pypi.org/simple/ sphinx-codeautolink
|
|
87
87
|
|
|
88
|
+
Translations
|
|
89
|
+
------------
|
|
90
|
+
You are also welcome to contribute translations!
|
|
91
|
+
Use the following Babel commands to add new translations and locales.
|
|
92
|
+
|
|
93
|
+
.. code:: sh
|
|
94
|
+
|
|
95
|
+
$ cd src/sphinx_codeautolink
|
|
96
|
+
$ pybabel init --input-file=locale/sphinx-codeautolink.pot --domain=sphinx-codeautolink --output-dir=locale --locale=fi_FI
|
|
97
|
+
$ pybabel update --input-file=locale/sphinx-codeautolink.pot --domain=sphinx-codeautolink --output-dir=locale
|
|
98
|
+
$ pybabel compile --directory=locale --domain=sphinx-codeautolink
|
|
99
|
+
|
|
88
100
|
.. |issue_resolution| image:: http://isitmaintained.com/badge/resolution/felix-hilden/sphinx-codeautolink.svg
|
|
89
101
|
:target: https://isitmaintained.com/project/felix-hilden/sphinx-codeautolink
|
|
90
102
|
:alt: issue resolution time
|
|
@@ -18,7 +18,7 @@ Caveats
|
|
|
18
18
|
-------
|
|
19
19
|
- **Only works with HTML documentation**, disabled otherwise. If the extension
|
|
20
20
|
is off, it silently removes directives that would produce output.
|
|
21
|
-
- **Only processes
|
|
21
|
+
- **Only processes blocks, not inline code**. Sphinx has great tools
|
|
22
22
|
for linking definitions inline, and longer code should be in a block anyway.
|
|
23
23
|
- **Doesn't run example code**. Therefore all possible resolvable types are not
|
|
24
24
|
found, and the runtime correctness of code cannot be validated.
|
|
@@ -21,10 +21,16 @@ be analysed and linked to known reference documentation entries.
|
|
|
21
21
|
|
|
22
22
|
Different import styles are supported, along with all Python syntax.
|
|
23
23
|
Star imports might be particularly handy in code examples.
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
24
|
+
|
|
25
|
+
A number of other types of blocks are also supported
|
|
26
|
+
along with standard Sphinx configuration, like:
|
|
27
|
+
|
|
28
|
+
- Literal blocks, the ``.. highlight::`` directive
|
|
29
|
+
and ``highlight_language`` configuration
|
|
30
|
+
- `Doctest blocks <https://docutils.sourceforge.io/docs/ref/rst/restructuredtext.html#doctest-blocks>`_
|
|
31
|
+
- Console blocks using :code:`.. code:: pycon`
|
|
32
|
+
- Including code via :rst:dir:`literalinclude`, but requires using one of the
|
|
33
|
+
`Python Lexers <https://pygments.org/docs/lexers/#pygments.lexers.python.PythonLexer>`_
|
|
28
34
|
|
|
29
35
|
.. code:: pycon
|
|
30
36
|
|
|
@@ -39,7 +45,9 @@ particularly in the reference documentation itself:
|
|
|
39
45
|
|
|
40
46
|
.. autolink-examples:: lib.Knight
|
|
41
47
|
|
|
42
|
-
Such a table is generated with :rst:dir:`autolink-examples
|
|
48
|
+
Such a table is generated with :rst:dir:`autolink-examples`:
|
|
49
|
+
|
|
50
|
+
.. code-block:: rst
|
|
43
51
|
|
|
44
52
|
.. autolink-examples:: lib.Knight
|
|
45
53
|
|
|
@@ -54,14 +62,18 @@ The import can be hidden instead.
|
|
|
54
62
|
|
|
55
63
|
lib.Knight().taunt()
|
|
56
64
|
|
|
57
|
-
The previous block is produced with :rst:dir:`autolink-preface
|
|
65
|
+
The previous block is produced with :rst:dir:`autolink-preface`:
|
|
66
|
+
|
|
67
|
+
.. code-block:: rst
|
|
58
68
|
|
|
59
69
|
.. autolink-preface:: import lib
|
|
60
70
|
.. code:: python
|
|
61
71
|
|
|
62
72
|
lib.Knight().taunt()
|
|
63
73
|
|
|
64
|
-
A multiline preface can be written in the content portion of the directive
|
|
74
|
+
A multiline preface can be written in the content portion of the directive:
|
|
75
|
+
|
|
76
|
+
.. code-block:: rst
|
|
65
77
|
|
|
66
78
|
.. autolink-preface::
|
|
67
79
|
|
|
@@ -90,7 +102,9 @@ the previous left off.
|
|
|
90
102
|
print(knight.taunt())
|
|
91
103
|
knight.scratch()
|
|
92
104
|
|
|
93
|
-
This was achieved with :rst:dir:`autolink-concat
|
|
105
|
+
This was achieved with :rst:dir:`autolink-concat`:
|
|
106
|
+
|
|
107
|
+
.. code-block:: rst
|
|
94
108
|
|
|
95
109
|
.. autolink-concat:: section
|
|
96
110
|
.. code:: python
|
|
@@ -118,7 +132,9 @@ and preventing it from being included in further sources with concatenation.
|
|
|
118
132
|
import lib
|
|
119
133
|
lib.Knight()
|
|
120
134
|
|
|
121
|
-
Which is done via :rst:dir:`autolink-skip
|
|
135
|
+
Which is done via :rst:dir:`autolink-skip`:
|
|
136
|
+
|
|
137
|
+
.. code-block:: rst
|
|
122
138
|
|
|
123
139
|
.. autolink-skip::
|
|
124
140
|
.. code:: python
|
|
@@ -190,7 +206,9 @@ Reference tables across intersphinx work too:
|
|
|
190
206
|
It seems that the reference type information is more important
|
|
191
207
|
for Sphinx when dealing with external modules,
|
|
192
208
|
likely because the references cannot be resolved dynamically.
|
|
193
|
-
Please specify a ``type`` in :rst:dir:`autolink-examples
|
|
209
|
+
Please specify a ``type`` in :rst:dir:`autolink-examples`:
|
|
210
|
+
|
|
211
|
+
.. code-block:: rst
|
|
194
212
|
|
|
195
213
|
.. autolink-examples:: numpy.linspace
|
|
196
214
|
:type: func
|
|
@@ -294,12 +312,12 @@ For example, a transformer could be implemented as follows:
|
|
|
294
312
|
Sometimes links with third-party code blocks are broken.
|
|
295
313
|
See :ref:`about` for a potential solution.
|
|
296
314
|
|
|
315
|
+
.. _examples-css:
|
|
316
|
+
|
|
297
317
|
Custom link styles
|
|
298
318
|
------------------
|
|
299
319
|
If you want a specific style to be applied to code block links,
|
|
300
320
|
you may add your own CSS file to the Sphinx build.
|
|
301
|
-
All code block links use the ``sphinx-codeautolink-a`` class.
|
|
302
|
-
For example, you can add dotted lines to all links and change the hover colour:
|
|
303
321
|
|
|
304
322
|
.. code:: python
|
|
305
323
|
|
|
@@ -307,12 +325,17 @@ For example, you can add dotted lines to all links and change the hover colour:
|
|
|
307
325
|
html_static_path = ['static']
|
|
308
326
|
html_css_files = ['custom.css']
|
|
309
327
|
|
|
328
|
+
To include only in specific documents, see the ``html-page-context`` event
|
|
329
|
+
and the :meth:`Sphinx.add_css_file` function.
|
|
330
|
+
For example, you can add similar underlines as this documentation
|
|
331
|
+
and change the hover colour:
|
|
332
|
+
|
|
310
333
|
.. code:: css
|
|
311
334
|
|
|
312
335
|
/* static/custom.css */
|
|
313
336
|
.sphinx-codeautolink-a{
|
|
314
|
-
border-bottom-color:
|
|
315
|
-
border-bottom-style:
|
|
337
|
+
border-bottom-color: #ccc;
|
|
338
|
+
border-bottom-style: solid;
|
|
316
339
|
border-bottom-width: 1px;
|
|
317
340
|
}
|
|
318
341
|
.sphinx-codeautolink-a:hover{
|
|
@@ -5,7 +5,7 @@ sphinx-codeautolink
|
|
|
5
5
|
sphinx-codeautolink makes code examples clickable by inserting links
|
|
6
6
|
from individual code elements to the corresponding reference documentation.
|
|
7
7
|
We aim for a minimal setup assuming your examples are already valid Python.
|
|
8
|
-
Click any
|
|
8
|
+
Click any undelined name in the example below for a demonstration:
|
|
9
9
|
|
|
10
10
|
.. code:: python
|
|
11
11
|
|
|
@@ -42,7 +42,6 @@ sphinx-codeautolink can be installed from the following sources:
|
|
|
42
42
|
.. code:: sh
|
|
43
43
|
|
|
44
44
|
$ pip install sphinx-codeautolink
|
|
45
|
-
# or, alternatively:
|
|
46
45
|
$ conda install -c conda-forge sphinx-codeautolink
|
|
47
46
|
|
|
48
47
|
To enable sphinx-codeautolink, modify the extension list in ``conf.py``.
|
|
@@ -56,8 +55,8 @@ Note that the extension name uses an underscore rather than a hyphen.
|
|
|
56
55
|
]
|
|
57
56
|
|
|
58
57
|
That's it! Now your code examples are linked.
|
|
59
|
-
For ways of concatenating
|
|
60
|
-
|
|
58
|
+
For ways of concatenating examples, setting default import statements,
|
|
59
|
+
or customising link style among other things,
|
|
61
60
|
have a look at the :ref:`reference` documentation.
|
|
62
61
|
|
|
63
62
|
sphinx-codeautolink elsewhere:
|
|
@@ -70,7 +69,7 @@ Caveats
|
|
|
70
69
|
For a more thorough explanation, see :ref:`about`.
|
|
71
70
|
|
|
72
71
|
- Only works with HTML documentation
|
|
73
|
-
- Only processes
|
|
72
|
+
- Only processes blocks, not inline code
|
|
74
73
|
- Doesn't run example code
|
|
75
74
|
- Parsing and type hint resolving is incomplete
|
|
76
75
|
|
|
@@ -14,12 +14,12 @@ Configuration
|
|
|
14
14
|
-------------
|
|
15
15
|
.. confval:: codeautolink_autodoc_inject
|
|
16
16
|
|
|
17
|
-
Type: ``bool``. Inject
|
|
17
|
+
Type: ``bool``. Inject an :rst:dir:`autolink-examples` table
|
|
18
18
|
to the end of all autodoc definitions. Defaults to :code:`False`.
|
|
19
19
|
|
|
20
20
|
.. confval:: codeautolink_global_preface
|
|
21
21
|
|
|
22
|
-
Type: ``str``. Include
|
|
22
|
+
Type: ``str``. Include an :rst:dir:`autolink-preface` before all blocks.
|
|
23
23
|
When other prefaces or concatenated sources are used in a block,
|
|
24
24
|
the global preface is included first and only once.
|
|
25
25
|
|
|
@@ -57,14 +57,27 @@ Configuration
|
|
|
57
57
|
|
|
58
58
|
.. confval:: codeautolink_warn_on_missing_inventory
|
|
59
59
|
|
|
60
|
-
Type: ``bool``.
|
|
60
|
+
Type: ``bool``. Warn when an object cannot be found in
|
|
61
61
|
the inventory (autodoc or intersphinx). Defaults to :code:`False`.
|
|
62
62
|
|
|
63
63
|
.. confval:: codeautolink_warn_on_failed_resolve
|
|
64
64
|
|
|
65
|
-
Type: ``bool``.
|
|
65
|
+
Type: ``bool``. Warn when failing to resolve the canonical location
|
|
66
66
|
of an object that a code element references. Defaults to :code:`False`.
|
|
67
67
|
|
|
68
|
+
.. confval:: codeautolink_warn_on_no_backreference
|
|
69
|
+
|
|
70
|
+
Type: ``bool``. Warn when no backreference could be found
|
|
71
|
+
from reference documentation using the :rst:dir:`autolink-examples` table.
|
|
72
|
+
This highlights objects for which no tutorial, example or how-to exists.
|
|
73
|
+
Defaults to :code:`False`.
|
|
74
|
+
|
|
75
|
+
.. confval:: codeautolink_warn_on_default_parse_fail
|
|
76
|
+
|
|
77
|
+
Type: ``bool``. Warn when a code block using the ``default`` lexer
|
|
78
|
+
cannot be parsed as Python. By default these cases are ignored by the
|
|
79
|
+
syntax highlighter, so we match the behavior. Defaults to :code:`False`.
|
|
80
|
+
|
|
68
81
|
Directives
|
|
69
82
|
----------
|
|
70
83
|
.. rst:directive:: .. autolink-examples:: object
|
|
@@ -89,7 +102,7 @@ Directives
|
|
|
89
102
|
|
|
90
103
|
.. rst:directive:: .. autolink-concat:: [mode]
|
|
91
104
|
|
|
92
|
-
Toggle
|
|
105
|
+
Toggle block concatenation.
|
|
93
106
|
Concatenated code blocks are treated as a continuous source,
|
|
94
107
|
so that imports and statements in previous blocks affect later blocks.
|
|
95
108
|
Concatenation is begun at the directive, not applied retroactively.
|
|
@@ -104,18 +117,32 @@ Directives
|
|
|
104
117
|
|
|
105
118
|
.. rst:directive:: .. autolink-preface:: [code]
|
|
106
119
|
|
|
107
|
-
Include a hidden preface
|
|
108
|
-
The next block consumes this directive even if it is not
|
|
109
|
-
processed (e.g. non-Python blocks) to avoid placement confusion.
|
|
120
|
+
Include a hidden preface before a code block.
|
|
110
121
|
A multiline preface can be written in the content portion of the directive.
|
|
111
|
-
Prefaces are
|
|
122
|
+
Prefaces are preserved in block concatenation, and are added to the source
|
|
123
|
+
in the following order: :confval:`codeautolink_global_preface` > file preface
|
|
124
|
+
> :rst:dir:`autolink-concat` sources (with their block prefaces)
|
|
125
|
+
> block prefaces > block source.
|
|
126
|
+
|
|
127
|
+
.. rubric:: Options
|
|
128
|
+
|
|
129
|
+
.. rst:directive:option:: level
|
|
130
|
+
:type: preface level
|
|
131
|
+
|
|
132
|
+
- "next" - add preface only to the next block (default).
|
|
133
|
+
Multiple prefaces are combined, and the next block consumes this
|
|
134
|
+
directive even if it's not processed (e.g. non-Python blocks)
|
|
135
|
+
to avoid placement confusion.
|
|
136
|
+
- "file" - set a preface for all blocks in the current file, placed
|
|
137
|
+
after but before block-level
|
|
138
|
+
prefaces.
|
|
112
139
|
|
|
113
140
|
.. rst:directive:: .. autolink-skip:: [level]
|
|
114
141
|
|
|
115
142
|
Skip sphinx-codeautolink functionality.
|
|
116
143
|
``level``, if specified, must be one of:
|
|
117
144
|
|
|
118
|
-
- "next" - next block (default)
|
|
145
|
+
- "next" - next encountered block (default)
|
|
119
146
|
- "section" - blocks until the next title
|
|
120
147
|
- "file" - all blocks in the current file
|
|
121
148
|
- "off" - turn skipping off
|
|
@@ -124,10 +151,16 @@ Directives
|
|
|
124
151
|
it is not processed (e.g. non-Python blocks) to avoid placement confusion.
|
|
125
152
|
Skipped blocks are ignored in block concatenation as well, and concatenation
|
|
126
153
|
is resumed without breaks after skipping is over.
|
|
154
|
+
"Next" doesn't need to be specified right before the block that would consume
|
|
155
|
+
it. For e.g. literal blocks the skip directive would be inserted before the
|
|
156
|
+
preceding paragraph.
|
|
127
157
|
|
|
128
158
|
CSS class
|
|
129
159
|
---------
|
|
130
160
|
The CSS class used in all code block links is ``sphinx-codeautolink-a``.
|
|
161
|
+
By default, the links only have a light blue hover colour.
|
|
162
|
+
The style has been made more obvious in the documentation for demonstration.
|
|
163
|
+
See :ref:`examples-css` for more information.
|
|
131
164
|
|
|
132
165
|
Cleanup functions
|
|
133
166
|
-----------------
|
|
@@ -8,6 +8,35 @@ These release notes are based on
|
|
|
8
8
|
sphinx-codeautolink adheres to
|
|
9
9
|
`Semantic Versioning <https://semver.org>`_.
|
|
10
10
|
|
|
11
|
+
0.17.1 (2025-02-24)
|
|
12
|
+
-------------------
|
|
13
|
+
- Add translations via i18n (:issue:`164`)
|
|
14
|
+
- Fix attribute and call after walrus leading parser error (:issue:`174`)
|
|
15
|
+
- Fix parsing error in doctest blocks with empty lines (:issue:`176`)
|
|
16
|
+
- Improve error message on uncaught parsing errors (:issue:`177`)
|
|
17
|
+
- Add ``level`` argument to :rst:dir:`autolink-preface` to support
|
|
18
|
+
file-level prefaces (:issue:`180`)
|
|
19
|
+
|
|
20
|
+
0.17.0 (2025-02-18)
|
|
21
|
+
-------------------
|
|
22
|
+
Added
|
|
23
|
+
*****
|
|
24
|
+
- Add more Pygments lexer aliases in code blocks (:issue:`160`)
|
|
25
|
+
- Introduce :confval:`codeautolink_warn_on_no_backreference` to highlight
|
|
26
|
+
where reference documentation does not appear to have
|
|
27
|
+
a corresponding tutorial or how-to (:issue:`161`)
|
|
28
|
+
- Support the ``default`` lexer, literal blocks, ``.. highlight::`` directive
|
|
29
|
+
and ``highlight_language`` configuration (:issue:`166`)
|
|
30
|
+
- Add :confval:`codeautolink_warn_on_default_parse_fail` to warn about
|
|
31
|
+
failing to link code blocks without a language parameter (:issue:`166`)
|
|
32
|
+
- Detect and implicitly use ``pycon`` lexer for blocks that look like
|
|
33
|
+
console code (:issue:`168`)
|
|
34
|
+
|
|
35
|
+
Fixed
|
|
36
|
+
*****
|
|
37
|
+
- Fix undocumented class attribute leading to a crash (:issue:`165`)
|
|
38
|
+
- Fix skipping blocks with identical content to linked ones (:issue:`172`)
|
|
39
|
+
|
|
11
40
|
0.16.2 (2025-01-16)
|
|
12
41
|
-------------------
|
|
13
42
|
- Fix regression in not handling malformed return types (:issue:`159`)
|
|
@@ -75,6 +75,7 @@ extend-ignore = [
|
|
|
75
75
|
"COM812", # recommended by ruff format
|
|
76
76
|
"ISC001", # recommended by ruff format
|
|
77
77
|
"PLR0913", # many arguments is fine
|
|
78
|
+
"PLR0915", # many statements is fine
|
|
78
79
|
]
|
|
79
80
|
extend-unsafe-fixes = ["F401"]
|
|
80
81
|
isort.split-on-trailing-comma = false
|
|
@@ -88,6 +89,7 @@ isort.split-on-trailing-comma = false
|
|
|
88
89
|
"ANN", # annotations
|
|
89
90
|
"S101", # assertions - necessary in tests
|
|
90
91
|
"T201", # print - helpful in tests
|
|
92
|
+
"PLR2004", # magic number
|
|
91
93
|
]
|
|
92
94
|
# TODO: support future annotated hints properly
|
|
93
95
|
"tests/extension/src/test_project/__init__.py" = ["FA100"]
|
|
@@ -16,7 +16,6 @@ sphinx-codeautolink can be installed from the following sources:
|
|
|
16
16
|
.. code:: sh
|
|
17
17
|
|
|
18
18
|
$ pip install sphinx-codeautolink
|
|
19
|
-
# or, alternatively:
|
|
20
19
|
$ conda install -c conda-forge sphinx-codeautolink
|
|
21
20
|
|
|
22
21
|
Note that the library is in early development, so version pinning is advised.
|
|
@@ -31,9 +30,9 @@ Note that the extension name uses an underscore rather than a hyphen.
|
|
|
31
30
|
]
|
|
32
31
|
|
|
33
32
|
That's it! Now your code examples are linked.
|
|
34
|
-
For ways of concatenating
|
|
35
|
-
|
|
36
|
-
|
|
33
|
+
For ways of concatenating examples, setting default import statements,
|
|
34
|
+
or customising link style among other things,
|
|
35
|
+
see the `online documentation <https://sphinx-codeautolink.rtfd.org>`_.
|
|
37
36
|
|
|
38
37
|
.. |pyversions| image:: https://img.shields.io/pypi/pyversions/sphinx-codeautolink
|
|
39
38
|
:alt: Python versions
|
{sphinx_codeautolink-0.16.2 → sphinx_codeautolink-0.17.1}/src/sphinx_codeautolink/__init__.py
RENAMED
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
"""Sphinx extension for linking code examples to reference documentation."""
|
|
2
2
|
|
|
3
|
+
from pathlib import Path
|
|
4
|
+
|
|
3
5
|
from sphinx.application import Sphinx
|
|
4
6
|
|
|
5
7
|
from .extension import SphinxCodeAutoLink, backref, directive
|
|
6
8
|
from .extension.block import clean_ipython, clean_pycon
|
|
9
|
+
from .extension.translation import MESSAGE_CATALOG_NAME
|
|
7
10
|
|
|
8
|
-
__version__ = "0.
|
|
11
|
+
__version__ = "0.17.1"
|
|
9
12
|
|
|
10
13
|
|
|
11
14
|
def setup(app: Sphinx):
|
|
@@ -43,6 +46,18 @@ def setup(app: Sphinx):
|
|
|
43
46
|
rebuild="html",
|
|
44
47
|
types=[bool],
|
|
45
48
|
)
|
|
49
|
+
app.add_config_value(
|
|
50
|
+
"codeautolink_warn_on_no_backreference",
|
|
51
|
+
default=False,
|
|
52
|
+
rebuild="html",
|
|
53
|
+
types=[bool],
|
|
54
|
+
)
|
|
55
|
+
app.add_config_value(
|
|
56
|
+
"codeautolink_warn_on_default_parse_fail",
|
|
57
|
+
default=False,
|
|
58
|
+
rebuild="html",
|
|
59
|
+
types=[bool],
|
|
60
|
+
)
|
|
46
61
|
|
|
47
62
|
app.add_directive("autolink-concat", directive.Concat)
|
|
48
63
|
app.add_directive("autolink-examples", directive.Examples)
|
|
@@ -64,4 +79,8 @@ def setup(app: Sphinx):
|
|
|
64
79
|
app.add_node(
|
|
65
80
|
backref.SummaryNode, html=(backref.visit_summary, backref.depart_summary)
|
|
66
81
|
)
|
|
82
|
+
|
|
83
|
+
locale_dir = Path(__file__).resolve().parent / "locale"
|
|
84
|
+
app.add_message_catalog(MESSAGE_CATALOG_NAME, locale_dir)
|
|
85
|
+
|
|
67
86
|
return {"version": __version__, "env_version": 1, "parallel_read_safe": True}
|
|
@@ -74,6 +74,9 @@ class SphinxCodeAutoLink:
|
|
|
74
74
|
self.inventory_map: dict[str, str] = {}
|
|
75
75
|
self.warn_missing_inventory = None
|
|
76
76
|
self.warn_failed_resolve = None
|
|
77
|
+
self.warn_no_backreference = None
|
|
78
|
+
self.warn_default_parse_fail = None
|
|
79
|
+
self.highlight_lang = None
|
|
77
80
|
|
|
78
81
|
# Populated once
|
|
79
82
|
self.outdated_docs: set[str] = set()
|
|
@@ -103,6 +106,11 @@ class SphinxCodeAutoLink:
|
|
|
103
106
|
self.inventory_map = app.config.codeautolink_inventory_map
|
|
104
107
|
self.warn_missing_inventory = app.config.codeautolink_warn_on_missing_inventory
|
|
105
108
|
self.warn_failed_resolve = app.config.codeautolink_warn_on_failed_resolve
|
|
109
|
+
self.warn_no_backreference = app.config.codeautolink_warn_on_no_backreference
|
|
110
|
+
self.warn_default_parse_fail = (
|
|
111
|
+
app.config.codeautolink_warn_on_default_parse_fail
|
|
112
|
+
)
|
|
113
|
+
self.highlight_lang = app.config.highlight_language
|
|
106
114
|
|
|
107
115
|
# Append static resources path so references in setup() are valid
|
|
108
116
|
app.config.html_static_path.append(
|
|
@@ -136,6 +144,8 @@ class SphinxCodeAutoLink:
|
|
|
136
144
|
global_preface=self.global_preface,
|
|
137
145
|
custom_blocks=self.custom_blocks,
|
|
138
146
|
concat_default=self.concat_default,
|
|
147
|
+
default_highlight_lang=self.highlight_lang,
|
|
148
|
+
warn_default_parse_fail=self.warn_default_parse_fail,
|
|
139
149
|
)
|
|
140
150
|
doctree.walkabout(visitor)
|
|
141
151
|
self.cache.transforms[visitor.current_document] = visitor.source_transforms
|
|
@@ -255,7 +265,11 @@ class SphinxCodeAutoLink:
|
|
|
255
265
|
rm_vis = RemoveExtensionVisitor(doctree)
|
|
256
266
|
return doctree.walkabout(rm_vis)
|
|
257
267
|
|
|
258
|
-
visitor = CodeRefsVisitor(
|
|
268
|
+
visitor = CodeRefsVisitor(
|
|
269
|
+
doctree,
|
|
270
|
+
code_refs=self.code_refs,
|
|
271
|
+
warn_no_backreference=self.warn_no_backreference,
|
|
272
|
+
)
|
|
259
273
|
doctree.walk(visitor)
|
|
260
274
|
return None
|
|
261
275
|
|
|
@@ -4,7 +4,10 @@ from dataclasses import dataclass
|
|
|
4
4
|
|
|
5
5
|
from docutils import nodes
|
|
6
6
|
|
|
7
|
+
from sphinx_codeautolink.warn import logger, warn_type
|
|
8
|
+
|
|
7
9
|
from .directive import DeferredExamples
|
|
10
|
+
from .translation import tr
|
|
8
11
|
|
|
9
12
|
|
|
10
13
|
@dataclass
|
|
@@ -56,10 +59,15 @@ class CodeRefsVisitor(nodes.SparseNodeVisitor):
|
|
|
56
59
|
"""Replace :class:`DeferredCodeReferences` with table of concrete references."""
|
|
57
60
|
|
|
58
61
|
def __init__(
|
|
59
|
-
self,
|
|
62
|
+
self,
|
|
63
|
+
*args,
|
|
64
|
+
code_refs: dict[str, list[CodeExample]],
|
|
65
|
+
warn_no_backreference: bool = False,
|
|
66
|
+
**kwargs,
|
|
60
67
|
) -> None:
|
|
61
68
|
super().__init__(*args, **kwargs)
|
|
62
69
|
self.code_refs = code_refs
|
|
70
|
+
self.warn_no_backreference = warn_no_backreference
|
|
63
71
|
|
|
64
72
|
def unknown_departure(self, node) -> None:
|
|
65
73
|
"""Ignore unknown nodes."""
|
|
@@ -79,6 +87,11 @@ class CodeRefsVisitor(nodes.SparseNodeVisitor):
|
|
|
79
87
|
items = sorted(set(items))
|
|
80
88
|
|
|
81
89
|
if not items:
|
|
90
|
+
if self.warn_no_backreference:
|
|
91
|
+
msg = f"No backreference for: '{node.ref}'"
|
|
92
|
+
logger.warning(
|
|
93
|
+
msg, type=warn_type, subtype="no_backreference", location=node
|
|
94
|
+
)
|
|
82
95
|
# Remove surrounding paragraph too
|
|
83
96
|
node.parent.parent.remove(node.parent)
|
|
84
97
|
return
|
|
@@ -100,7 +113,7 @@ class CodeRefsVisitor(nodes.SparseNodeVisitor):
|
|
|
100
113
|
entry = nodes.entry()
|
|
101
114
|
row += entry
|
|
102
115
|
title = nodes.paragraph()
|
|
103
|
-
title += nodes.Text("References to ")
|
|
116
|
+
title += nodes.Text(tr("References to") + " ")
|
|
104
117
|
title += orig_ref
|
|
105
118
|
entry += title
|
|
106
119
|
|
|
@@ -120,7 +133,7 @@ class CodeRefsVisitor(nodes.SparseNodeVisitor):
|
|
|
120
133
|
if node.collapse:
|
|
121
134
|
details = DetailsNode()
|
|
122
135
|
summary = SummaryNode()
|
|
123
|
-
summary += nodes.Text("Expand for references to ")
|
|
136
|
+
summary += nodes.Text(tr("Expand for references to") + " ")
|
|
124
137
|
summary += orig_ref
|
|
125
138
|
details += summary
|
|
126
139
|
details += table
|