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.
Files changed (169) hide show
  1. {sphinx_codeautolink-0.16.2 → sphinx_codeautolink-0.17.1}/MANIFEST.in +1 -0
  2. {sphinx_codeautolink-0.16.2/src/sphinx_codeautolink.egg-info → sphinx_codeautolink-0.17.1}/PKG-INFO +4 -5
  3. {sphinx_codeautolink-0.16.2 → sphinx_codeautolink-0.17.1}/contributing.rst +12 -0
  4. {sphinx_codeautolink-0.16.2 → sphinx_codeautolink-0.17.1}/docs/src/about.rst +1 -1
  5. {sphinx_codeautolink-0.16.2 → sphinx_codeautolink-0.17.1}/docs/src/conf.py +3 -0
  6. {sphinx_codeautolink-0.16.2 → sphinx_codeautolink-0.17.1}/docs/src/examples.rst +37 -14
  7. {sphinx_codeautolink-0.16.2 → sphinx_codeautolink-0.17.1}/docs/src/index.rst +4 -5
  8. {sphinx_codeautolink-0.16.2 → sphinx_codeautolink-0.17.1}/docs/src/reference.rst +43 -10
  9. {sphinx_codeautolink-0.16.2 → sphinx_codeautolink-0.17.1}/docs/src/release_notes.rst +29 -0
  10. sphinx_codeautolink-0.17.1/docs/src/static/custom.css +5 -0
  11. {sphinx_codeautolink-0.16.2 → sphinx_codeautolink-0.17.1}/pyproject.toml +2 -0
  12. {sphinx_codeautolink-0.16.2 → sphinx_codeautolink-0.17.1}/readme_pypi.rst +3 -4
  13. {sphinx_codeautolink-0.16.2 → sphinx_codeautolink-0.17.1}/src/sphinx_codeautolink/__init__.py +20 -1
  14. {sphinx_codeautolink-0.16.2 → sphinx_codeautolink-0.17.1}/src/sphinx_codeautolink/extension/__init__.py +15 -1
  15. {sphinx_codeautolink-0.16.2 → sphinx_codeautolink-0.17.1}/src/sphinx_codeautolink/extension/backref.py +16 -3
  16. {sphinx_codeautolink-0.16.2 → sphinx_codeautolink-0.17.1}/src/sphinx_codeautolink/extension/block.py +95 -23
  17. {sphinx_codeautolink-0.16.2 → sphinx_codeautolink-0.17.1}/src/sphinx_codeautolink/extension/directive.py +6 -3
  18. {sphinx_codeautolink-0.16.2 → sphinx_codeautolink-0.17.1}/src/sphinx_codeautolink/extension/resolve.py +2 -1
  19. sphinx_codeautolink-0.17.1/src/sphinx_codeautolink/extension/translation.py +6 -0
  20. sphinx_codeautolink-0.17.1/src/sphinx_codeautolink/locale/de/LC_MESSAGES/sphinx-codeautolink.mo +0 -0
  21. sphinx_codeautolink-0.17.1/src/sphinx_codeautolink/locale/de/LC_MESSAGES/sphinx-codeautolink.po +25 -0
  22. sphinx_codeautolink-0.17.1/src/sphinx_codeautolink/locale/es/LC_MESSAGES/sphinx-codeautolink.mo +0 -0
  23. sphinx_codeautolink-0.17.1/src/sphinx_codeautolink/locale/es/LC_MESSAGES/sphinx-codeautolink.po +25 -0
  24. sphinx_codeautolink-0.17.1/src/sphinx_codeautolink/locale/fi/LC_MESSAGES/sphinx-codeautolink.mo +0 -0
  25. sphinx_codeautolink-0.17.1/src/sphinx_codeautolink/locale/fi/LC_MESSAGES/sphinx-codeautolink.po +25 -0
  26. sphinx_codeautolink-0.17.1/src/sphinx_codeautolink/locale/it/LC_MESSAGES/sphinx-codeautolink.mo +0 -0
  27. sphinx_codeautolink-0.17.1/src/sphinx_codeautolink/locale/it/LC_MESSAGES/sphinx-codeautolink.po +25 -0
  28. sphinx_codeautolink-0.17.1/src/sphinx_codeautolink/locale/sphinx-codeautolink.pot +24 -0
  29. {sphinx_codeautolink-0.16.2 → sphinx_codeautolink-0.17.1}/src/sphinx_codeautolink/parse.py +150 -239
  30. sphinx_codeautolink-0.17.1/src/sphinx_codeautolink/static/sphinx-codeautolink.css +13 -0
  31. {sphinx_codeautolink-0.16.2 → sphinx_codeautolink-0.17.1/src/sphinx_codeautolink.egg-info}/PKG-INFO +4 -5
  32. {sphinx_codeautolink-0.16.2 → sphinx_codeautolink-0.17.1}/src/sphinx_codeautolink.egg-info/SOURCES.txt +41 -11
  33. {sphinx_codeautolink-0.16.2 → sphinx_codeautolink-0.17.1}/tests/extension/__init__.py +35 -2
  34. sphinx_codeautolink-0.17.1/tests/extension/fail/no_backreference.txt +9 -0
  35. sphinx_codeautolink-0.17.1/tests/extension/fail/preface_invalid_arg.txt +8 -0
  36. {sphinx_codeautolink-0.16.2 → sphinx_codeautolink-0.17.1}/tests/extension/fail/ref_invalid_block_type.txt +2 -2
  37. {sphinx_codeautolink-0.16.2 → sphinx_codeautolink-0.17.1}/tests/extension/fail/ref_invalid_syntax_complex.txt +3 -0
  38. sphinx_codeautolink-0.17.1/tests/extension/ref/class_mro_fix.txt +15 -0
  39. sphinx_codeautolink-0.17.1/tests/extension/ref/lexer_bazel.txt +13 -0
  40. sphinx_codeautolink-0.17.1/tests/extension/ref/lexer_default.txt +14 -0
  41. sphinx_codeautolink-0.17.1/tests/extension/ref/lexer_default_fail.txt +10 -0
  42. sphinx_codeautolink-0.17.1/tests/extension/ref/lexer_doctest_empty_input.txt +15 -0
  43. sphinx_codeautolink-0.17.1/tests/extension/ref/lexer_highlight_language.txt +12 -0
  44. sphinx_codeautolink-0.17.1/tests/extension/ref/lexer_highlight_none.txt +13 -0
  45. sphinx_codeautolink-0.17.1/tests/extension/ref/lexer_literal.txt +13 -0
  46. 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
  47. sphinx_codeautolink-0.17.1/tests/extension/ref/lexer_py3.txt +13 -0
  48. sphinx_codeautolink-0.17.1/tests/extension/ref/lexer_pycon_implicit.txt +24 -0
  49. sphinx_codeautolink-0.17.1/tests/extension/ref/lexer_pyi.txt +13 -0
  50. sphinx_codeautolink-0.17.1/tests/extension/ref/lexer_python3.txt +13 -0
  51. sphinx_codeautolink-0.17.1/tests/extension/ref/lexer_sage.txt +13 -0
  52. sphinx_codeautolink-0.17.1/tests/extension/ref/lexer_starlark.txt +13 -0
  53. {sphinx_codeautolink-0.16.2 → sphinx_codeautolink-0.17.1}/tests/extension/ref/preface_consumed_non_python.txt +1 -1
  54. sphinx_codeautolink-0.17.1/tests/extension/ref/preface_document.txt +26 -0
  55. {sphinx_codeautolink-0.16.2 → sphinx_codeautolink-0.17.1}/tests/extension/ref/skip_next_consumed_non_python.txt +1 -1
  56. sphinx_codeautolink-0.17.1/tests/extension/src/class_mro_fix.py +10 -0
  57. {sphinx_codeautolink-0.16.2 → sphinx_codeautolink-0.17.1}/tests/parse/__init__.py +6 -0
  58. {sphinx_codeautolink-0.16.2 → sphinx_codeautolink-0.17.1}/tests/parse/_util.py +5 -1
  59. {sphinx_codeautolink-0.16.2 → sphinx_codeautolink-0.17.1}/tests/parse/assign.py +18 -0
  60. {sphinx_codeautolink-0.16.2 → sphinx_codeautolink-0.17.1}/LICENSE +0 -0
  61. {sphinx_codeautolink-0.16.2 → sphinx_codeautolink-0.17.1}/docs/requirements.txt +0 -0
  62. {sphinx_codeautolink-0.16.2 → sphinx_codeautolink-0.17.1}/docs/src/404.rst +0 -0
  63. {sphinx_codeautolink-0.16.2 → sphinx_codeautolink-0.17.1}/docs/src/example_library.rst +0 -0
  64. {sphinx_codeautolink-0.16.2 → sphinx_codeautolink-0.17.1}/docs/src/lib.py +0 -0
  65. {sphinx_codeautolink-0.16.2 → sphinx_codeautolink-0.17.1}/requirements/build +0 -0
  66. {sphinx_codeautolink-0.16.2 → sphinx_codeautolink-0.17.1}/requirements/dev +0 -0
  67. {sphinx_codeautolink-0.16.2 → sphinx_codeautolink-0.17.1}/requirements/docs +0 -0
  68. {sphinx_codeautolink-0.16.2 → sphinx_codeautolink-0.17.1}/requirements/extras +0 -0
  69. {sphinx_codeautolink-0.16.2 → sphinx_codeautolink-0.17.1}/requirements/tests +0 -0
  70. {sphinx_codeautolink-0.16.2 → sphinx_codeautolink-0.17.1}/setup.cfg +0 -0
  71. {sphinx_codeautolink-0.16.2 → sphinx_codeautolink-0.17.1}/src/sphinx_codeautolink/extension/cache.py +0 -0
  72. {sphinx_codeautolink-0.16.2 → sphinx_codeautolink-0.17.1}/src/sphinx_codeautolink/warn.py +0 -0
  73. {sphinx_codeautolink-0.16.2 → sphinx_codeautolink-0.17.1}/src/sphinx_codeautolink.egg-info/dependency_links.txt +0 -0
  74. {sphinx_codeautolink-0.16.2 → sphinx_codeautolink-0.17.1}/src/sphinx_codeautolink.egg-info/requires.txt +0 -0
  75. {sphinx_codeautolink-0.16.2 → sphinx_codeautolink-0.17.1}/src/sphinx_codeautolink.egg-info/top_level.txt +0 -0
  76. {sphinx_codeautolink-0.16.2 → sphinx_codeautolink-0.17.1}/tests/__init__.py +0 -0
  77. {sphinx_codeautolink-0.16.2 → sphinx_codeautolink-0.17.1}/tests/extension/_check.py +0 -0
  78. {sphinx_codeautolink-0.16.2 → sphinx_codeautolink-0.17.1}/tests/extension/fail/concat_invalid.txt +0 -0
  79. {sphinx_codeautolink-0.16.2 → sphinx_codeautolink-0.17.1}/tests/extension/fail/custom_block_import_invalid.txt +0 -0
  80. {sphinx_codeautolink-0.16.2 → sphinx_codeautolink-0.17.1}/tests/extension/fail/custom_block_syntax_error.txt +0 -0
  81. {sphinx_codeautolink-0.16.2 → sphinx_codeautolink-0.17.1}/tests/extension/fail/failed_resolve_invalid_location.txt +0 -0
  82. {sphinx_codeautolink-0.16.2 → sphinx_codeautolink-0.17.1}/tests/extension/fail/failed_resolve_no_module.txt +0 -0
  83. {sphinx_codeautolink-0.16.2 → sphinx_codeautolink-0.17.1}/tests/extension/fail/failed_resolve_return_type.txt +0 -0
  84. {sphinx_codeautolink-0.16.2 → sphinx_codeautolink-0.17.1}/tests/extension/fail/match_block_warning.txt +0 -0
  85. {sphinx_codeautolink-0.16.2 → sphinx_codeautolink-0.17.1}/tests/extension/fail/missing_inventory.txt +0 -0
  86. {sphinx_codeautolink-0.16.2 → sphinx_codeautolink-0.17.1}/tests/extension/fail/no_module_docs.txt +0 -0
  87. {sphinx_codeautolink-0.16.2 → sphinx_codeautolink-0.17.1}/tests/extension/fail/ref_import_star_invalid.txt +0 -0
  88. {sphinx_codeautolink-0.16.2 → sphinx_codeautolink-0.17.1}/tests/extension/fail/ref_invalid_syntax.txt +0 -0
  89. {sphinx_codeautolink-0.16.2 → sphinx_codeautolink-0.17.1}/tests/extension/fail/ref_ipython_non-python.txt +0 -0
  90. {sphinx_codeautolink-0.16.2 → sphinx_codeautolink-0.17.1}/tests/extension/fail/skip_invalid.txt +0 -0
  91. {sphinx_codeautolink-0.16.2 → sphinx_codeautolink-0.17.1}/tests/extension/ref/concat_default.txt +0 -0
  92. {sphinx_codeautolink-0.16.2 → sphinx_codeautolink-0.17.1}/tests/extension/ref/concat_off.txt +0 -0
  93. {sphinx_codeautolink-0.16.2 → sphinx_codeautolink-0.17.1}/tests/extension/ref/concat_on_across_sections.txt +0 -0
  94. {sphinx_codeautolink-0.16.2 → sphinx_codeautolink-0.17.1}/tests/extension/ref/concat_on_breaks.txt +0 -0
  95. {sphinx_codeautolink-0.16.2 → sphinx_codeautolink-0.17.1}/tests/extension/ref/concat_section_breaks.txt +0 -0
  96. {sphinx_codeautolink-0.16.2 → sphinx_codeautolink-0.17.1}/tests/extension/ref/concat_section_returns_to_global.txt +0 -0
  97. {sphinx_codeautolink-0.16.2 → sphinx_codeautolink-0.17.1}/tests/extension/ref/custom_block.txt +0 -0
  98. {sphinx_codeautolink-0.16.2 → sphinx_codeautolink-0.17.1}/tests/extension/ref/custom_block_imported.txt +0 -0
  99. {sphinx_codeautolink-0.16.2 → sphinx_codeautolink-0.17.1}/tests/extension/ref/empty_project.txt +0 -0
  100. {sphinx_codeautolink-0.16.2 → sphinx_codeautolink-0.17.1}/tests/extension/ref/inventory_map_is_needed.txt +0 -0
  101. {sphinx_codeautolink-0.16.2 → sphinx_codeautolink-0.17.1}/tests/extension/ref/inventory_map_not_needed.txt +0 -0
  102. /sphinx_codeautolink-0.16.2/tests/extension/ref/ref_doctest.txt → /sphinx_codeautolink-0.17.1/tests/extension/ref/lexer_doctest.txt +0 -0
  103. /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
  104. /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
  105. /sphinx_codeautolink-0.16.2/tests/extension/ref/ref_ipython.txt → /sphinx_codeautolink-0.17.1/tests/extension/ref/lexer_ipython.txt +0 -0
  106. /sphinx_codeautolink-0.16.2/tests/extension/ref/ref_ipython3.txt → /sphinx_codeautolink-0.17.1/tests/extension/ref/lexer_ipython3.txt +0 -0
  107. /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
  108. /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
  109. /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
  110. /sphinx_codeautolink-0.16.2/tests/extension/ref/ref_py.txt → /sphinx_codeautolink-0.17.1/tests/extension/ref/lexer_py.txt +0 -0
  111. /sphinx_codeautolink-0.16.2/tests/extension/ref/ref_pycon.txt → /sphinx_codeautolink-0.17.1/tests/extension/ref/lexer_pycon.txt +0 -0
  112. {sphinx_codeautolink-0.16.2 → sphinx_codeautolink-0.17.1}/tests/extension/ref/line_numbers.txt +0 -0
  113. {sphinx_codeautolink-0.16.2 → sphinx_codeautolink-0.17.1}/tests/extension/ref/preface_concatenated.txt +0 -0
  114. {sphinx_codeautolink-0.16.2 → sphinx_codeautolink-0.17.1}/tests/extension/ref/preface_global.txt +0 -0
  115. {sphinx_codeautolink-0.16.2 → sphinx_codeautolink-0.17.1}/tests/extension/ref/preface_global_multiline.txt +0 -0
  116. {sphinx_codeautolink-0.16.2 → sphinx_codeautolink-0.17.1}/tests/extension/ref/preface_global_overwritten.txt +0 -0
  117. {sphinx_codeautolink-0.16.2 → sphinx_codeautolink-0.17.1}/tests/extension/ref/preface_multiline.txt +0 -0
  118. {sphinx_codeautolink-0.16.2 → sphinx_codeautolink-0.17.1}/tests/extension/ref/preface_multiline_and_arg.txt +0 -0
  119. {sphinx_codeautolink-0.16.2 → sphinx_codeautolink-0.17.1}/tests/extension/ref/preface_multiple.txt +0 -0
  120. {sphinx_codeautolink-0.16.2 → sphinx_codeautolink-0.17.1}/tests/extension/ref/preface_single.txt +0 -0
  121. {sphinx_codeautolink-0.16.2 → sphinx_codeautolink-0.17.1}/tests/extension/ref/ref_assign_targets.txt +0 -0
  122. {sphinx_codeautolink-0.16.2 → sphinx_codeautolink-0.17.1}/tests/extension/ref/ref_builtins.txt +0 -0
  123. {sphinx_codeautolink-0.16.2 → sphinx_codeautolink-0.17.1}/tests/extension/ref/ref_chain.txt +0 -0
  124. {sphinx_codeautolink-0.16.2 → sphinx_codeautolink-0.17.1}/tests/extension/ref/ref_chain_call.txt +0 -0
  125. {sphinx_codeautolink-0.16.2 → sphinx_codeautolink-0.17.1}/tests/extension/ref/ref_class_attr.txt +0 -0
  126. {sphinx_codeautolink-0.16.2 → sphinx_codeautolink-0.17.1}/tests/extension/ref/ref_class_meth_returns_self.txt +0 -0
  127. {sphinx_codeautolink-0.16.2 → sphinx_codeautolink-0.17.1}/tests/extension/ref/ref_class_type_attr.txt +0 -0
  128. {sphinx_codeautolink-0.16.2 → sphinx_codeautolink-0.17.1}/tests/extension/ref/ref_decorator.txt +0 -0
  129. {sphinx_codeautolink-0.16.2 → sphinx_codeautolink-0.17.1}/tests/extension/ref/ref_fluent_attrs.txt +0 -0
  130. {sphinx_codeautolink-0.16.2 → sphinx_codeautolink-0.17.1}/tests/extension/ref/ref_fluent_call.txt +0 -0
  131. {sphinx_codeautolink-0.16.2 → sphinx_codeautolink-0.17.1}/tests/extension/ref/ref_func_args.txt +0 -0
  132. {sphinx_codeautolink-0.16.2 → sphinx_codeautolink-0.17.1}/tests/extension/ref/ref_func_no_module.txt +0 -0
  133. {sphinx_codeautolink-0.16.2 → sphinx_codeautolink-0.17.1}/tests/extension/ref/ref_import_as.txt +0 -0
  134. {sphinx_codeautolink-0.16.2 → sphinx_codeautolink-0.17.1}/tests/extension/ref/ref_import_from.txt +0 -0
  135. {sphinx_codeautolink-0.16.2 → sphinx_codeautolink-0.17.1}/tests/extension/ref/ref_import_from_complex.txt +0 -0
  136. {sphinx_codeautolink-0.16.2 → sphinx_codeautolink-0.17.1}/tests/extension/ref/ref_import_multiple.txt +0 -0
  137. {sphinx_codeautolink-0.16.2 → sphinx_codeautolink-0.17.1}/tests/extension/ref/ref_import_multiple_libs.txt +0 -0
  138. {sphinx_codeautolink-0.16.2 → sphinx_codeautolink-0.17.1}/tests/extension/ref/ref_import_star.txt +0 -0
  139. {sphinx_codeautolink-0.16.2 → sphinx_codeautolink-0.17.1}/tests/extension/ref/ref_import_submodule.txt +0 -0
  140. {sphinx_codeautolink-0.16.2 → sphinx_codeautolink-0.17.1}/tests/extension/ref/ref_imported_func.txt +0 -0
  141. {sphinx_codeautolink-0.16.2 → sphinx_codeautolink-0.17.1}/tests/extension/ref/ref_imported_func_relocated.txt +0 -0
  142. {sphinx_codeautolink-0.16.2 → sphinx_codeautolink-0.17.1}/tests/extension/ref/ref_inherited.txt +0 -0
  143. {sphinx_codeautolink-0.16.2 → sphinx_codeautolink-0.17.1}/tests/extension/ref/ref_intersphinx_only.txt +0 -0
  144. {sphinx_codeautolink-0.16.2 → sphinx_codeautolink-0.17.1}/tests/extension/ref/ref_invalid_func.txt +0 -0
  145. {sphinx_codeautolink-0.16.2 → sphinx_codeautolink-0.17.1}/tests/extension/ref/ref_invalid_typehint.txt +0 -0
  146. {sphinx_codeautolink-0.16.2 → sphinx_codeautolink-0.17.1}/tests/extension/ref/ref_optional.txt +0 -0
  147. {sphinx_codeautolink-0.16.2 → sphinx_codeautolink-0.17.1}/tests/extension/ref/ref_optional_future.txt +0 -0
  148. {sphinx_codeautolink-0.16.2 → sphinx_codeautolink-0.17.1}/tests/extension/ref/ref_shadow_builtin.txt +0 -0
  149. {sphinx_codeautolink-0.16.2 → sphinx_codeautolink-0.17.1}/tests/extension/ref/ref_simple.txt +0 -0
  150. {sphinx_codeautolink-0.16.2 → sphinx_codeautolink-0.17.1}/tests/extension/ref/search_css_duplicates_removed.txt +0 -0
  151. {sphinx_codeautolink-0.16.2 → sphinx_codeautolink-0.17.1}/tests/extension/ref/skip_file.txt +0 -0
  152. {sphinx_codeautolink-0.16.2 → sphinx_codeautolink-0.17.1}/tests/extension/ref/skip_next.txt +0 -0
  153. {sphinx_codeautolink-0.16.2 → sphinx_codeautolink-0.17.1}/tests/extension/ref/skip_off.txt +0 -0
  154. {sphinx_codeautolink-0.16.2 → sphinx_codeautolink-0.17.1}/tests/extension/ref/skip_section.txt +0 -0
  155. {sphinx_codeautolink-0.16.2 → sphinx_codeautolink-0.17.1}/tests/extension/src/future_project.py +0 -0
  156. {sphinx_codeautolink-0.16.2 → sphinx_codeautolink-0.17.1}/tests/extension/src/parser_func.py +0 -0
  157. {sphinx_codeautolink-0.16.2 → sphinx_codeautolink-0.17.1}/tests/extension/src/test_project/__init__.py +0 -0
  158. {sphinx_codeautolink-0.16.2 → sphinx_codeautolink-0.17.1}/tests/extension/src/test_project/sub.py +0 -0
  159. {sphinx_codeautolink-0.16.2 → sphinx_codeautolink-0.17.1}/tests/extension/table/tab_autodoc_empty.txt +0 -0
  160. {sphinx_codeautolink-0.16.2 → sphinx_codeautolink-0.17.1}/tests/extension/table/tab_autodoc_links.txt +0 -0
  161. {sphinx_codeautolink-0.16.2 → sphinx_codeautolink-0.17.1}/tests/extension/table/tab_manual_collapse.txt +0 -0
  162. {sphinx_codeautolink-0.16.2 → sphinx_codeautolink-0.17.1}/tests/extension/table/tab_manual_empty.txt +0 -0
  163. {sphinx_codeautolink-0.16.2 → sphinx_codeautolink-0.17.1}/tests/extension/table/tab_manual_links.txt +0 -0
  164. {sphinx_codeautolink-0.16.2 → sphinx_codeautolink-0.17.1}/tests/extension/table/tab_manual_links_subsection.txt +0 -0
  165. {sphinx_codeautolink-0.16.2 → sphinx_codeautolink-0.17.1}/tests/extension/table/tab_no_table.txt +0 -0
  166. {sphinx_codeautolink-0.16.2 → sphinx_codeautolink-0.17.1}/tests/parse/chain.py +0 -0
  167. {sphinx_codeautolink-0.16.2 → sphinx_codeautolink-0.17.1}/tests/parse/match.py +0 -0
  168. {sphinx_codeautolink-0.16.2 → sphinx_codeautolink-0.17.1}/tests/parse/scope.py +0 -0
  169. {sphinx_codeautolink-0.16.2 → sphinx_codeautolink-0.17.1}/tox.ini +0 -0
