From 3e927e43192710218fe69f67ff832936c856a678 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timoth=C3=A9e=20Mazzucotelli?= Date: Sun, 12 Jun 2022 13:42:13 +0200 Subject: [PATCH 1/2] 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: https://github.com/mkdocstrings/python/issues/25 --- .../python/templates/material/_base/signature.html | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/signature.html b/src/mkdocstrings_handlers/python/templates/material/_base/signature.html index ca4bbd44..d571c73e 100644 --- a/src/mkdocstrings_handlers/python/templates/material/_base/signature.html +++ b/src/mkdocstrings_handlers/python/templates/material/_base/signature.html @@ -2,7 +2,7 @@ {{ log.debug("Rendering signature") }} {%- with -%} - {%- set ns = namespace(render_pos_only_separator=True, render_kw_only_separator=True, equal="=") -%} + {%- set ns = namespace(has_pos_only=False, render_pos_only_separator=True, render_kw_only_separator=True, equal="=") -%} {%- if config.show_signature_annotations -%} {%- set ns.equal = " = " -%} @@ -13,11 +13,14 @@ {%- if parameter.name not in ("self", "cls") or loop.index0 > 0 or not (function.parent and function.parent.is_class) -%} {%- if parameter.kind.value == "positional-only" -%} - {%- if ns.render_pos_only_separator -%} + {%- set ns.has_pos_only = True -%} + {%- else -%} + {%- if ns.has_pos_only and ns.render_pos_only_separator -%} {%- set ns.render_pos_only_separator = False %}/, {% endif -%} - {%- elif parameter.kind.value == "keyword-only" -%} - {%- if ns.render_kw_only_separator -%} - {%- set ns.render_kw_only_separator = False %}*, {% endif -%} + {%- if parameter.kind.value == "keyword-only" -%} + {%- if ns.render_kw_only_separator -%} + {%- set ns.render_kw_only_separator = False %}*, {% endif -%} + {%- endif -%} {%- endif -%} {%- if config.show_signature_annotations and parameter.annotation is not none -%} From e2719e6f6eb56d7031d97ab3e7718ec584c5299a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timoth=C3=A9e=20Mazzucotelli?= Date: Sun, 12 Jun 2022 13:44:26 +0200 Subject: [PATCH 2/2] chore: Prepare release 0.7.1 --- CHANGELOG.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index a13eb8dd..379d6671 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,14 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). +## [0.7.1](https://github.com/mkdocstrings/python/releases/tag/0.7.1) - 2022-06-12 + +[Compare with 0.7.0](https://github.com/mkdocstrings/python/compare/0.7.0...0.7.1) + +### Bug Fixes +- Fix rendering of `/` in signatures ([3e927e4](https://github.com/mkdocstrings/python/commit/3e927e43192710218fe69f67ff832936c856a678) by Timothée Mazzucotelli). [Issue #25](https://github.com/mkdocstrings/python/issues/25) + + ## [0.7.0](https://github.com/mkdocstrings/python/releases/tag/0.7.0) - 2022-05-28 [Compare with 0.6.6](https://github.com/mkdocstrings/python/compare/0.6.6...0.7.0)