Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove withVersioning parameter of rver-fragment shortcode. #1971

Merged
merged 2 commits into from
Oct 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelogs/internal/newsfragments/1971.clarification
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Remove `withVersioning` parameter of `rver-fragment` shortcode.
2 changes: 1 addition & 1 deletion content/rooms/v11.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
23 changes: 6 additions & 17 deletions layouts/shortcodes/rver-fragment.html
Original file line number Diff line number Diff line change
Expand Up @@ -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 -}}