Skip to content

Commit

Permalink
Drop support for typedoc 0.22 (#53)
Browse files Browse the repository at this point in the history
  • Loading branch information
hoodmane authored Sep 23, 2023
1 parent 6549a6c commit 61b4a05
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 31 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ jobs:
fail-fast: false
matrix:
python-version: ['3.11']
typedoc-version: ['0.22', '0.23', '0.24', '0.25']
typedoc-version: ['0.23', '0.24', '0.25']
experimental: [false]

name: Python ${{ matrix.python-version}} + typedoc ${{ matrix.typedoc-version }}
Expand Down
2 changes: 1 addition & 1 deletion noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def tests(session: Session) -> None:


@nox.session(python=["3.11"])
@nox.parametrize("typedoc", ["0.22", "0.23", "0.24", "0.25"])
@nox.parametrize("typedoc", ["0.23", "0.24", "0.25"])
def test_typedoc(session: Session, typedoc: str) -> None:

session.install("-r", "requirements_dev.txt")
Expand Down
35 changes: 6 additions & 29 deletions sphinx_js/typedoc.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

__all__ = ["Analyzer"]

MIN_TYPEDOC_VERSION = (0, 22, 0)
MIN_TYPEDOC_VERSION = (0, 23, 0)


@cache
Expand Down Expand Up @@ -138,19 +138,9 @@ def _populate_index_inner(
children.append(node.children)
if isinstance(node, Accessor):
if node.getSignature:
if isinstance(node.getSignature, list):
sig = node.getSignature[0]
else:
sig = node.getSignature
node.getSignature = sig
children.append([sig])
children.append([node.getSignature])
if node.setSignature:
if isinstance(node.setSignature, list):
sig = node.setSignature[0]
else:
sig = node.setSignature
node.setSignature = sig
children.append([sig])
children.append([node.setSignature])

if isinstance(node, (Callable, TypeLiteral)):
children.append(node.signatures)
Expand Down Expand Up @@ -299,10 +289,6 @@ class Tag(BaseModel):

class Comment(BaseModel):
returns: str = ""
# shortText and text are for version < 0.23
shortText: str | None
text: str | None
# summary and blockTags are for version >= 0.23
summary: list[Summary] = []
blockTags: list[Tag] = []

Expand Down Expand Up @@ -416,13 +402,12 @@ def _path_segments(self, base_dir: str) -> list[str]:

class Accessor(NodeBase):
kindString: Literal["Accessor"]
getSignature: "list[Signature] | Signature" = []
setSignature: "list[Signature] | Signature" = []
getSignature: "Signature | None" = None
setSignature: "Signature | None" = None

def to_ir(self, converter: Converter) -> tuple[ir.Attribute, Sequence["Node"]]:
if self.getSignature:
# There's no signature to speak of for a getter: only a return type.
assert isinstance(self.getSignature, Signature)
type = self.getSignature.type
else:
# ES6 says setters have exactly 1 param. I'm not sure if they
Expand Down Expand Up @@ -692,16 +677,8 @@ class OtherNode(NodeBase):

def make_description(comment: Comment) -> str:
"""Construct a single comment string from a fancy object."""
if not (comment.summary or comment.shortText or comment.text):
if not comment.summary:
return ""

if comment.shortText or comment.text:
# version <0.23
return "\n\n".join(
text for text in [comment.shortText, comment.text] if text
).strip()

# version 0.23
content = []
prev = ""
for s in comment.summary:
Expand Down

0 comments on commit 61b4a05

Please sign in to comment.