From d514ad92103a4e39bae0321c46c63010079eb853 Mon Sep 17 00:00:00 2001 From: lennartrommeiss <61516567+lenderom@users.noreply.github.com> Date: Thu, 14 May 2026 12:35:55 +0200 Subject: [PATCH 1/2] fix: support multiple float images for CD pages --- assets/sass/floatImage.scss | 27 +++++++++- content/operator/cd/index.de.md | 43 ++++++--------- content/operator/cd/index.en.md | 43 ++++++--------- content/operator/cd/index.fr.md | 43 ++++++--------- layouts/partials/parse-list-param.html | 24 +++++++++ layouts/shortcodes/float-image.html | 73 +++++++++++++++++++++----- 6 files changed, 160 insertions(+), 93 deletions(-) create mode 100644 layouts/partials/parse-list-param.html diff --git a/assets/sass/floatImage.scss b/assets/sass/floatImage.scss index 74df275a6..96dadc460 100644 --- a/assets/sass/floatImage.scss +++ b/assets/sass/floatImage.scss @@ -2,13 +2,36 @@ display: flow-root; margin-bottom: 1rem; - &--right > figure { + &__images { + display: flex; + gap: 1rem; + width: var(--float-image-width, 50%); + } + + &__images > figure { + flex: 1; + min-width: 0; + margin: 0; + } + + &--right > figure, + &--right > .m-float-image__images { float: right; margin-left: 2rem; } - &--left > figure { + &--left > figure, + &--left > .m-float-image__images { float: left; margin-right: 2rem; } + + @media (max-width: $breakpoint-md) { + &__images { + flex-direction: column; + float: none; + margin: 0 0 1rem; + width: 100%; + } + } } diff --git a/content/operator/cd/index.de.md b/content/operator/cd/index.de.md index 6d6958be4..ba607ee8c 100644 --- a/content/operator/cd/index.de.md +++ b/content/operator/cd/index.de.md @@ -26,32 +26,11 @@ Die České dráhy (ČD) ist die staatliche Eisenbahngesellschaft der [Tschechis FIP Freifahrtscheine und FIP 50 Tickets sind auf Verbindungen der ČD gültig. Bei grenzüberschreitenden Fahrten muss entweder ein durchgängiges FIP 50 Ticket oder FIP Freifahrtscheine beider Länder vorhanden sein. -{{< highlight important >}} - -{{< float-image -src="cd-fip-map-overview-26.webp" -alt="FIP Gültigkeitskarte Überblick für Tschechien" -caption="[Überblick FIP Gültigkeitskarte](/en/operator/cd/cd-fip-map-overview-26.webp) für Tschechien (© Petr Duda)" -width="40%" -position="left" >}} - +{{% highlight important %}} Auf einigen Routen und Regionen gelten keine FIP Vergünstigungen, obwohl die Verbindungen von der ČD betrieben werden. Teilweise sind Strecken auch zuschlagspflichtig. -Für einen ersten Eindruck, kann die Übersichtskarte für FIP Vergünstigungen in Tschechien genutzt werden. -{{< /float-image >}} - -{{< float-image -src="cd-fip-map-detail-26.webp" -alt="FIP Gültigkeitskarte Detail für Tschechien" -caption="[Detail FIP Gültigkeitskarte](/en/operator/cd/cd-fip-map-detail-26.webp) für Tschechien (© Petr Duda)" -width="40%" -position="left" >}} -Für detaillierte Informartionen kann die Detailkarte für FIP Vergünstigungen genutzt werden. - -Weitere Informationen: [Verbindungen der ČD ohne FIP](#verbindungen-der-čd-ohne-fip) und [ČD kommerzielle Verbindungen (zuschlagspflichtig)](#čd-kommerzielle-verbindungen-zuschlagspflichtig) -{{< /float-image >}} - -{{< /highlight >}} +Weitere Informationen in den [tariflichen Besonderheiten](#tarifliche-besonderheiten) auf dieser Seite. +{{% /highlight %}} ## Zugkategorien und Reservierungen @@ -278,11 +257,23 @@ Für reguläre Fahrkarten reisen Kinder bis 6 Jahre in der 2. Klasse kostenlos. ## Tarifliche Besonderheiten +Auf einigen Routen und Regionen gelten keine FIP Vergünstigungen, obwohl die Verbindungen von der ČD betrieben werden. Teilweise sind Strecken auch zuschlagspflichtig. + +Für eine Übersicht der Gültigkeit kann die Übersichtskarte hier verwendet werden. Ausführlichere Informationen finden sich in der Detailkarte und den konkreten Regelungen in den folgenden Abschnitten zu [ČD Kommerzielle Verbindungen (zuschlagspflichtig)](#čd-kommerzielle-verbindungen-zuschlagspflichtig) und [Verbindungen der ČD ohne FIP](#verbindungen-der-čd-ohne-fip). + +{{< float-image +src=`["cd-fip-map-overview-26.webp","cd-fip-map-detail-26.webp"]` +alt=`["FIP Gültigkeitskarte Überblick für Tschechien","FIP Gültigkeitskarte Detail für Tschechien"]` +caption=`["[Überblick FIP Gültigkeitskarte (Vollbild)](/en/operator/cd/cd-fip-map-overview-26.webp) für Tschechien (© Petr Duda)","[Detail FIP Gültigkeitskarte (Vollbild)](/en/operator/cd/cd-fip-map-detail-26.webp) für Tschechien (© Petr Duda)"]` +width="100%" +position="left">}} +{{< /float-image >}} + ### ČD Kommerzielle Verbindungen (zuschlagspflichtig) Auf sogenannten _kommerziellen_ Verbindungen der ČD muss ein Zuschlag gekauft werden. Diese umfassen in der Regel nur bestimmte Züge der Zugkategorien `SC`, `EC`, `IC` und `R`. [^3] -Als Orientierung können die [FIP Gültigkeitskarten für Tschechien](#gültigkeit-fip-tickets) genutzt werden. +Als Orientierung können die [FIP Gültigkeitskarten für Tschechien](#tarifliche-besonderheiten) genutzt werden. Betroffene Verbindungen im Detail: @@ -532,7 +523,7 @@ Grundsätzlich gilt FIP theoretisch in keinen ČD Zügen, die im Rahmen von gewo Für Verkehre, die von regionalen Gemeinden vergeben werden (Züge der Kategorie `SP` und `OS`), gilt FIP in einigen Regionen überhaupt nicht. -Als Orientierung kann die [FIP Gültigkeitekarte für Tschechien](#gültigkeit-fip-tickets) genutzt werden. +Als Orientierung kann die [FIP Gültigkeitekarte für Tschechien](#tarifliche-besonderheiten) genutzt werden. Betrofene Regionen im Detail: diff --git a/content/operator/cd/index.en.md b/content/operator/cd/index.en.md index f86cb1a89..2a735c73f 100644 --- a/content/operator/cd/index.en.md +++ b/content/operator/cd/index.en.md @@ -26,32 +26,11 @@ aliases: FIP Coupons and FIP 50 Tickets are valid on ČD services. For cross-border journeys, either a continuous FIP 50 Ticket or FIP Coupons for both countries are required. -{{< highlight important >}} - -{{< float-image -src="cd-fip-map-overview-26.webp" -alt="FIP validity map overview for Czechia" -caption="[Overview FIP validity map](/en/operator/cd/cd-fip-map-overview-26.webp) for Czechia (© Petr Duda)" -width="40%" -position="left" >}} - +{{% highlight important %}} On some routes and in some regions, FIP benefits are not valid, even if the services are operated by ČD. Some routes also require a surcharge. -For a first impression, the overview map for FIP benefits in Czechia can be used. -{{< /float-image >}} - -{{< float-image -src="cd-fip-map-detail-26.webp" -alt="FIP validity map detail for Czechia" -caption="[Detailed FIP validity map](/en/operator/cd/cd-fip-map-detail-26.webp) for Czechia (© Petr Duda)" -width="40%" -position="left" >}} -For detailed information, the detailed map for FIP benefits can be used. - -Further information: [ČD services without FIP](#čd-services-without-fip) and [ČD commercial services (surcharge required)](#čd-commercial-services-surcharge-required) -{{< /float-image >}} - -{{< /highlight >}} +Further information in the [Special Tariff Conditions](#special-tariff-conditions) on this page. +{{% /highlight %}} ## Train Categories and Reservations @@ -278,11 +257,23 @@ For regular tickets, children up to 6 years travel free in 2nd class. Children u ## Special Tariff Conditions +On some routes and in some regions, FIP benefits are not valid, even if the services are operated by ČD. Some routes also require a surcharge. + +For an overview of validity, the overview map can be used here. More detailed information can be found in the detailed map and the specific rules in the following sections on [ČD Commercial Services (Surcharge Required)](#čd-commercial-services-surcharge-required) and [ČD Services Without FIP](#čd-services-without-fip). + +{{< float-image +src=`["cd-fip-map-overview-26.webp","cd-fip-map-detail-26.webp"]` +alt=`["FIP validity map overview for Czechia","FIP validity map detail for Czechia"]` +caption=`["[Overview FIP validity map (full view)](/en/operator/cd/cd-fip-map-overview-26.webp) for Czechia (© Petr Duda)","[Detailed FIP validity map (full view)](/en/operator/cd/cd-fip-map-detail-26.webp) for Czechia (© Petr Duda)"]` +width="100%" +position="left">}} +{{< /float-image >}} + ### ČD Commercial Services (Surcharge Required) On so-called _commercial_ services operated by ČD, a surcharge must be purchased. These usually include only certain trains in the `SC`, `EC`, `IC`, and `R` categories. [^3] -The [FIP validity maps for Czechia](#validity-of-fip-tickets) can be used as a guide. +The [FIP validity maps for Czechia](#special-tariff-conditions) can be used as a guide. Affected services in detail: @@ -532,7 +523,7 @@ In principle, FIP is not valid on any ČD trains that operate under public tende For services contracted by regional authorities (trains in the `SP` and `OS` categories), FIP is not valid at all in some regions. -The [FIP validity map for Czechia](#validity-of-fip-tickets) can be used as a guide. +The [FIP validity map for Czechia](#special-tariff-conditions) can be used as a guide. Affected regions in detail: diff --git a/content/operator/cd/index.fr.md b/content/operator/cd/index.fr.md index ad2ffe2e5..7721e4f04 100644 --- a/content/operator/cd/index.fr.md +++ b/content/operator/cd/index.fr.md @@ -26,32 +26,11 @@ aliases: Les Coupons FIP et les Billets FIP 50 sont valables sur les services ČD. Pour les trajets transfrontaliers, un Billet FIP 50 continu ou des Coupons FIP valables dans chaque pays sont nécessaires. -{{< highlight important >}} - -{{< float-image -src="cd-fip-map-overview-26.webp" -alt="Carte de validité FIP vue d’ensemble pour la Tchéquie" -caption="[Carte de validité FIP vue d’ensemble](/en/operator/cd/cd-fip-map-overview-26.webp) pour la Tchéquie (© Petr Duda)" -width="40%" -position="left" >}} - +{{% highlight important %}} Sur certaines lignes et dans certaines régions, les avantages FIP ne sont pas valables, même si les trains sont exploités par ČD. Certaines lignes nécessitent également un supplément. -Pour un premier aperçu, la carte de validité FIP pour la Tchéquie peut être consultée. -{{< /float-image >}} - -{{< float-image -src="cd-fip-map-detail-26.webp" -alt="Carte de validité FIP détaillée pour la Tchéquie" -caption="[Carte de validité FIP détaillée](/en/operator/cd/cd-fip-map-detail-26.webp) pour la Tchéquie (© Petr Duda)" -width="40%" -position="left" >}} -Pour des informations détaillées, la carte détaillée de validité FIP peut être consultée. - -Plus d’informations : [Services ČD sans FIP](#services-čd-sans-fip) et [Liaisons commerciales ČD (supplément obligatoire)](#liaisons-commerciales-čd-supplément-obligatoire) -{{< /float-image >}} - -{{< /highlight >}} +Plus d’informations dans les [Conditions tarifaires spéciales](#conditions-tarifaires-spéciales) sur cette page. +{{% /highlight %}} ## Catégories de trains et réservations @@ -278,11 +257,23 @@ Pour les billets ordinaires, les enfants jusqu’à 6 ans voyagent gratuitement ## Conditions tarifaires spéciales +Sur certaines lignes et dans certaines régions, les avantages FIP ne sont pas valables, même si les trains sont exploités par ČD. Certaines lignes nécessitent également un supplément. + +Pour un aperçu de la validité, la carte de vue d’ensemble peut être consultée ici. Des informations plus détaillées sont disponibles dans la carte détaillée et les règles spécifiques dans les sections suivantes sur les [Liaisons commerciales ČD (supplément obligatoire)](#liaisons-commerciales-čd-supplément-obligatoire) et les [Services ČD sans FIP](#services-čd-sans-fip). + +{{< float-image +src=`["cd-fip-map-overview-26.webp","cd-fip-map-detail-26.webp"]` +alt=`["Carte de validité FIP vue d’ensemble pour la Tchéquie","Carte de validité FIP détaillée pour la Tchéquie"]` +caption=`["[Carte de validité FIP vue d’ensemble (vue complète)](/en/operator/cd/cd-fip-map-overview-26.webp) pour la Tchéquie (© Petr Duda)","[Carte de validité FIP détaillée (vue complète)](/en/operator/cd/cd-fip-map-detail-26.webp) pour la Tchéquie (© Petr Duda)"]` +width="100%" +position="left">}} +{{< /float-image >}} + ### Liaisons commerciales ČD (supplément obligatoire) Sur les liaisons dites _commerciales_ de ČD, un supplément doit être acheté. Cela concerne généralement uniquement certains trains des catégories `SC`, `EC`, `IC` et `R`. [^3] -Les [cartes de validité FIP pour la Tchéquie](#validité-des-billets-fip) peuvent servir d’orientation. +Les [cartes de validité FIP pour la Tchéquie](#conditions-tarifaires-spéciales) peuvent servir d’orientation. Liaisons concernées en détail : @@ -532,7 +523,7 @@ En principe, le FIP n’est pas valable dans les trains ČD exploités dans le c Pour les services attribués par des collectivités régionales (trains des catégories `SP` et `OS`), le FIP n’est pas du tout valable dans certaines régions. -La [carte de validité FIP pour la Tchéquie](#validité-des-billets-fip) peut servir d’orientation. +La [carte de validité FIP pour la Tchéquie](#conditions-tarifaires-spéciales) peut servir d’orientation. Régions concernées en détail : diff --git a/layouts/partials/parse-list-param.html b/layouts/partials/parse-list-param.html new file mode 100644 index 000000000..b28188367 --- /dev/null +++ b/layouts/partials/parse-list-param.html @@ -0,0 +1,24 @@ +{{- $raw := strings.TrimSpace (. | default "") -}} +{{- $items := slice -}} +{{- if and (hasPrefix $raw "[") (hasSuffix $raw "]") -}} + {{- $listRaw := strings.TrimSpace (strings.TrimSuffix "]" (strings.TrimPrefix "[" $raw)) -}} + {{- if $listRaw -}} + {{- range split $listRaw "," -}} + {{- $itemRaw := strings.TrimSpace . -}} + {{- $item := $itemRaw -}} + {{- if and (hasPrefix $itemRaw "\"") (hasSuffix $itemRaw "\"") -}} + {{- $item = strings.TrimSpace (strings.TrimSuffix "\"" (strings.TrimPrefix "\"" $itemRaw)) -}} + {{- else if or (hasPrefix $itemRaw "\"") (hasSuffix $itemRaw "\"") -}} + {{- errorf "float-image: invalid quoted list item %q" $itemRaw -}} + {{- end -}} + {{- if $item -}} + {{- $items = $items | append $item -}} + {{- end -}} + {{- end -}} + {{- end -}} +{{- else if or (hasPrefix $raw "[") (hasSuffix $raw "]") -}} + {{- errorf "float-image: list parameters must use [\"value1\",\"value2\"] syntax" -}} +{{- else if $raw -}} + {{- $items = $items | append $raw -}} +{{- end -}} +{{- return $items -}} diff --git a/layouts/shortcodes/float-image.html b/layouts/shortcodes/float-image.html index 1ee1b61ce..4fda9b9c6 100644 --- a/layouts/shortcodes/float-image.html +++ b/layouts/shortcodes/float-image.html @@ -1,20 +1,67 @@ -{{- $image := $.Page.Resources.GetMatch (.Get "src") -}} -{{- $alt := .Get "alt" -}} -{{- $caption := .Get "caption" -}} +{{- $srcItems := partial "parse-list-param.html" (.Get "src" | default "") -}} +{{- $altItems := partial "parse-list-param.html" (.Get "alt" | default "") -}} +{{- $captionItems := partial "parse-list-param.html" (.Get "caption" | default "") -}} {{- $width := .Get "width" | default "50%" -}} {{- $position := .Get "position" | default "right" -}} +{{- if eq (len $srcItems) 0 -}} + {{- errorf "float-image: no valid src provided in %s" $.Page.File.Path -}} +{{- end -}} -
- {{- partial "image" - (dict - "image" $image - "alt" $alt - "caption" ($caption | $.Page.RenderString) - "width" $width - "Page" .Page - ) - -}} +{{- $images := slice -}} +{{- range $srcItems -}} + {{- $image := $.Page.Resources.GetMatch . -}} + {{- if not $image -}} + {{- errorf "float-image: image %q not found in %s" . $.Page.File.Path -}} + {{- end -}} + {{- $images = $images | append $image -}} +{{- end -}} + + +
+ {{- if gt (len $images) 1 -}} +
+ {{- range $index, $image := $images -}} + {{- $currentAlt := "" -}} + {{- if gt (len $altItems) $index -}} + {{- $currentAlt = index $altItems $index -}} + {{- end -}} + + {{- $currentCaption := "" -}} + {{- if gt (len $captionItems) $index -}} + {{- $currentCaption = index $captionItems $index | $.Page.RenderString -}} + {{- end -}} + + {{- partial "image" + (dict + "image" $image + "alt" $currentAlt + "caption" $currentCaption + "width" "100%" + "Page" $.Page + ) + -}} + {{- end -}} +
+ {{- else -}} + {{- $singleAlt := "" -}} + {{- if gt (len $altItems) 0 -}} + {{- $singleAlt = index $altItems 0 -}} + {{- end -}} + {{- $singleCaption := "" -}} + {{- if gt (len $captionItems) 0 -}} + {{- $singleCaption = index $captionItems 0 | $.Page.RenderString -}} + {{- end -}} + {{- partial "image" + (dict + "image" (index $images 0) + "alt" $singleAlt + "caption" $singleCaption + "width" $width + "Page" .Page + ) + -}} + {{- end -}}
{{- .Inner | $.Page.RenderString -}}
From 1b69799eb801c819bc8717a5955367374499ef1d Mon Sep 17 00:00:00 2001 From: lennartrommeiss <61516567+lenderom@users.noreply.github.com> Date: Thu, 14 May 2026 12:36:30 +0200 Subject: [PATCH 2/2] style: format float-image shortcode --- layouts/shortcodes/float-image.html | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/layouts/shortcodes/float-image.html b/layouts/shortcodes/float-image.html index 4fda9b9c6..7a99e8702 100644 --- a/layouts/shortcodes/float-image.html +++ b/layouts/shortcodes/float-image.html @@ -18,7 +18,10 @@ {{- end -}} -
+
{{- if gt (len $images) 1 -}}
{{- range $index, $image := $images -}}