mirror of
https://github.com/Theodor-Springmann-Stiftung/kgpz_web.git
synced 2025-10-29 17:15:31 +00:00
41 lines
1.4 KiB
Plaintext
41 lines
1.4 KiB
Plaintext
{{- /*
|
|
Global citation component for resolving IssueRef elements
|
|
Usage: {{ template "_citation" $issueRef }}
|
|
|
|
Input: xmlmodels.IssueRef with fields:
|
|
- .Nr (int): Issue number
|
|
- .Von (int): Starting page
|
|
- .Bis (int): Ending page (optional)
|
|
- .Beilage (int): Beilage number (optional)
|
|
- .When (DateAttributes): Date information
|
|
|
|
Outputs: citation text + link with minimal formatting
|
|
Automatically detects current page and styles accordingly
|
|
*/ -}}
|
|
|
|
{{- $issue := . -}}
|
|
{{- $issueKey := printf "%d-%d" $issue.When.Year $issue.Nr -}}
|
|
{{- $issueData := GetIssue $issueKey -}}
|
|
{{- $url := printf "/%s/%d" $issue.When $issue.Nr -}}
|
|
<a href="{{- $url -}}{{- if $issue.Von -}}
|
|
{{- if $issue.Beilage -}}
|
|
/b{{ $issue.Beilage }}-{{ $issue.Von }}
|
|
{{- else -}}
|
|
/{{ $issue.Von }}
|
|
{{- end -}}
|
|
{{- end -}}"
|
|
class="citation-link no-underline"
|
|
data-citation-url="{{ $url }}">
|
|
{{- if $issueData -}}
|
|
{{ $issueData.Datum.When.Day }}.{{ $issueData.Datum.When.Month }}.{{ $issueData.Datum.When.Year }}/{{ $issue.Nr }}
|
|
{{- else -}}
|
|
{{ $issue.When.Year }}/{{ $issue.Nr }}
|
|
{{- end -}}
|
|
{{- if $issue.Von }}, {{ if $issue.Beilage }}Beil. {{ else }}S. {{ end }}{{ $issue.Von }}{{- if and $issue.Bis (ne $issue.Von $issue.Bis) -}}
|
|
-{{- $issue.Bis -}}
|
|
{{- end -}}
|
|
{{- end -}}
|
|
</a>
|
|
{{- /* This is a dummy element to remove all whitespace at the end of the file, as some editiors
|
|
will insert a newline at the end of the file, UGH. */ -}}
|