Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions sphinxdocs/src/sphinx_bzl/bzl.py
Original file line number Diff line number Diff line change
Expand Up @@ -390,8 +390,12 @@ def _make_xrefs_for_arg_attr(
descr=index_description,
),
),
# This allows referencing an arg as e.g `funcname.argname`
alt_names=[anchor_id],
alt_names=[
# This allows referencing an arg as e.g `funcname.argname`
anchor_id,
# This allows referencing an arg as simply `argname`
arg_name
],
)

# Two changes to how arg xrefs are created:
Expand Down
2 changes: 2 additions & 0 deletions sphinxdocs/tests/sphinx_stardoc/sphinx_output_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ def _doc_element(self, doc):
("full_repo_aspect", "@testrepo//lang:aspect.bzl%myaspect", "aspect.html#myaspect"),
("full_repo_target", "@testrepo//lang:relativetarget", "target.html#relativetarget"),
("tag_class_attr_using_attr_role", "myext.mytag.ta1", "module_extension.html#myext.mytag.ta1"),
("tag_class_attr_using_attr_role_just_attr_name", "ta1", "module_extension.html#myext.mytag.ta1"),

# fmt: on
)
def test_xrefs(self, text, href):
Expand Down
1 change: 1 addition & 0 deletions sphinxdocs/tests/sphinx_stardoc/xrefs.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,3 +45,4 @@ Various tests of cross referencing support
## Tag class refs

* tag class attribute using attr role: {attr}`myext.mytag.ta1`
* tag class attribute, just attr name, attr role: {attr}`ta1`