ENH: Create backreferences for default roles#1122
Merged
larsoner merged 2 commits intosphinx-gallery:masterfrom Apr 4, 2023
Merged
ENH: Create backreferences for default roles#1122larsoner merged 2 commits intosphinx-gallery:masterfrom
larsoner merged 2 commits intosphinx-gallery:masterfrom
Conversation
ec15af8 to
0d0d667
Compare
Contributor
|
Argh sorry @StefRe I created another conflict for you :( But +1 in general for this idea, makes sense to me! |
- split into two tests for implicit and explicit names - avoid repeated testing of first code_str (code_str and expected were extended and the complete code_str tested once more) - turn into parameterized test for better extensibility
When adding mini-galleries for API documentation, only the 5 roles func, math, attr, obj and class were taken into consideration. It is, however, common practice to define a default role (e.g. :py:obj:) using the default_role entry in conf.py. This commit enables the creation of backreferences for references without an explicite role if the default role in conf.py is one of the five roles listed above. Note the only the default role definition in conf.py is taken into consideration, i.e. setting the default role using the .. default-role:: directive is not taken into account. Further, separate titles (`Title <link>`) and suppressed link creations (`!no.link`) are handled correctly now.
0d0d667 to
a20f10b
Compare
Contributor
Author
|
no problem @larsoner , just rebased |
Contributor
|
Thanks @StefRe ! |
clrpackages
referenced
this pull request
in clearlinux-pkgs/pypi-sphinx_gallery
Apr 18, 2023
… to version 0.13.0 v0.13.0 ------- **Implemented enhancements:** - ENH: Create backreferences for default roles `#1122 <https://github.com/sphinx-gallery/sphinx-gallery/pull/1122>`__ (`StefRe <https://github.com/StefRe>`__) - ENH raise error in check_jupyterlite_conf with unknown key `#1119 <https://github.com/sphinx-gallery/sphinx-gallery/pull/1119>`__ (`lesteve <https://github.com/lesteve>`__) - ENH Add functionality to modify Jupyterlite notebooks based on their content `#1113 <https://github.com/sphinx-gallery/sphinx-gallery/pull/1113>`__ (`lesteve <https://github.com/lesteve>`__) - ENH: Add support for WebP `#1111 <https://github.com/sphinx-gallery/sphinx-gallery/pull/1111>`__ (`StefRe <https://github.com/StefRe>`__) **Fixed bugs:** - ENH Clean-up code by early initialization of sphinx_gallery_conf `#1120 <https://github.com/sphinx-gallery/sphinx-gallery/pull/1120>`__ (`lesteve <https://github.com/lesteve>`__) - FIX JupyterLite button links `#1115 <https://github.com/sphinx-gallery/sphinx-gallery/pull/1115>`__ (`lesteve <https://github.com/lesteve>`__) - Fix thumbnail text formatting `#1108 <https://github.com/sphinx-gallery/sphinx-gallery/pull/1108>`__ (`StefRe <https://github.com/StefRe>`__) (NEWS truncated at 15 lines)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When adding mini-galleries for API documentation, only the 5 roles
func,math,attr,objandclasswere taken into consideration. It is, however, common practice to define a default role (e.g.:py:obj:) using thedefault_roleentry inconf.py. This PR enables the creation of backreferences for references without an explicit role if the default role inconf.pyis one of the five roles listed above. Note that only the default role definition inconf.pyis taken into consideration, i.e. setting the default role using the.. default-role::directive is not taken into account.Further, separate titles (
Title <link>) and suppressed link creations (!no.link) are handled correctly now.The project listed in README.rst use the following default roles:
PySurfer, PyTorch, PyVista, SimPEG, Fury, Optuna,
Auto-sklearn, OpenML-Python, TorchIO, Biotite, Apache TVM, Tonic
Projects in the last two rows benefit from this PR as more backreferences/mini-galleries are created, see matplotlib/matplotlib#25595.
This PR comprises two commits:
TST: Refactor test_identify_names2
extended and the complete code_str tested once more)
ENH: Allow for default roles when creating backreferences
When adding mini-galleries for API documentation, only the 5 roles
func, math, attr, obj and class were taken into consideration. It is,
however, common practice to define a default role (e.g. :py:obj:) using
the default_role entry in conf.py. This commit enables the creation of
backreferences for references without an explicite role if the default
role in conf.py is one of the five roles listed above.
Please note the only the default role definition in conf.py is taken
into consideration, i.e. setting the default role using the
.. default-role:: directive is not taken into account.
Further, separate titles (
Title <link>) and suppressed link creations(
!no.link) are handled correctly now.