-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
30 changed files
with
408 additions
and
210 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
{{ $key := index . "key" }} | ||
{{ $page := index . "page" }} | ||
{{ $linkOthers := default true (index . "linkOthers") }} | ||
{{ $bib := site.Data.bibliography.references }} | ||
{{ with $entries := where $bib "id" $key }} | ||
{{ $entry := index $entries 0 }} | ||
{{ $year := (index $entry.issued 0).year }} | ||
<span class="citation-title">{{ $entry.title }}</span>, | ||
<span class="citation-authors"> | ||
{{ range $i, $author := $entry.author }} | ||
{{ printf "%s %s" $author.given $author.family }} | ||
{{- if lt $i (sub (len $entry.author) 1)}}, {{end}} | ||
{{- end -}}. | ||
</span> | ||
{{ with index $entry "container-title" }} | ||
<span class="citation-publication">{{.}}</span> | ||
{{ end }} | ||
<span class="citation-date">({{ $year }})</span> | ||
{{ with $entry.URL }} | ||
<a class="citation-link" href="{{.}}"> | ||
Publication <i class="fa fa-external-link-alt citation-url"></i> | ||
</a> | ||
{{ end }} | ||
{{ with $entry.note }} | ||
{{ range split . "\n" }} | ||
{{ if hasPrefix . "code:" }} | ||
<a class="citation-link" {{ printf "href=%q" (trim (substr . 6) " ") | safeHTMLAttr }}> | ||
Code <i class="fa fa-external-link-alt citation-url"></i> | ||
</a> | ||
{{ else if hasPrefix . "video:" }} | ||
<a class="citation-link" {{ printf "href=%q" (trim (substr . 6) " ") | safeHTMLAttr }}> | ||
Video <i class="fa fa-external-link-alt citation-url"></i> | ||
</a> | ||
{{ end }} | ||
{{ end }} | ||
{{ end }} | ||
{{ with $term := index (site.Taxonomies.refs) $key }} | ||
{{ if $linkOthers }} | ||
{{ with $total := len (where $term.Pages "Page.RelPermalink" "ne" $page.RelPermalink) }} | ||
<a class="d-inline-block pl-4 citation-link" href="{{ $term.Page.RelPermalink }}"> | ||
— {{ $total }} other item {{- cond (gt $total 1) "s" "" }} | ||
in this site reference {{- cond (gt $total 1) "" "s" }} this. | ||
</a> | ||
{{ end }} | ||
{{ end }} | ||
{{ else }} | ||
<div class="alert alert-danger"> | ||
Reference "{{$key}}" missing in taxonomy "refs". | ||
</div> | ||
{{ end }} | ||
{{ else }} | ||
<strong>Wrong citekey: {{ $key }}</strong> | ||
{{ end }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
{{/*Include this in the document header*/}} | ||
{{ with .Params.refs }} | ||
<style> | ||
{{ range $key := . }} | ||
{{ $parts := split $key "_" }} | ||
{{ $cite := printf "%s%s%s" (substr (index $parts 0 | title) 0 3) (substr (index $parts 2) 2) (upper (substr (index $parts 1) 0 1)) }} | ||
li#refs-{{$key}}::marker { | ||
content: '[{{$cite}}] '; | ||
font-weight: 600; | ||
font-variant: small-caps; | ||
} | ||
|
||
a.cite-{{$key}}::before { | ||
content: '{{$cite}}'; | ||
} | ||
|
||
{{ end }} | ||
</style> | ||
{{ end }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<section> | ||
{{- if gt (.Page.Scratch.Get "citations" | uniq | sort) (.Page.Params.refs | uniq | sort) -}} | ||
<div class="alert alert-danger"> | ||
There are citations in the text which are not present in the | ||
<code>refs</code> section of the frontmatter. | ||
<pre>{{ .Page.Scratch.Get "citations" | uniq | sort }}</pre> | ||
<pre>{{ .Page.Params.refs | uniq | sort }}</pre> | ||
</div> | ||
{{- end -}} | ||
{{ if .Page.Params.refs }} | ||
<h1>References</h1> | ||
<ul class="references"> | ||
{{ range $index, $key := default slice .Page.Params.refs }} | ||
{{/* We use CSS in ref_labels.html.html to decorate the li elements with the citation labels */}} | ||
<li id="refs-{{$key}}"> | ||
{{ partial "citation.html.html" (dict "page" $.Page "key" $key) }} | ||
</li> | ||
{{ end }} | ||
</ul> | ||
{{ end }} | ||
</section> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{{- with .Params -}} | ||
{{- $citations := slice -}} | ||
{{- range $key := . -}} | ||
{{- $.Page.Scratch.Add "citations" (slice $key) -}} | ||
{{/* We use CSS in ref_labels.html.html create the classes */}} | ||
{{- $html := printf "<a class=\"cite-%s\" href=\"#refs-%s\"></a>" $key $key -}} | ||
{{- $citations = $citations | append $html -}} | ||
{{- end -}} | ||
<span class="citation">[{{ delimit $citations ", " | safeHTML }}]</span> | ||
{{- end -}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{{ partial "references.html.html" . }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
{{/* Adapted from Hugo's figure shortcode. https://gohugo.io/ */}} | ||
<figure{{ with .Get "class" }} class="{{ . }}"{{ end }}> | ||
{{- if .Get "link" -}} | ||
<a href="{{ .Get "link" }}"{{ with .Get "target" }} target="{{ . }}"{{ end }}{{ with .Get "rel" }} rel="{{ . }}"{{ end }}>{{- end }} | ||
{{ $src := .Get "src"}} | ||
{{- with .Page.Resources.GetMatch $src }} | ||
{{- $src = .RelPermalink }} | ||
{{- end }} | ||
<img src="{{$src | safeURL}}" | ||
{{- if or (.Get "alt") (.Get "caption") }} | ||
alt="{{ with .Get "alt" }}{{ . }}{{ else }}{{ .Get "caption" | markdownify | plainify }}{{ end }}" | ||
{{- end -}} | ||
{{- with .Get "width" }} width="{{ . }}"{{ end -}} | ||
{{- with .Get "height" }} height="{{ . }}"{{ end -}} | ||
/> | ||
{{- if .Get "link" }}</a>{{ end -}} | ||
{{- if or (.Get "title") (.Get "caption") (.Get "attr") .Inner -}} | ||
<figcaption> | ||
{{ with (.Get "title") -}} | ||
<h4>{{ . }}</h4> | ||
{{- end -}} | ||
{{- with .Inner -}} | ||
<p> | ||
{{ . }} | ||
</p> | ||
{{- end -}} | ||
</figcaption> | ||
{{- end }} | ||
</figure> |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.