8000 fix: Fix rendering of `/` in signatures · mkdocstrings/python@3e927e4 · GitHub
[go: up one dir, main page]

Skip to content

Commit 3e927e4

Browse files
committed
fix: Fix rendering of / in signatures
Previously, `/` was added in front of positional-only parameters. It is now fixed: `/` is added at the end of such parameters. Issue #25: #25
1 parent bc1a8ae commit 3e927e4

File tree

1 file changed

+8
-5
lines changed
  • src/mkdocstrings_handlers/python/templates/material/_base

1 file changed

+8
-5
lines changed

src/mkdocstrings_handlers/python/templates/material/_base/signature.html

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
{{ log.debug("Rendering signature") }}
33
{%- with -%}
44

5-
{%- set ns = namespace(render_pos_only_separator=True, render_kw_only_separator=True, equal="=") -%}
5+
{%- set ns = namespace(has_pos_only=False, render_pos_only_separator=True, render_kw_only_separator=True, equal="=") -%}
66

77
{%- if config.show_signature_annotations -%}
88
{%- set ns.equal = " = " -%}
@@ -13,11 +13,14 @@
1313
{%- if parameter.name not in ("self", "cls") or loop.index0 > 0 or not (function.parent and function.parent.is_class) -%}
1414

1515
{%- if parameter.kind.value == "positional-only" -%}
16-
{%- if ns.render_pos_only_separator -%}
16+
{%- set ns.has_pos_only = True -%}
17+
{%- else -%}
18+
{%- if ns.has_pos_only and ns.render_pos_only_separator -%}
1719
{%- set ns.render_pos_only_separator = False %}/, {% endif -%}
18-
{%- elif parameter.kind.value == "keyword-only" -%}
19-
{%- if ns.render_kw_only_separator -%}
20-
{%- set ns.render_kw_only_separator = False %}*, {% endif -%}
20+
{%- if parameter.kind.value == "keyword-only" -%}
21+
{%- if ns.render_kw_only_separator -%}
22+
{%- set ns.render_kw_only_separator = False %}*, {% endif -%}
23+
{%- endif -%}
2124
{%- endif -%}
2225

2326
{%- if config.show_signature_annotations and parameter.annotation is not none -%}

0 commit comments

Comments
 (0)
0