Skip to content

Commit 67f77b1

Browse files
committed
Rework method anchors:
* Drop names of splats * Drop args from macro anchors altogether * Fix detection of block-accepting funcs (note: names of blocks were already dropped)
1 parent 3ac0740 commit 67f77b1

1 file changed

Lines changed: 8 additions & 4 deletions

File tree

mkdocstrings/handlers/crystal/items.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -317,13 +317,13 @@ def rel_id(self):
317317

318318
args = [arg["external_name"] for arg in d["args"]]
319319
if d.get("splat_index") is not None:
320-
args[d["splat_index"]] = "*" + args[d["splat_index"]]
320+
args[d["splat_index"]] = "*"
321321
if d.get("double_splat"):
322-
args.append("**" + d["double_splat"]["external_name"])
323-
if d.get("block_arg"):
322+
args.append("**")
323+
if d.get("block_arg") or d.get("yields"):
324324
args.append("&")
325325

326-
return self.name + "(" + ",".join(args) + ")"
326+
return self.name + ("(" + ",".join(args) + ")" if args else "")
327327

328328
@property
329329
def abs_id(self):
@@ -397,6 +397,10 @@ class DocMacro(DocMethod):
397397

398398
METHOD_ID_SEP = ":"
399399

400+
@property
401+
def rel_id(self):
402+
return self.name
403+
400404
@property
401405
def kind(self) -> str:
402406
return "macro"

0 commit comments

Comments
 (0)