Omphaloskepsis-2/layouts/shortcodes/abbr.html

36 lines
1.7 KiB
HTML
Raw Normal View History

2023-07-01 03:16:59 +00:00
{{- $abbr := .Get 0 -}}
{{- $mode := default "shortTitle" ( .Get 1 ) -}}
{{- with ( index $.Site.Data.abbreviations $abbr ) -}}
{{- if ( or ( eq $mode "shortTitle" ) ( eq $mode "shortTitlePl" ) ) -}}
2023-04-08 18:57:21 +00:00
<abbr class="abbr" title="
2023-07-01 03:16:59 +00:00
{{- if ( eq $mode "shortTitle" ) -}}
{{- .longTitle -}}
{{- else if ( eq $mode "shortTitlePl" ) -}}
{{- with .longTitlePl -}}{{- . -}}{{- else -}}{{- .longTitle -}}s{{- end -}}
{{- end -}}
2023-04-08 18:57:21 +00:00
">
2023-07-01 03:16:59 +00:00
{{- if ( eq $mode "shortTitle" ) -}}
{{- .shortTitle | safeHTML -}}
{{- else if ( eq $mode "shortTitlePl" ) -}}
{{- with .shortTitlePl -}}{{- . | safeHTML -}}{{- else -}}{{- .shortTitle | safeHTML -}}s{{- end -}}
{{- end -}}
2023-04-08 18:57:21 +00:00
</abbr>
2023-07-01 03:16:59 +00:00
{{- else if ( or ( eq $mode "longtitle" ) ( eq $mode "longTitlePl" ) ) -}}
{{- if ( eq $mode "longTitle" ) -}}
{{- .longTitle | safeHTML -}}
{{- else if ( eq $mode "longTitlePl" ) -}}
{{- with .longTitlePl -}}{{- . | safeHTML -}}{{- else -}}{{- .longTitle | safeHTML -}}s{{- end -}}
{{- end -}}
{{- else if ( or ( eq $mode "fullTitle" ) ( eq $mode "fullTitlePl" ) ) -}}
{{- if ( eq $mode "fullTitle" ) -}}
{{- .longTitle | safeHTML -}}&nbsp;(<abbr>{{- .shortTitle | safeHTML -}}</abbr>)
{{- else if ( eq $mode "fullTitlePl" ) -}}
{{- with .longTitlePl -}}{{- . | safeHTML -}}{{- else -}}{{- .longTitle | safeHTML -}}s{{- end -}}
&nbsp;(<abbr>{{- with .shortTitlePl -}}{{- . | safeHTML -}}{{- else -}}{{- .shortTitle | safeHTML -}}s{{- end -}}</abbr>)
{{- end -}}
{{- end -}}
{{- else -}}
{{- errorf "No definition found for abbreviation '%q'" $abbr -}}
{{- end -}}