Move a bunch of shortcodes and partials back from the platters theme
This commit is contained in:
parent
20d53e0df2
commit
3102dc1e56
29 changed files with 1 additions and 1 deletions
1
layouts/shortcodes/abbr.html
Normal file
1
layouts/shortcodes/abbr.html
Normal file
|
@ -0,0 +1 @@
|
|||
<abbr {{ with .Get "title" }}title="{{ . }}"{{ end }}>{{ .Inner }}</abbr>
|
1
layouts/shortcodes/anagram.html
Normal file
1
layouts/shortcodes/anagram.html
Normal file
|
@ -0,0 +1 @@
|
|||
<span class="anagram" data-replacement="{{ with .Get 1 }}{{ . }}{{ end }}">{{ with .Get 0 }}{{ . }}{{ end }}</span>
|
5
layouts/shortcodes/audio.html
Normal file
5
layouts/shortcodes/audio.html
Normal file
|
@ -0,0 +1,5 @@
|
|||
{{ $id := .Get "id" }}
|
||||
{{ $mp3 := (.Page.Resources.GetMatch (.Get "mp3")) }}
|
||||
<audio {{ with $id }}id="{{ . }}"{{ end }}>
|
||||
{{ with $mp3 }}<source src="{{ . }}" type="audio/mpeg">{{ end }}
|
||||
</audio>
|
9
layouts/shortcodes/collapse.html
Normal file
9
layouts/shortcodes/collapse.html
Normal file
|
@ -0,0 +1,9 @@
|
|||
<!---->{{ if not (.Get "summary") }}
|
||||
<!---->{{ errorf "missing param 'summary': %s" .Position }}
|
||||
<!---->{{ else if not (.Get "content") }}{{ warnf "missing param 'content': %s" .Position }}
|
||||
<!---->{{ end }}
|
||||
|
||||
<details {{ if (eq (.Get `openByDefault`) true) }}open="true" {{ end }}>
|
||||
<summary markdown="span">{{ .Get "summary" | markdownify }}</summary>
|
||||
{{ .Get "content" | markdownify }}
|
||||
</details>
|
4
layouts/shortcodes/figures/code.html
Normal file
4
layouts/shortcodes/figures/code.html
Normal file
|
@ -0,0 +1,4 @@
|
|||
{{- $trimmedInner := trim .Inner "\n " -}}
|
||||
<figure class="code">
|
||||
{{ $.Page.RenderString $trimmedInner }}
|
||||
</figure>
|
45
layouts/shortcodes/figures/image.html
Normal file
45
layouts/shortcodes/figures/image.html
Normal file
|
@ -0,0 +1,45 @@
|
|||
{{- $imgs := slice -}}
|
||||
{{- $class := .Get "class" -}}
|
||||
{{- $shouldResize := .Get "shouldResize" | default true -}}
|
||||
{{- $shouldShowTitle := (.Get "shouldShowTitle") | default true -}}
|
||||
|
||||
{{- if .Get "name" -}}
|
||||
{{- $imgs = $imgs | append (.Page.Resources.GetMatch (.Get "name")) -}}
|
||||
{{- else if .Get "names" -}}
|
||||
{{- range (split (.Get "names") ",") -}}
|
||||
{{- $imgs = $imgs | append ($.Page.Resources.GetMatch .) -}}
|
||||
{{- end -}}
|
||||
{{- else -}}
|
||||
{{ errorf "Missing name or names parameter to figures/image" }}
|
||||
{{- end -}}
|
||||
|
||||
{{- if lt (len $imgs) 0 -}}
|
||||
{{ errorf "No images found for name(s) parameter" }}
|
||||
{{- end -}}
|
||||
|
||||
<figure {{ with $class }}class="{{ . }}"{{ end }}>
|
||||
<div class=container>
|
||||
{{ range $img := $imgs }}
|
||||
{{- $linkedImg := $img -}}
|
||||
{{ if not $img }}
|
||||
{{ errorf "Found nil in images list for %s" $.Page.Permalink }}
|
||||
{{ end }}
|
||||
{{- if $shouldResize -}}
|
||||
{{ $linkedImg = $img.Fit "1280x1280" }}
|
||||
{{- end -}}
|
||||
{{- $altText := $img.Params.alt | default $img.Title -}}
|
||||
<a href="{{ $img.RelPermalink }}">
|
||||
<img src="{{ $linkedImg.RelPermalink }}"
|
||||
{{- with $altText }} alt="{{ . }}"{{- end }}
|
||||
{{- with $img.Title }} title="{{ . }}"{{- end }}>
|
||||
</a>
|
||||
{{- end }}
|
||||
</div>
|
||||
{{ if and $shouldShowTitle -}}
|
||||
{{- range $imgs -}}
|
||||
{{- if gt (len .Title) 0 -}}
|
||||
<figcaption>{{ .Title }}</figcaption>
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- end }}
|
||||
</figure>
|
4
layouts/shortcodes/figures/p5.html
Normal file
4
layouts/shortcodes/figures/p5.html
Normal file
|
@ -0,0 +1,4 @@
|
|||
{{- $id := .Get "id" -}}
|
||||
<div class="centered">
|
||||
<figure class="p5-sketch {{ with .Get "bordered" }}bordered{{ end }}" id="{{ $id }}"></figure>
|
||||
</div>
|
3
layouts/shortcodes/figures/railroad.html
Normal file
3
layouts/shortcodes/figures/railroad.html
Normal file
|
@ -0,0 +1,3 @@
|
|||
{{- $id := .Get "id" -}}
|
||||
<figure class="railroad-diagram" {{ if $id }}id="{{ $id }}"{{ end }}></figure>
|
||||
{{ .Inner }}
|
12
layouts/shortcodes/figures/youtube.html
Normal file
12
layouts/shortcodes/figures/youtube.html
Normal file
|
@ -0,0 +1,12 @@
|
|||
{{- $pc := .Page.Site.Config.Privacy.YouTube -}}
|
||||
{{- if not $pc.Disable -}}
|
||||
{{- $ytHost := cond $pc.PrivacyEnhanced "www.youtube-nocookie.com" "www.youtube.com" -}}
|
||||
{{- $id := .Get "id" | default (.Get 0) -}}
|
||||
{{- $class := .Get "class" | default (.Get 1) -}}
|
||||
{{- $title := .Get "title" | default "YouTube Video" }}
|
||||
<figure {{ with $class }}class="{{ . }}"{{ end }}>
|
||||
<div class="youtube">
|
||||
<iframe src="https://{{ $ytHost }}/embed/{{ $id }}{{ with .Get "autoplay" }}{{ if eq . "true" }}?autoplay=1{{ end }}{{ end }}" allowfullscreen frameborder=0 title="{{ $title }}"></iframe>
|
||||
</div>
|
||||
</figure>
|
||||
{{ end -}}
|
3
layouts/shortcodes/grid2.html
Normal file
3
layouts/shortcodes/grid2.html
Normal file
|
@ -0,0 +1,3 @@
|
|||
<div class="grid2">
|
||||
{{ .Inner }}
|
||||
</div>
|
21
layouts/shortcodes/img.html
Normal file
21
layouts/shortcodes/img.html
Normal file
|
@ -0,0 +1,21 @@
|
|||
{{ $img := dict }}
|
||||
{{ with .Get "name" }}
|
||||
{{ $img = $.Page.Resources.GetMatch . }}
|
||||
{{ else }}
|
||||
{{ errorf "No name given to img shortcode" }}
|
||||
{{ end }}
|
||||
|
||||
{{/* Space separated list of classes to apply to the <img> tag */}}
|
||||
{{ $classes := .Get "class" }}
|
||||
|
||||
{{ $altText := .Get "alt" | default $img.Params.alt }}
|
||||
{{ if not $altText }}
|
||||
{{ warnf "Image doesn't have alt text: %s" $img.RelPermalink }}
|
||||
{{ end }}
|
||||
|
||||
{{ $resizedImg := $img.Fit "1280x1280" }}
|
||||
<img src="{{ $resizedImg.RelPermalink }}"
|
||||
width="{{ $resizedImg.Width }}"
|
||||
height="{{ $resizedImg.Height }}"
|
||||
alt="{{ $altText }}"
|
||||
{{ with $classes }}class="{{ . }}"{{ end }}>
|
1
layouts/shortcodes/lang.html
Normal file
1
layouts/shortcodes/lang.html
Normal file
|
@ -0,0 +1 @@
|
|||
<span lang="{{ .Get 0 }}">{{ .Inner }}</span>{{- "" -}}
|
3
layouts/shortcodes/nethack/ascensions.html
Normal file
3
layouts/shortcodes/nethack/ascensions.html
Normal file
|
@ -0,0 +1,3 @@
|
|||
{{- $logfile := partial "nethack/log.html" . -}}
|
||||
{{- $numberOfAscensions := where $logfile "death.cause" "ascended" | len -}}
|
||||
{{- $numberOfAscensions | lang.FormatNumber 0 -}}
|
10
layouts/shortcodes/nethack/best_game.html
Normal file
10
layouts/shortcodes/nethack/best_game.html
Normal file
|
@ -0,0 +1,10 @@
|
|||
{{ $nethack_data := $.Site.Data.nethack.logfile }}
|
||||
{{ $logfile := slice }}
|
||||
{{ range $nethack_data }}
|
||||
{{ $logfile = $logfile | append .logfile }}
|
||||
{{ end }}
|
||||
<ol class="logfile">
|
||||
<li>
|
||||
{{ partial "nethack/logentry.html" (index (sort $logfile "score" "desc") 0) }}
|
||||
</li>
|
||||
</ol>
|
10
layouts/shortcodes/nethack/logfile.html
Normal file
10
layouts/shortcodes/nethack/logfile.html
Normal file
|
@ -0,0 +1,10 @@
|
|||
{{- $logfile := partial "nethack/log.html" . -}}
|
||||
<ol class="logfile">
|
||||
{{ range sort $logfile "end_date" "desc" }}
|
||||
{{ if ne .death.cause "quit" }}
|
||||
<li>
|
||||
{{ partial "nethack/logentry.html" .}}
|
||||
</li>
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
</ol>
|
2
layouts/shortcodes/nethack/n.html
Normal file
2
layouts/shortcodes/nethack/n.html
Normal file
|
@ -0,0 +1,2 @@
|
|||
{{- $numberOfEntries := (partial "nethack/log.html" .) | len -}}
|
||||
{{- $numberOfEntries | lang.FormatNumber 0 -}}
|
7
layouts/shortcodes/nethack/topn.html
Normal file
7
layouts/shortcodes/nethack/topn.html
Normal file
|
@ -0,0 +1,7 @@
|
|||
{{- $n := .Get 0 -}}
|
||||
{{- $logfile := partial "nethack/log.html" . -}}
|
||||
<ol class="logfile topn">
|
||||
{{ range first $n (sort $logfile "score" "desc") -}}
|
||||
<li>{{ partial "nethack/logentry.html" . }}</li>
|
||||
{{- end }}
|
||||
</ol>
|
9
layouts/shortcodes/photo.html
Normal file
9
layouts/shortcodes/photo.html
Normal file
|
@ -0,0 +1,9 @@
|
|||
{{- with $photoPage := $.Page.GetPage (printf "photos/%s" (.Get 0)) -}}
|
||||
{{- $thumbnail := partial "photos/thumbnail.html" (dict "Page" . "Width" 1280 "Height" 1280) -}}
|
||||
{{- $altText := $thumbnail.Params.alt | default .Title -}}
|
||||
<a class="to-photo-post" href="{{ .RelPermalink }}" title="{{ .Title }}">
|
||||
<img src="{{ $thumbnail.RelPermalink }}"{{ with $altText }} alt="{{ . }}"{{ end }}>
|
||||
</a>
|
||||
{{- else -}}
|
||||
{{- errorf "No page matching '%s'" (.Get 0) -}}
|
||||
{{- end -}}
|
3
layouts/shortcodes/r.html
Normal file
3
layouts/shortcodes/r.html
Normal file
|
@ -0,0 +1,3 @@
|
|||
{{- $subreddit := .Get 0 -}}
|
||||
<a class="hover-only" href="https://reddit.com/r/{{ $subreddit }}"><code class="nobg">r/{{ $subreddit }}</code></a>
|
||||
{{- "" -}}
|
27
layouts/shortcodes/recent_posts.html
Normal file
27
layouts/shortcodes/recent_posts.html
Normal file
|
@ -0,0 +1,27 @@
|
|||
<ul>
|
||||
{{ $pages := union .Site.RegularPages .Site.Sections }}
|
||||
{{ if .Page.IsHome }}
|
||||
{{ $pages = where site.RegularPages "Type" "in" site.Params.mainSections }}
|
||||
{{ end }}
|
||||
{{ $paginator := .Page.Paginate $pages }}
|
||||
{{ range $index, $page := $paginator.Pages }}
|
||||
<li>
|
||||
<a href="{{ .Permalink }}">{{ .Title }}</a> —
|
||||
<time datetime="{{ .Date.Format "2006-01-02" }}">{{ .Date | time.Format ":date_medium" }}</time>
|
||||
{{ if $page.Draft }}
|
||||
<span class="draft">draft</span>
|
||||
{{ end }}
|
||||
</li>
|
||||
{{ end }}
|
||||
</ul>
|
||||
|
||||
{{ if gt $paginator.TotalPages 1 }}
|
||||
<nav class="main-nav">
|
||||
{{ if $paginator.HasPrev }}
|
||||
<a class="prev" href="{{ $paginator.Prev.URL }}">← {{ i18n "prev_page" }}</a>
|
||||
{{ end }}
|
||||
{{ if $paginator.HasNext }}
|
||||
<a class="next" href="{{ $paginator.Next.URL }}">{{ i18n "next_page" }} →</a>
|
||||
{{ end }}
|
||||
</nav>
|
||||
{{ end }}
|
18
layouts/shortcodes/resume_flex.html
Normal file
18
layouts/shortcodes/resume_flex.html
Normal file
|
@ -0,0 +1,18 @@
|
|||
<header class="flex-date">
|
||||
{{ .Inner }}
|
||||
<span class="date">
|
||||
{{ if .IsNamedParams }}
|
||||
{{ with .Get "from" }}
|
||||
<time datetime="{{ . }} ">{{ . }}</time>
|
||||
{{ end }}
|
||||
to
|
||||
{{ with .Get "to" }}
|
||||
<time datetime="{{ . }}">{{ . }}</time>
|
||||
{{ else }}
|
||||
present
|
||||
{{ end }}
|
||||
{{ else }}
|
||||
{{ .Get 0 }}
|
||||
{{ end }}
|
||||
</span>
|
||||
</header>
|
14
layouts/shortcodes/resume_section.html
Normal file
14
layouts/shortcodes/resume_section.html
Normal file
|
@ -0,0 +1,14 @@
|
|||
<header class="flex-date">
|
||||
<h3>{{ .Get "company" }}: {{ .Get "team" }}</h3>
|
||||
<span class="date">
|
||||
{{ with .Get "from" }}
|
||||
<time datetime="{{ . }} ">{{ . }}</time>
|
||||
{{ end }}
|
||||
–
|
||||
{{ with .Get "to" }}
|
||||
<time datetime="{{ . }}">{{ . }}</time>
|
||||
{{ else }}
|
||||
present
|
||||
{{ end }}
|
||||
</span>
|
||||
</header>
|
1
layouts/shortcodes/ruby.html
Normal file
1
layouts/shortcodes/ruby.html
Normal file
|
@ -0,0 +1 @@
|
|||
<ruby {{ with .Get 1 }}lang="{{ . }}"{{ end }}><span>{{- .Inner }}</span> <rp>(</rp><rt {{ with .Get 2 }}lang="{{ . }}"{{ end }}>{{- .Get 0 -}}</rt><rp>)</rp></ruby>{{- "" -}}
|
3
layouts/shortcodes/section.html
Normal file
3
layouts/shortcodes/section.html
Normal file
|
@ -0,0 +1,3 @@
|
|||
<section {{ with .Get "class" }}class="{{ . }}"{{ end }}>
|
||||
{{ .Inner }}
|
||||
</section>
|
Loading…
Add table
Add a link
Reference in a new issue