dairy | new theme
This commit is contained in:
parent
5ae63a1d7d
commit
6c3a14b311
65 changed files with 5028 additions and 0 deletions
34
themes/diary/layouts/shortcodes/insertFigure.html
Normal file
34
themes/diary/layouts/shortcodes/insertFigure.html
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
<!--
|
||||
From "cupper-hugo-theme" by zwbetz-gh
|
||||
https://github.com/zwbetz-gh/cupper-hugo-theme/blob/master/layouts/shortcodes/figureCupper.html
|
||||
Under MIT License
|
||||
-->
|
||||
{{ $img := .Get "img" }}
|
||||
{{ $caption := .Get "caption" }}
|
||||
{{ $command := .Get "command" }}
|
||||
{{ $options := .Get "options" }}
|
||||
{{ $align := .Get "align" }}
|
||||
|
||||
{{ $original := .Page.Resources.GetMatch (printf "*%s*" $img) }}
|
||||
{{ $new := "" }}
|
||||
|
||||
{{ if eq $command "Fit" }}
|
||||
{{ $new = $original.Fit $options }}
|
||||
{{ else if eq $command "Fill" }}
|
||||
{{ $new = $original.Fill $options }}
|
||||
{{ else if eq $command "Resize" }}
|
||||
{{ $new = $original.Resize $options }}
|
||||
{{ else if eq $command "Original" }}
|
||||
{{ $new = $original }}
|
||||
{{ else }}
|
||||
{{ errorf "Invalid image processing command: Must be one of Fit, Fill, Resize, Original." }}
|
||||
{{ end }}
|
||||
|
||||
<figure align="{{$align}}" role="group" aria-describedby="caption-{{ $caption | md5 }}">
|
||||
<a href="{{ $original.Permalink }}" class="img-link">
|
||||
<img src="{{ $new.Permalink }}">
|
||||
</a>
|
||||
<figcaption id="caption-{{ $caption | md5 }}">
|
||||
{{ $caption | markdownify }}
|
||||
</figcaption>
|
||||
</figure>
|
||||
Loading…
Add table
Add a link
Reference in a new issue