Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove parenthesis from xrefs to classes #155

Merged
merged 1 commit into from
May 6, 2024
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
1 change: 1 addition & 0 deletions sphinx_js/directives.py
Original file line number Diff line number Diff line change
Expand Up @@ -349,6 +349,7 @@ def add_directives(app: Sphinx) -> None:
app.add_directive_to_domain(
"js", "autosummary", auto_summary_directive_bound_to_app(app)
)
app.add_role_to_domain("js", "class", JSXRefRole())
JavaScriptDomain.object_types["interface"] = ObjType(_("interface"), "interface")
app.add_directive_to_domain("js", "interface", JSInterface)
app.add_role_to_domain("js", "interface", JSXRefRole())
16 changes: 8 additions & 8 deletions tests/test_build_ts/test_build_ts.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def test_abstract_extends_and_implements(self):
" A definition of a class\n\n" if TYPEDOC_VERSION >= (0, 23, 0) else ""
)

# The quotes around ClassDefinition() must be some weird decision in
# The quotes around ClassDefinition must be some weird decision in
# Sphinx's text output. I don't care if they go away in a future
# version of Sphinx. It doesn't affect the HTML output.
self._file_contents_eq(
Expand All @@ -60,7 +60,7 @@ def test_abstract_extends_and_implements(self):
' *exported from* "class"\n'
"\n"
" **Extends:**\n"
' * "ClassDefinition()"\n'
' * "ClassDefinition"\n'
"\n"
" **Implements:**\n"
' * "Interface"\n'
Expand Down Expand Up @@ -183,7 +183,7 @@ def test_predicate(self):
* **c** (any)

Returns:
boolean (typeguard for "ConstructorlessClass()")
boolean (typeguard for "ConstructorlessClass")
"""
),
)
Expand Down Expand Up @@ -235,7 +235,7 @@ class Extension()
*exported from* "class"

**Extends:**
* "Base()"
* "Base"

Extension.g()

Expand Down Expand Up @@ -304,7 +304,7 @@ class module.Z(a, b)
*exported from* "module"

Type parameters:
**T** -- Description of T (extends "A()")
**T** -- Description of T (extends "A")

Arguments:
* **a** (number)
Expand Down Expand Up @@ -355,7 +355,7 @@ def test_extends_type_param_links(self):
s: Tag = t[0]
href: Tag = list(s.children)[0]
assert href.name == "a"
assert href.get_text() == "A()"
assert href.get_text() == "A"
assert href.attrs["class"] == ["reference", "internal"]
assert href.attrs["title"] == "module.A"
assert href.attrs["href"] == "#module.A"
Expand All @@ -379,11 +379,11 @@ def get_links(id):
assert (
href.attrs["href"] == "autoclass_constructorless.html#ConstructorlessClass"
)
assert href.get_text() == "ConstructorlessClass()"
assert href.get_text() == "ConstructorlessClass"

thunk_links = get_links("thunk")
assert thunk_links[1].get_text() == "OptionalThings"
assert thunk_links[2].get_text() == "ConstructorlessClass()"
assert thunk_links[2].get_text() == "ConstructorlessClass"

def test_sphinx_link_in_description(self):
soup = BeautifulSoup(
Expand Down
Loading