{{- $citationStyle := "apa" }} {{- $partialPath := string (printf "bibliography/%s-style.html" $citationStyle) }} {{/* -------------------- BEGIN Bibliography path -------------------- */}} {{- $bibliographyPath := "" }} {{/* Default: check for a JSON file in the leaf bundle. */}} {{- $pageResource := $.Page.Resources.GetMatch "*bib*.json" -}} {{- if $pageResource }} {{- $constructedBibResource := printf "content/%s%s" $.Page.File.Dir $pageResource.Name }} {{- $bibliographyPath = $constructedBibResource }} {{- end }} {{- /* If a `bibFile` is specified in the page front-matter, it takes precedence over a page resource. */ -}} {{- /* `specifiedBib` must be relative to project root */ -}} {{- if $.Page.Params.bibFile }} {{- $bibliographyPath = $.Page.Params.bibFile -}} {{- end }} {{- $bibliography := getJSON $bibliographyPath -}} {{- /* -------------------- END Bibliography path -------------------- */ -}} {{ $table := .Inner | transform.Unmarshal }} {{ $page := .}}
{{ with $table.caption }} {{ end }} {{ range $index, $header := $table.headers }} {{ end }} {{ range $table.rows }} {{ $row := . }} {{ range $header := $table.headers }} {{ with $v :=(index $row .) }} {{ if eq $header "Data Provider"}} {{else if eq $header "Product Name"}} {{else if eq $header "References"}} {{else}} {{end}} {{ end }} {{ end }} {{ end }}
{{ . | markdownify }}
{{ . | humanize }}
{{range $v}} {{ if or (eq .name "unknown") (eq .name "unreleased") }} {{.name}} {{else}} {{ .name }}
{{end}} {{end}}
{{.}} {{ range $v}} {{- range where $bibliography "id" "eq" . -}} {{- $currentRef := . -}} Citation: {{- /* -------------------- BEGIN Display authors -------------------- */ -}} {{- $reference := . -}} {{- $displayAuthors := $reference.author -}} {{- if not $reference.author -}} {{- $displayAuthors = $reference.editor -}} {{- end -}} {{- if not $displayAuthors -}} {{- i18n "apa_no_author_abbr" | default "n.a." | upper -}} {{- else -}} {{- range $authorIndex, $author := $displayAuthors | first 2 -}} {{- if and (eq $authorIndex 0) (gt (len $displayAuthors) 2) -}} , {{- end -}} {{- if and (eq (len $displayAuthors) 2) (eq $authorIndex 0) -}} & {{- end -}} {{- end -}} {{ if gt (len $displayAuthors) 2 }} & al. {{- end -}} {{- end -}}, {{- /* -------------------- END Display authors -------------------- */ -}} {{- if and (isset $reference "issued") (isset $reference.issued "date-parts") -}} {{- range $index, $dateParts := (index .issued "date-parts") -}}{{/* range of dates */}} {{- range first 1 $dateParts -}}{{/* First element in date-part is the year */ -}} {{- end -}} {{- end -}} {{- end -}} {{- /* Eliminate space between css-hidden citation hover block */ -}} {{ partial $partialPath $reference }} {{end}}
{{ end }}
{{ . }}