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
6
layouts/partials/nethack/log.html
Normal file
6
layouts/partials/nethack/log.html
Normal file
|
@ -0,0 +1,6 @@
|
|||
{{ $nethack_data := $.Site.Data.nethack.logfile }}
|
||||
{{ $logfile := slice }}
|
||||
{{ range $nethack_data }}
|
||||
{{ $logfile = $logfile | append .logfile }}
|
||||
{{ end }}
|
||||
{{ return $logfile }}
|
48
layouts/partials/nethack/logentry.html
Normal file
48
layouts/partials/nethack/logentry.html
Normal file
|
@ -0,0 +1,48 @@
|
|||
{{- $cause := .death.cause -}}
|
||||
{{- $didAscend := eq $cause "ascended" -}}
|
||||
{{- $level := (cond (gt .dungeon.level.n 0) (.dungeon.level.descriptive | lower) .dungeon.level.descriptive) -}}
|
||||
<div>{{- if $didAscend -}}✨{{- else -}}🪦{{- end -}}</div>
|
||||
<h4 class="date">{{ time.Format "January 2, 2006" .end_date }}</h4>
|
||||
<div class="character-descriptor">{{ .character.abbreviated }}</div>
|
||||
<p>
|
||||
{{- $name := .character.name -}}
|
||||
{{- $descriptiveAlignment := .character.alignment.descriptive | lower -}}
|
||||
{{- $descriptiveRace := .character.race.descriptive | lower -}}
|
||||
{{- $descriptiveRole := .character.role.descriptive -}}
|
||||
{{- if $didAscend -}}
|
||||
{{ $name }}, a {{ $descriptiveAlignment }} {{ $descriptiveRace }} {{ $descriptiveRole }}, ascended.
|
||||
{{- else -}}
|
||||
{{ $name }}, a {{ $descriptiveAlignment }} {{ $descriptiveRace }} {{ $descriptiveRole }}, died
|
||||
{{ if gt .death.count 1 -}}for the last time{{- end }} in
|
||||
<span class="nobreak">{{ .dungeon.name }}</span>
|
||||
on <span class="nobreak">{{ $level }}</span>.
|
||||
She was {{ .death.cause }}.
|
||||
{{- end -}}
|
||||
</p>
|
||||
<table class="stats">
|
||||
<tr>
|
||||
{{- $startDate := time.Format "January, 02 2006" .start_date -}}
|
||||
{{- $startDatetime := time.Format "2006-01-02" .start_date -}}
|
||||
<td class="began">Began <time class="nobreak" datetime="{{ $startDatetime }}">{{ $startDate }}</time></td>
|
||||
<td class="score">{{ .score | lang.FormatNumber 0 }} points</td>
|
||||
{{/*
|
||||
When I first wrote the importer script, I read about the log file
|
||||
format on the Nethackwiki. It labeled a field as "maximum level",
|
||||
which I interpreted as maximum character level. Turns out it's
|
||||
actually maximum *dungeon* level. The script has been updated, but I
|
||||
won't be able to update all the imported logfiles.
|
||||
|
||||
https://nethackwiki.com/wiki/Logfile
|
||||
*/}}
|
||||
{{ with .dungeon.max_level }}
|
||||
<td class="level">{{ .descriptive }}</td>
|
||||
{{ else }}
|
||||
{{ with .character.max_level }}<td class="level">Level {{ . }}</td>{{ end }}
|
||||
{{ end }}
|
||||
<td class="hp">
|
||||
{{- $hp := float .character.hp.n -}}
|
||||
{{- $hpMax := .character.hp.max -}}
|
||||
{{- if gt $hp 0 }}{{ $hp }} / {{ $hpMax }}{{ else }}{{ $hp }}{{ end }} hp
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
66
layouts/partials/photo_exif_table.html
Normal file
66
layouts/partials/photo_exif_table.html
Normal file
|
@ -0,0 +1,66 @@
|
|||
<div class="photo-params">
|
||||
<div class="container">
|
||||
<table>
|
||||
{{ if and .Tags.Make .Tags.Model }}
|
||||
<thead>
|
||||
<td class="make-model" colspan=4>
|
||||
{{- $make := .Tags.Make -}}
|
||||
{{- $model := .Tags.Model -}}
|
||||
{{- if in $model $make -}}
|
||||
{{ .Tags.Model }}
|
||||
{{- else -}}
|
||||
{{ .Tags.Make }} {{ .Tags.Model }}
|
||||
{{- end -}}
|
||||
</td>
|
||||
</thead>
|
||||
{{ end }}
|
||||
{{ with .Tags.LensModel }}
|
||||
<tr>
|
||||
<td colspan=4 class="lens">{{ . }}</td>
|
||||
</tr>
|
||||
{{ end }}
|
||||
<tr>
|
||||
{{- $hasLocation := and .Lat .Long -}}
|
||||
{{ if $hasLocation -}}
|
||||
<td colspan=2 class="location">
|
||||
{{ $lat := float .Lat }}{{ $latDir := cond (eq $lat 0) "" (cond (gt $lat 0) "N" "S") }}
|
||||
<data class="latitude" value="{{ $lat }}">{{ .Lat | lang.FormatNumber (cond (ne $lat 0) 3 0) }}º{{ $latDir }}</data>,
|
||||
{{ $long := float .Long }}{{ $longDir := cond (eq $long 0) "" (cond (gt $long 0) "E" "W") }}
|
||||
<data class="longitude" value="{{ $long }}">{{ .Long | lang.FormatNumber (cond (ne $long 0) 3 0) }}º{{ $longDir }}</data>
|
||||
</td>
|
||||
{{- end -}}
|
||||
{{ if and .Tags.PixelXDimension .Tags.PixelYDimension -}}
|
||||
<td colspan={{ if $hasLocation }}2{{ else }}4{{ end }} class="size">
|
||||
{{- $widthpx := .Tags.PixelXDimension -}}
|
||||
{{- $heightpx := .Tags.PixelYDimension -}}
|
||||
{{- if and (gt $widthpx 0) (gt $heightpx 0) -}}
|
||||
{{- $megapixels := div (mul $widthpx $heightpx) 1e6 -}}
|
||||
<data class="megapixels nobreak" value="{{ $megapixels }}">{{ $megapixels | lang.FormatNumber 0 }} MP</data>
|
||||
•
|
||||
<span class="nobreak"><data class="width">{{ $widthpx }}</data> × <data class="height">{{ $heightpx }}</data></span>
|
||||
{{- end -}}
|
||||
</td>
|
||||
{{ end }}
|
||||
</tr>
|
||||
{{ if or .Tags.ISOSpeedRatings .Tags.FocalLengthIn35mmFilm .Tags.FNumber .Tags.ExposureTime }}
|
||||
<tr class="exposure-attributes">
|
||||
<td class="iso">{{ with .Tags.ISOSpeedRatings }}ISO {{ . }}{{ end }}</td>
|
||||
<td class="focal-length">
|
||||
{{- $focalLength := .Tags.FocalLengthIn35mmFilm | default .Tags.FocalLength -}}
|
||||
{{- with $focalLength -}}{{ . }} mm{{- end -}}
|
||||
</td>
|
||||
<td class="f-number">{{ with .Tags.FNumber }}{{ printf "ƒ%0.1f" . }}{{ end }}</td>
|
||||
<td class="exposure-time">
|
||||
{{- with $exposureTime := .Tags.ExposureTime -}}
|
||||
{{- if in $exposureTime "/" -}}
|
||||
{{ . }} s
|
||||
{{- else -}}
|
||||
1/{{ printf "%.0f" (div 1.0 (float $exposureTime)) }} s
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
</td>
|
||||
</tr>
|
||||
{{ end }}
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
9
layouts/partials/photos/list.html
Normal file
9
layouts/partials/photos/list.html
Normal file
|
@ -0,0 +1,9 @@
|
|||
{{ $thumbnailResourcesNames := slice "thumbnail" "Thumbnail" "thumbnail.jpg" "Thumbnail.jpg" }}
|
||||
{{ with index .Params "thumbnail" }}
|
||||
{{ $thumbnailResourcesNames = $thumbnailResourcesNames | append . }}
|
||||
{{ end }}
|
||||
|
||||
{{ $imageResources := .Resources.ByType "image" }}
|
||||
{{ $photos := where $imageResources "Name" "not in" $thumbnailResourcesNames }}
|
||||
|
||||
{{ return $photos }}
|
50
layouts/partials/photos/thumbnail.html
Normal file
50
layouts/partials/photos/thumbnail.html
Normal file
|
@ -0,0 +1,50 @@
|
|||
{{/*
|
||||
Renders a photo thumbnail. If neither a target height or target width are
|
||||
given, and the image is already in the correct orientation, no image
|
||||
processing is performed.
|
||||
|
||||
Arguments
|
||||
---------
|
||||
"Page" : A reference to the current Page
|
||||
"Height" : The target height of the image
|
||||
"Width" : The target width of the image
|
||||
|
||||
Returns
|
||||
-------
|
||||
The processed thumbnail image resource
|
||||
*/}}
|
||||
|
||||
{{- $thumbnailResource := .Page.Resources.GetMatch
|
||||
(index .Page.Params "thumbnail" | default "[tT]humbnail*")
|
||||
| default (index (.Page.Resources.ByType "image") 0) -}}
|
||||
|
||||
{{- if not $thumbnailResource -}}
|
||||
{{- errorf "No thumbnail available for %s" .Page.Permalink }}
|
||||
{{- end -}}
|
||||
|
||||
{{ $orientation := partial "image-utilities/orientation-angle.html" $thumbnailResource }}
|
||||
|
||||
{{ $targetWidth := 0 }}
|
||||
{{ with .Width }}
|
||||
{{ $targetWidth = . }}
|
||||
{{ else }}
|
||||
{{ $targetWidth = $thumbnailResource.Width }}
|
||||
{{ end }}
|
||||
|
||||
{{ $targetHeight := 0 }}
|
||||
{{ with .Height }}
|
||||
{{ $targetHeight = . }}
|
||||
{{ else }}
|
||||
{{ $targetHeight = $thumbnailResource.Height }}
|
||||
{{ end }}
|
||||
|
||||
{{ $thumbnail := false }}
|
||||
{{ if not (and (eq $orientation 0)
|
||||
(eq $targetWidth $thumbnailResource.Width)
|
||||
(eq $targetHeight $thumbnailResource.Height)) }}
|
||||
{{ $thumbnail = $thumbnailResource.Fit (printf "%dx%d r%d" $targetWidth $targetHeight (sub 360 $orientation)) }}
|
||||
{{ else }}
|
||||
{{ $thumbnail = $thumbnailResource }}
|
||||
{{ end }}
|
||||
|
||||
{{ return $thumbnail }}
|
Loading…
Add table
Add a link
Reference in a new issue