Skip to content

Commit

Permalink
Fix changed-in partial when used with multiple paragraphs (#2006)
Browse files Browse the repository at this point in the history
When used with a text that includes multiple paragraphs, the partial created invalid HTML by nesting `<p>` 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 <[email protected]>
  • Loading branch information
zecakeh authored Nov 26, 2024
1 parent f3130f7 commit c5eac01
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 8 deletions.
1 change: 1 addition & 0 deletions changelogs/internal/newsfragments/2006.clarification
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix `changed-in` partial when used with multiple paragraphs.
12 changes: 4 additions & 8 deletions layouts/partials/changed-in.html
Original file line number Diff line number Diff line change
@@ -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 -}}
<p>
<strong>
Changed in <code>v{{ $ver }}</code>:
</strong>
{{ $details | markdownify }}
</p>
{{- range $ver, $details := .changes_dict -}}
{{- $details = printf "**Changed in `v%s`:** %s" $ver (default "" $details) -}}
{{- $details | page.RenderString (dict "display" "block") -}}
{{ end -}}

0 comments on commit c5eac01

Please sign in to comment.