Omphaloskepsis-2/layouts/shortcodes/abbr.html
2023-04-08 12:57:21 -06:00

32 lines
1.6 KiB
HTML

{{ with where ( $.Site.Data.abbreviations .Params.abbr ) }}
{{ if ( or ( eq .Params.mode "shortTitle" ) ( eq .Params.mode "shortTitlePl" ) ) }}
<abbr class="abbr" title="
{{- if ( eq .Params.mode "shortTitle" ) }}
{{ .shortTitle }}
{{ else if ( eq .Params.mode "shortTitlePl" ) }}
{{ if .shortTitlePl }}{{ .shortTitlePl }}{{ else }}{{ .shortTitle }}s{{ end }}
{{ end -}}
">
{{- if ( eq .Params.mode "shortTitle" ) }}
{{ .shortTitle }}
{{ else if ( eq .Params.mode "shortTitlePl" ) }}
{{ if .shortTitlePl }}{{ .shortTitlePl }}{{ else }}{{ .shortTitle }}s{{ end }}
{{ end -}}
</abbr>
{{ else if ( or ( eq .Params.mode "longtitle" ) ( eq .Params.mode "longTitlePl" ) ) }}
{{- if ( eq .Params.mode "longTitle" ) }}
{{ .longTitle }}
{{ else if ( eq .Params.mode "longTitlePl" ) }}
{{ if .longTitlePl }}{{ .longTitlePl }}{{ else }}{{ .longTitle }}s{{ end }}
{{ end -}}
{{ else if ( or ( eq .Params.mode "fullTitle" ) ( eq .Params.mode "fullTitlePl" ) ) }}
{{ if ( eq .Params.mode "fullTitle" ) }}
{{ .longTitle }}&nbsp;(<abbr>{{ .short }}</abbr>)
{{ else if ( eq .Params.mode "fullTitlePl" ) }}
{{- if .longTitlePl }}{{ .longTitlePl }}{{ else }}{{ .longTitle }}s{{ end -}}
&nbsp;(<abbr>{{ if .shortPl }}{{ .shortPl }}{{ else }}{{ .short }}s{{ end }}</abbr>)
{{ end }}
{{ end }}
{{ else }}
{{ errorf "No definition found for abbreviation '%q'" .Params.abbr }}
{{ end }}