@@ -1,6 +1,7 @@
1
1
  graft docs
2
2
  prune docs/build
3
3
  graft requirements
4
+ graft src
4
5
  graft tests
5
6
  include contributing.rst readme_pypi.rst tox.ini
6
7
  global-exclude *.py[cod] __pycache__ *.so
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: sphinx-codeautolink
3
- Version: 0.16.2
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 multiple examples
89
- and setting default import statements among other things,
90
- have a look at the online documentation.
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 literal blocks, not inline code**. Sphinx has great tools
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.
@@ -56,6 +56,9 @@ plot_formats = [("png", 90)]
56
56
  plot_html_show_formats = False
57
57
  plot_html_show_source_link = False
58
58
 
59
+ html_static_path = ["static"]
60
+ html_css_files = ["custom.css"]
61
+
59
62
 
60
63
  def setup(app) -> None:
61
64
  app.add_object_type(
@@ -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
- `Doctest <https://docutils.sourceforge.io/docs/ref/rst/restructuredtext.html
25
- #doctest-blocks>`_ and console blocks using :code:`.. code:: pycon` work too.
26
- Including code via :rst:dir:`literalinclude` requires using a
27
- :code:`:language: py` parameter.
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: rgb(0, 0, 0);
315
- border-bottom-style: dotted;
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 names in the example below for a demonstration:
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 multiple examples
60
- and setting default import statements among other things,
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 literal blocks, not inline code
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 a :rst:dir:`autolink-examples` table
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 a :rst:dir:`autolink-preface` before all blocks.
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``. Issue warning when an object cannot be found in
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``. Issue warning when failing to resolve the canonical location
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 literal block concatenation.
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 in the next code block.
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 included in block concatenation.
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`)
@@ -0,0 +1,5 @@
1
+ .sphinx-codeautolink-a{
2
+ border-bottom-color: #ccc;
3
+ border-bottom-style: solid;
4
+ border-bottom-width: 1px;
5
+ }
@@ -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 multiple examples
35
- and setting default import statements among other things,
36
- have a look at the online documentation.
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
@@ -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.16.2"
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(doctree, code_refs=self.code_refs)
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, *args, code_refs: dict[str, list[CodeExample]], **kwargs
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