Skip to content

Commit 654935f

Browse files
committed
feat: Render FIP Validity from params
1 parent af11e4b commit 654935f

File tree

10 files changed

+196
-18
lines changed

10 files changed

+196
-18
lines changed

archetypes/operator/index.en.md

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,11 @@ country:
88
- "country2"
99
- "country3"
1010
operator: "{{ .File.ContentBaseName }}"
11+
Params:
12+
fip_coupon: true # <true/false>
13+
fip_coupon_relatives: false # <true/false>
14+
fip_50_ticket: true # <true/false>
15+
fip_global_fare: true # <true/false>
1116
---
1217

1318
<!-- Remove the WIP snippet if the page is complete -->
@@ -30,15 +35,14 @@ operator: "{{ .File.ContentBaseName }}"
3035

3136
## Validity of FIP Tickets
3237

38+
{{< fip-validity >}}{{< /fip-validity >}}
39+
3340
<!--
34-
The ticket categories may vary depending on the operator.
41+
The fip-validity shortcode reads from the Params in the frontmatter.
42+
You can add additional notes inside the shortcode tags (e.g., links to specific sections).
43+
Example: {{< fip-validity >}}(For international trains, see [section](#anchor)){{< /fip-validity >}}
3544
-->
3645

37-
FIP Coupon: <✅/⛔> \
38-
FIP Coupon for relatives: <✅/⛔> \
39-
FIP 50 Tickets: <✅/⛔> \
40-
FIP Global Fare: <✅/⛔>
41-
4246
<!--
4347
Where are FIP 50 Tickets/FIP Coupons valid and are there any restrictions? Which ticket is required for entry (e.g., continuous FIP 50 ticket or FIP Coupons of both countries)?
4448
-->

assets/sass/fipValidity.scss

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
.o-fip-validity {
2+
display: flex;
3+
flex-direction: column;
4+
gap: 0.8rem;
5+
margin-bottom: 1.2rem;
6+
7+
&__tags {
8+
display: flex;
9+
flex-wrap: wrap;
10+
gap: 0.6rem;
11+
}
12+
13+
&__footnotes {
14+
display: flex;
15+
flex-direction: column;
16+
gap: 0.4rem;
17+
font-size: 0.9em;
18+
}
19+
20+
&__footnote {
21+
display: flex;
22+
gap: 0.4rem;
23+
align-items: baseline;
24+
}
25+
26+
&__footnote-number {
27+
font-weight: 600;
28+
flex-shrink: 0;
29+
}
30+
31+
&__footnote-text {
32+
p {
33+
margin: 0;
34+
display: inline;
35+
}
36+
}
37+
38+
&__note {
39+
p {
40+
margin: 0;
41+
display: inline;
42+
}
43+
}
44+
}

assets/sass/main.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,4 @@
1717
@import "startpage.scss";
1818
@import "interactiveMap.scss";
1919
@import "dropdown.scss";
20+
@import "fipValidity.scss";

content/operator/sncf/index.de.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,11 @@ country:
1010
- "belgium"
1111
- "luxembourg"
1212
operator: "sncf"
13+
Params:
14+
fip_coupon: true
15+
fip_coupon_relatives: false
16+
fip_50_ticket: true
17+
fip_global_fare: true
1318
---
1419

1520
Die SNCF (Société Nationale des Chemins de fer Français) ist die französische Staatsbahn und die wichtigste Bahngesellschaft in Frankreich. Sie betreibt fast alle Fern- und Regionalzüge in Frankreich.
@@ -24,10 +29,7 @@ Die SNCF (Société Nationale des Chemins de fer Français) ist die französisch
2429

2530
## Gültigkeit FIP Tickets
2631

27-
FIP Freifahrtschein: ✅ \
28-
FIP Freifahrt Angehörige: ⛔ \
29-
FIP 50 Tickets: ✅ \
30-
FIP Globalpreis: ✅ (Für internationale `TGV` Züge, siehe [Grenzüberschreitende TGV inOui / ICE Züge](#grenzüberschreitende-tgv-inoui--ice-züge))
32+
{{< fip-validity fip_global_fare_footnote="Für internationale `TGV` Züge, siehe [Grenzüberschreitende TGV inOui / ICE Züge](#grenzüberschreitende-tgv-inoui--ice-züge)">}}
3133

3234
FIP Freifahrtscheine und FIP 50 Tickets sind auf Verbindungen der SNCF gültig. Bei grenzüberschreitenden Fahrten im Nahverkehr muss entweder ein durchgängiges FIP 50 Ticket oder FIP Freifahrtscheine beider Länder vorhanden sein. Auf internationalen Fernverkehrsverbindungen mittels `TGV` oder `ICE` gelten jedoch Globalpreise, siehe [Grenzüberschreitende TGV inOui / ICE Züge](#grenzüberschreitende-tgv-inoui--ice-züge).
3335

content/operator/sncf/index.en.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,11 @@ country:
1010
- "belgium"
1111
- "luxembourg"
1212
operator: "sncf"
13+
Params:
14+
fip_coupon: true
15+
fip_coupon_relatives: false
16+
fip_50_ticket: true
17+
fip_global_fare: true
1318
---
1419

1520
SNCF (Société Nationale des Chemins de fer Français) is the French national railway company and the main rail operator in France. It operates almost all long-distance and regional trains in France.
@@ -24,10 +29,7 @@ SNCF (Société Nationale des Chemins de fer Français) is the French national r
2429

2530
## Validity of FIP Tickets
2631

27-
FIP Coupon: ✅ \
28-
FIP Coupon for relatives: ⛔ \
29-
FIP 50 Ticket: ✅ \
30-
FIP Global Fare: ✅ (For international `TGV` trains, see [International TGV inOui / ICE trains](#international-tgv-inoui--ice-trains))
32+
{{< fip-validity fip_global_fare_footnote="For international `TGV` trains, see [International TGV inOui / ICE trains](#international-tgv-inoui--ice-trains)">}}
3133

3234
FIP Coupons and FIP 50 Tickets are valid on SNCF services. For cross-border journeys on local trains, either a continuous FIP 50 Ticket or FIP Coupons for both countries are required. For international long-distance services (`TGV` or `ICE`), global fares apply (see [International TGV inOui / ICE trains](#international-tgv-inoui--ice-trains)).
3335

content/operator/sncf/index.fr.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,11 @@ country:
1010
- "belgium"
1111
- "luxembourg"
1212
operator: "sncf"
13+
Params:
14+
fip_coupon: true
15+
fip_coupon_relatives: false
16+
fip_50_ticket: true
17+
fip_global_fare: true
1318
---
1419

1520
La SNCF (Société Nationale des Chemins de fer Français) est la compagnie ferroviaire nationale française et le principal opérateur ferroviaire en France. Elle exploite la quasi-totalité des trains grandes lignes et régionaux du pays.
@@ -24,10 +29,7 @@ La SNCF (Société Nationale des Chemins de fer Français) est la compagnie ferr
2429

2530
## Validité des Billets FIP
2631

27-
Coupon FIP : ✅ \
28-
Coupon FIP accompagnant : ⛔ \
29-
Billet FIP 50 : ✅ \
30-
Tarif Global FIP : ✅ (pour les trains internationaux `TGV`, voir [Trains TGV inOui / ICE internationaux](#trains-tgv-inoui--ice-internationaux))
32+
{{< fip-validity fip_global_fare_footnote="pour les trains internationaux `TGV`, voir [Trains TGV inOui / ICE internationaux](#trains-tgv-inoui--ice-internationaux)">}}
3133

3234
Les Coupons FIP et Billets FIP 50 sont valables sur les services SNCF. Pour les trajets transfrontaliers en trains régionaux, il faut soit un Billet FIP 50 continu, soit des Coupons FIP valables dans chaque pays. Sur les trains grandes lignes internationaux (`TGV` ou `ICE`), des Tarifs Globaux s’appliquent (voir [Trains TGV inOui / ICE internationaux](#trains-tgv-inoui--ice-internationaux)).
3335

i18n/de.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,11 @@ country:
2727
other: Länder
2828
discord: FIP Guide Community
2929
editPage: Seite bearbeiten
30+
fipValidity:
31+
fip-50-ticket: FIP 50 Ticket
32+
fip-coupon: FIP Freifahrtschein
33+
fip-coupon-relatives: FIP Freifahrt Angehörige
34+
fip-global-fare: FIP Globalpreis
3035
footer-love:
3136
aria-label: Made with love in Europe
3237
text: Made with ♥️ in Europe

i18n/en.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,11 @@ country:
2626
other: countries
2727
discord: FIP Guide Community
2828
editPage: Edit page
29+
fipValidity:
30+
fip-50-ticket: FIP 50 Ticket
31+
fip-coupon: FIP Coupon
32+
fip-coupon-relatives: FIP Coupon for relatives
33+
fip-global-fare: FIP Global Fare
2934
footer-love:
3035
aria-label: Made with love in Europe
3136
text: Made with ♥️ in Europe

i18n/fr.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,11 @@ country:
2727
countryselection: Choisir un pays
2828
discord: Communauté FIP Guide
2929
editPage: Modifier la page
30+
fipValidity:
31+
fip-50-ticket: Billet FIP 50
32+
fip-coupon: Coupon FIP
33+
fip-coupon-relatives: Coupon FIP accompagnant
34+
fip-global-fare: Tarif Global FIP
3035
footer-love:
3136
aria-label: Fait avec amour en Europe
3237
text: Fait avec ♥️ en Europe
Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
{{- $page := .Page -}}
2+
{{- $footnotes := dict -}}
3+
4+
{{- with .Get "fip_coupon_footnote" -}}
5+
{{- $footnotes = merge $footnotes (dict "fip_coupon" .) -}}
6+
{{- end -}}
7+
{{- with .Get "fip_coupon_relatives_footnote" -}}
8+
{{- $footnotes = merge $footnotes (dict "fip_coupon_relatives" .) -}}
9+
{{- end -}}
10+
{{- with .Get "fip_50_ticket_footnote" -}}
11+
{{- $footnotes = merge $footnotes (dict "fip_50_ticket" .) -}}
12+
{{- end -}}
13+
{{- with .Get "fip_global_fare_footnote" -}}
14+
{{- $footnotes = merge $footnotes (dict "fip_global_fare" .) -}}
15+
{{- end -}}
16+
17+
{{- $footnoteCounter := 0 -}}
18+
{{- $footnoteMap := dict -}}
19+
20+
21+
<div class="o-fip-validity">
22+
<div class="o-fip-validity__tags">
23+
{{- if isset $page.Params "fip_coupon" -}}
24+
{{- $accepted := $page.Params.fip_coupon -}}
25+
{{- $footnoteNum := "" -}}
26+
{{- if isset $footnotes "fip_coupon" -}}
27+
{{- $footnoteCounter = add $footnoteCounter 1 -}}
28+
{{- $footnoteNum = printf "%d)" $footnoteCounter -}}
29+
{{- $footnoteMap = merge $footnoteMap (dict (string $footnoteCounter) (index $footnotes "fip_coupon")) -}}
30+
{{- end -}}
31+
{{- partial "tag" (
32+
dict
33+
"Icon" (cond $accepted "check_circle" "cancel")
34+
"Text" "fipValidity.fip-coupon"
35+
"Type" (cond $accepted "success" "error")
36+
"Footnote" $footnoteNum
37+
)
38+
}}
39+
{{- end -}}
40+
41+
{{- if isset $page.Params "fip_coupon_relatives" -}}
42+
{{- $accepted := $page.Params.fip_coupon_relatives -}}
43+
{{- $footnoteNum := "" -}}
44+
{{- if isset $footnotes "fip_coupon_relatives" -}}
45+
{{- $footnoteCounter = add $footnoteCounter 1 -}}
46+
{{- $footnoteNum = printf "%d)" $footnoteCounter -}}
47+
{{- $footnoteMap = merge $footnoteMap (dict (string $footnoteCounter) (index $footnotes "fip_coupon_relatives")) -}}
48+
{{- end -}}
49+
{{- partial "tag" (
50+
dict
51+
"Icon" (cond $accepted "check_circle" "cancel")
52+
"Text" "fipValidity.fip-coupon-relatives"
53+
"Type" (cond $accepted "success" "error")
54+
"Footnote" $footnoteNum
55+
)
56+
}}
57+
{{- end -}}
58+
59+
{{- if isset $page.Params "fip_50_ticket" -}}
60+
{{- $accepted := $page.Params.fip_50_ticket -}}
61+
{{- $footnoteNum := "" -}}
62+
{{- if isset $footnotes "fip_50_ticket" -}}
63+
{{- $footnoteCounter = add $footnoteCounter 1 -}}
64+
{{- $footnoteNum = printf "%d)" $footnoteCounter -}}
65+
{{- $footnoteMap = merge $footnoteMap (dict (string $footnoteCounter) (index $footnotes "fip_50_ticket")) -}}
66+
{{- end -}}
67+
{{- partial "tag" (
68+
dict
69+
"Icon" (cond $accepted "check_circle" "cancel")
70+
"Text" "fipValidity.fip-50-ticket"
71+
"Type" (cond $accepted "success" "error")
72+
"Footnote" $footnoteNum
73+
)
74+
}}
75+
{{- end -}}
76+
77+
{{- if isset $page.Params "fip_global_fare" -}}
78+
{{- $accepted := $page.Params.fip_global_fare -}}
79+
{{- $footnoteNum := "" -}}
80+
{{- if isset $footnotes "fip_global_fare" -}}
81+
{{- $footnoteCounter = add $footnoteCounter 1 -}}
82+
{{- $footnoteNum = printf "%d)" $footnoteCounter -}}
83+
{{- $footnoteMap = merge $footnoteMap (dict (string $footnoteCounter) (index $footnotes "fip_global_fare")) -}}
84+
{{- end -}}
85+
{{- partial "tag" (
86+
dict
87+
"Icon" (cond $accepted "check_circle" "cancel")
88+
"Text" "fipValidity.fip-global-fare"
89+
"Type" (cond $accepted "success" "error")
90+
"Footnote" $footnoteNum
91+
)
92+
}}
93+
{{- end -}}
94+
</div>
95+
96+
{{- if gt (len $footnoteMap) 0 -}}
97+
<div class="o-fip-validity__footnotes">
98+
{{- range $index, $text := $footnoteMap -}}
99+
<div class="o-fip-validity__footnote">
100+
<span class="o-fip-validity__footnote-number">{{ $index }})</span>
101+
<span class="o-fip-validity__footnote-text"
102+
>{{ $text | $page.RenderString }}</span
103+
>
104+
</div>
105+
{{- end -}}
106+
</div>
107+
{{- end -}}
108+
</div>

0 commit comments

Comments
 (0)