Remove withVersioning parameter of rver-fragment shortcode.

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 <zecakeh@tedomum.fr>
This commit is contained in:
Kévin Commaille 2024-10-13 12:44:59 +02:00
parent ae3673d2ef
commit d701754835
No known key found for this signature in database
GPG key ID: 0C971D9DBC9D678D
2 changed files with 7 additions and 18 deletions

View file

@ -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

View file

@ -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 -}}