From 42b3359d539dd50bac92e8fedab09f46a97f278a Mon Sep 17 00:00:00 2001 From: MoritzWeber0 Date: Sat, 12 Jul 2025 23:13:36 +0200 Subject: [PATCH] fix: Scope footnotes to their corresponding booking section Otherwise, the anchor ids are conflicting when a booking section with footnotes is embedded into an operator page. --- layouts/partials/booking.html | 4 ++-- layouts/partials/prefix-footnotes.html | 7 +++++++ 2 files changed, 9 insertions(+), 2 deletions(-) create mode 100644 layouts/partials/prefix-footnotes.html diff --git a/layouts/partials/booking.html b/layouts/partials/booking.html index 7749de19..f41fc7eb 100644 --- a/layouts/partials/booking.html +++ b/layouts/partials/booking.html @@ -46,8 +46,8 @@ {{- if or (eq .reservations false) (eq .reservations "nil") }} {{- $contentClasses = $contentClasses | append "o-booking__section-reservations--hidden" -}} {{- end -}} -
- {{- .page.Content -}} +
+ {{- partial "prefix-footnotes" (dict "content" .page.Content "prefix" .page.File.ContentBaseName) | safeHTML -}}
{{ partial "booking-links" .page }} diff --git a/layouts/partials/prefix-footnotes.html b/layouts/partials/prefix-footnotes.html new file mode 100644 index 00000000..cd6cb968 --- /dev/null +++ b/layouts/partials/prefix-footnotes.html @@ -0,0 +1,7 @@ +{{- $patternFnref := `fnref:(\d+)` -}} +{{- $replacementFnref := (printf "fnref:%s:$1" .prefix) -}} +{{- $patternFn := `fn:(\d+)` -}} +{{- $replacementFn := (printf "fn:%s:$1" .prefix) -}} +{{- $content := replaceRE $patternFnref $replacementFnref .content -}} +{{- $content := replaceRE $patternFn $replacementFn $content -}} +{{- return $content -}}