Merge commit 'e186c5d6f740bbdb62d2c6ea304977603a55e59a' as 'themes/paperesque'
This commit is contained in:
3
themes/paperesque/layouts/shortcodes/aside.html
Normal file
3
themes/paperesque/layouts/shortcodes/aside.html
Normal file
@@ -0,0 +1,3 @@
|
||||
<aside class="article-aside look-sheet-border">
|
||||
{{- .Inner -}}
|
||||
</aside>
|
||||
5
themes/paperesque/layouts/shortcodes/cw.html
Normal file
5
themes/paperesque/layouts/shortcodes/cw.html
Normal file
@@ -0,0 +1,5 @@
|
||||
<aside class="content-warning">
|
||||
<p>
|
||||
<strong>Content Note:</strong> {{ trim .Inner "\n" }}
|
||||
</p>
|
||||
</aside>
|
||||
18
themes/paperesque/layouts/shortcodes/expander.html
Normal file
18
themes/paperesque/layouts/shortcodes/expander.html
Normal file
@@ -0,0 +1,18 @@
|
||||
{{ $_hugo_config := `{ "version": 1 }` }}
|
||||
<!--
|
||||
Ok, so - see this: https://gohugo.io/content-management/shortcodes/#shortcodes-with-markdown
|
||||
The outcome is that by default, accessing .Inner returns the Markdown. Because we're putting it
|
||||
inside a div, it doesn't get rendered later. So we restore the old behaviour, which renders
|
||||
everything to HTML as a first step (but apparently breaks the TOC functionality).
|
||||
-->
|
||||
<!-- Expander: hides content by default, shows it when clicked on. -->
|
||||
<div class="expander look-sheet">
|
||||
{{ $radioGroup := anchorize (.Get "title") }}
|
||||
<h2>{{ .Get "title" }}</h2>
|
||||
<input type=radio id="expand-{{$radioGroup}}-show" class="hidden show" name="{{$radioGroup}}">
|
||||
<input type=radio id="expand-{{$radioGroup}}-hide" class="hidden hide" name="{{$radioGroup}}" checked="checked">
|
||||
<label class="button button-show" for="expand-{{$radioGroup}}-show">+ Expand</label><label class="button button-hide" for="expand-{{$radioGroup}}-hide">- Collapse</label>
|
||||
<div class="inner">
|
||||
{{ .Inner }}
|
||||
</div>
|
||||
</div>
|
||||
53
themes/paperesque/layouts/shortcodes/fitfigure.html
Normal file
53
themes/paperesque/layouts/shortcodes/fitfigure.html
Normal file
@@ -0,0 +1,53 @@
|
||||
{{- $path := (.Get "src") -}}
|
||||
{{- $original := .Page.Resources.GetMatch $path -}}
|
||||
{{- if not $original -}}
|
||||
{{- errorf "couldn't find resource for src: %s" $path -}}
|
||||
{{- else if and (ne "jpeg" $original.MediaType.SubType) (ne "png" $original.MediaType.SubType) -}}
|
||||
{{- errorf "src %s is a '%s', expected 'jpeg' or 'png'" $path $original.MediaType.SubType -}}
|
||||
{{- else -}}
|
||||
{{- /* Below is a copy paste of https://github.com/gohugoio/hugo/blob/master/tpl/tplimpl/embedded/templates/shortcodes/figure.html from Hugo commit aba2647c152ffff927f42523b77ee6651630cd67, with the img tag modified to use srcsets */ -}}
|
||||
{{- /* Note that it presently uses `markdownify` instead of $.Page.RenderString for consistency with Hugo's `figure` shortcode. */ -}}
|
||||
<figure{{ with .Get "class" }} class="{{ . }}"{{ end }}>
|
||||
{{- if .Get "link" -}}
|
||||
<a href="{{ .Get "link" }}"{{ with .Get "target" }} target="{{ . }}"{{ end }}{{ with .Get "rel" }} rel="{{ . }}"{{ end }}>
|
||||
{{- end }}
|
||||
{{ if (or (ge $original.Width 1304) (ge $original.Height 1304)) -}}
|
||||
{{/* Add the original to the droplist, so it will get removed later. */}}
|
||||
{{- if not (.Page.Scratch.Get "droplist") -}}
|
||||
{{- .Page.Scratch.Set "droplist" (slice) -}}
|
||||
{{- end -}}
|
||||
{{- .Page.Scratch.Add "droplist" $original.RelPermalink -}}
|
||||
{{/* Note: 652px is the max width of an img in article content. I measured this using dev tools; but it's dependent on the styles for the page. */}}
|
||||
{{- $resized_1x := $original.Fit "652x652 q95" -}}
|
||||
{{- $resized_2x := $original.Fit "1304x1304 q95" -}}
|
||||
<img srcset="{{ $resized_1x.RelPermalink }},
|
||||
{{ $resized_2x.RelPermalink }} 2x"
|
||||
{{- /* Use small one by default to be kind to old browsers */}}
|
||||
src="{{ $resized_1x.RelPermalink }}"
|
||||
{{ else }}
|
||||
<img src="{{ $original.RelPermalink }}"
|
||||
{{ end }}
|
||||
{{- 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 -}}
|
||||
/> <!-- Closing img tag -->
|
||||
{{- if .Get "link" }}</a>{{ end -}}
|
||||
{{- if or (or (.Get "title") (.Get "caption")) (.Get "attr") }}
|
||||
<figcaption>
|
||||
{{ with (.Get "title") -}}
|
||||
<h4>{{ . }}</h4>
|
||||
{{- end -}}
|
||||
{{- if or (.Get "caption") (.Get "attr") -}}<p>
|
||||
{{- .Get "caption" | markdownify -}}
|
||||
{{- with .Get "attrlink" }}
|
||||
<a href="{{ . }}">
|
||||
{{- end -}}
|
||||
{{- .Get "attr" | markdownify -}}
|
||||
{{- if .Get "attrlink" }}</a>{{ end }}</p>
|
||||
{{- end }}
|
||||
</figcaption>
|
||||
{{- end }}
|
||||
</figure>
|
||||
{{- end -}}
|
||||
33
themes/paperesque/layouts/shortcodes/svgfigure.html
Normal file
33
themes/paperesque/layouts/shortcodes/svgfigure.html
Normal file
@@ -0,0 +1,33 @@
|
||||
{{- /* This is a copy paste of
|
||||
https://github.com/gohugoio/hugo/blob/master/tpl/tplimpl/embedded/templates/shortcodes/figure.html
|
||||
from Hugo commit aba2647c152ffff927f42523b77ee6651630cd67, with the img tag
|
||||
replaced with an object tag, with type=svg. This allows for embedded SVGs to
|
||||
be animated with CSS in Safari 13.1. See also: https://stackoverflow.com/q/60975613/996592
|
||||
*/ -}}
|
||||
{{- /* Note that it presently uses `markdownify` instead of $.Page.RenderString for consistency with Hugo's `figure` shortcode. */ -}}
|
||||
|
||||
<figure{{ with .Get "class" }} class="{{ . }}"{{ end }}>
|
||||
{{- if .Get "link" -}}
|
||||
<a href="{{ .Get "link" }}"{{ with .Get "target" }} target="{{ . }}"{{ end }}{{ with .Get "rel" }} rel="{{ . }}"{{ end }}>
|
||||
{{- end }}
|
||||
<object type="image/svg+xml" data="{{ .Get "src" }}"
|
||||
{{- with .Get "width" }} width="{{ . }}"{{ end -}}
|
||||
{{- with .Get "height" }} height="{{ . }}"{{ end -}}
|
||||
></object>
|
||||
{{- if .Get "link" }}</a>{{ end -}}
|
||||
{{- if or (or (.Get "title") (.Get "caption")) (.Get "attr") -}}
|
||||
<figcaption>
|
||||
{{ with (.Get "title") -}}
|
||||
<h4>{{ . }}</h4>
|
||||
{{- end -}}
|
||||
{{- if or (.Get "caption") (.Get "attr") -}}<p>
|
||||
{{- .Get "caption" | markdownify -}}
|
||||
{{- with .Get "attrlink" }}
|
||||
<a href="{{ . }}">
|
||||
{{- end -}}
|
||||
{{- .Get "attr" | markdownify -}}
|
||||
{{- if .Get "attrlink" }}</a>{{ end }}</p>
|
||||
{{- end }}
|
||||
</figcaption>
|
||||
{{- end }}
|
||||
</figure>
|
||||
Reference in New Issue
Block a user