From c5eac010bec655fe32baa875378ee5545abb653a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A9vin=20Commaille?= <76261501+zecakeh@users.noreply.github.com> Date: Tue, 26 Nov 2024 18:53:52 +0100 Subject: [PATCH] Fix `changed-in` partial when used with multiple paragraphs (#2006) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When used with a text that includes multiple paragraphs, the partial created invalid HTML by nesting `

` elements. It also changed the rendering by making "Changed in vX.XX:" a separate paragraph, when it is inline with a single paragraph. To change that we do as with "Required" and add "Changed in vX.XX:" to the text before it is rendered, making it inline with the first paragraph. Signed-off-by: Kévin Commaille --- changelogs/internal/newsfragments/2006.clarification | 1 + layouts/partials/changed-in.html | 12 ++++-------- 2 files changed, 5 insertions(+), 8 deletions(-) create mode 100644 changelogs/internal/newsfragments/2006.clarification diff --git a/changelogs/internal/newsfragments/2006.clarification b/changelogs/internal/newsfragments/2006.clarification new file mode 100644 index 000000000..d535a8fbb --- /dev/null +++ b/changelogs/internal/newsfragments/2006.clarification @@ -0,0 +1 @@ +Fix `changed-in` partial when used with multiple paragraphs. diff --git a/layouts/partials/changed-in.html b/layouts/partials/changed-in.html index 61aba5b1e..7aa190a4c 100644 --- a/layouts/partials/changed-in.html +++ b/layouts/partials/changed-in.html @@ -1,15 +1,11 @@ -{{/* +{{- /* Renders the "Changed in [version]:" blocks for x-changedInMatrixVersion annotations for openapi parameters Takes a single 'changes_dict' parameter, which should be a map of version -> details pairs. */ -}} -{{ range $ver, $details := .changes_dict -}} -

- - Changed in v{{ $ver }}: - - {{ $details | markdownify }} -

+{{- range $ver, $details := .changes_dict -}} + {{- $details = printf "**Changed in `v%s`:** %s" $ver (default "" $details) -}} + {{- $details | page.RenderString (dict "display" "block") -}} {{ end -}}