From d701754835319597381f3b7482d6b6cd9ed08763 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A9vin=20Commaille?= Date: Sun, 13 Oct 2024 12:44:59 +0200 Subject: [PATCH 1/2] Remove `withVersioning` parameter of `rver-fragment` shortcode. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We now detect automatically in the `added-in` and `changed-in` shortcodes whether we need to add text according to the page's room version so this parameter has become unnecessary. Moreover, forgetting to set this param can remove the text generated by the shortcodes so it is safer to just get rid of it. Signed-off-by: Kévin Commaille --- content/rooms/v11.md | 2 +- layouts/shortcodes/rver-fragment.html | 23 ++++++----------------- 2 files changed, 7 insertions(+), 18 deletions(-) diff --git a/content/rooms/v11.md b/content/rooms/v11.md index 5821eb06d..887b17eff 100644 --- a/content/rooms/v11.md +++ b/content/rooms/v11.md @@ -21,7 +21,7 @@ event keeps the `redacts` property under `content`. The The full redaction algorithm follows. -{{% rver-fragment name="v11-redactions" withVersioning="true" %}} +{{% rver-fragment name="v11-redactions" %}} ### Event format diff --git a/layouts/shortcodes/rver-fragment.html b/layouts/shortcodes/rver-fragment.html index 894e6f0b4..c0d83e4db 100644 --- a/layouts/shortcodes/rver-fragment.html +++ b/layouts/shortcodes/rver-fragment.html @@ -7,23 +7,12 @@ The `name` parameter is the file name without extension. - The `withVersioning` parameter is optional and defaults to false. When true, any - mentions of "New in this version" from the `added-in` shortcode are removed prior - to rendering. This is useful if needing to use a fragment where part of it describes - new functionality in a given room version but isn't new for subsequent versions. - */}} -{{ $name := .Params.name }} -{{ $withVersioning := .Params.withVersioning }} +{{ $name := .Params.name -}} -{{ with .Site.GetPage "rooms/fragments" }} - {{ with .Resources.GetMatch (printf "%s%s" $name ".md") }} - {{ $content := .RenderShortcodes }} - {{ if not $withVersioning }} - {{ $content = (replace $content "[New in this version]" "") }} - {{ $content = (replace $content "[Changed in this version]" "") }} - {{ end }} -{{ $content | safeHTML }} - {{ end }} -{{ end }} +{{ with .Site.GetPage "rooms/fragments" -}} + {{ with .Resources.GetMatch (printf "%s.md" $name) -}} + {{ .RenderShortcodes | safeHTML }} + {{ end -}} +{{ end -}} From 56591bb94a6e9eaa88e5a9e668bb2ab28428809a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A9vin=20Commaille?= Date: Sun, 13 Oct 2024 12:51:23 +0200 Subject: [PATCH 2/2] Add changelog MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Kévin Commaille --- changelogs/internal/newsfragments/1971.clarification | 1 + 1 file changed, 1 insertion(+) create mode 100644 changelogs/internal/newsfragments/1971.clarification diff --git a/changelogs/internal/newsfragments/1971.clarification b/changelogs/internal/newsfragments/1971.clarification new file mode 100644 index 000000000..6c61b6530 --- /dev/null +++ b/changelogs/internal/newsfragments/1971.clarification @@ -0,0 +1 @@ +Remove `withVersioning` parameter of `rver-fragment` shortcode.