{{- /*
    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 -}}
{{- if $issueData -}}
{{ $issueData.Datum.When.Day }}.{{ $issueData.Datum.When.Month }}.{{ $issueData.Datum.When.Year }}
{{- else -}}
{{ $issue.When.Year }} Nr. {{ $issue.Nr }}
{{- end -}}
{{- if $issue.Von }} S. {{ $issue.Von }}{{- if and $issue.Bis (ne $issue.Von $issue.Bis) -}}
-{{ $issue.Bis }}
{{- end -}}
{{- end -}}