1
0
mirror of https://github.com/PrivSec-dev/privsec.dev synced 2024-11-13 18:11:33 -05:00
privsec.dev/layouts/shortcodes/time.html
2022-08-25 23:35:09 -04:00

54 lines
1.3 KiB
HTML

{{/*
HTML date/time element <time>
https://developer.mozilla.org/en-US/docs/Web/HTML/Element/time
Output:
<time>TimeString</time>
<time datetime="TimeString">Text</abbr>
Syntax:
{{< time "TimeString" />}}
{{< time datetime="TimeString" />}}
{{< time >}}TimeString{{< /time >}}
{{< time "Text" "TimeString" />}}
{{< time text="Text" datetime="TimeString" />}}
{{< time "TimeString" >}}Text{{< /abbr >}}
{{< time datetime="TimeString" >}}Text{{< /abbr >}}
This file and its contents are licensed under the Blue Oak Model License 1.0.0.
https://blueoakcouncil.org/license/1.0.0
(c) 2022 WfKe9vLwSvv7rN
*/}}
{{- $datetime := "" -}}
{{- $text := "" -}}
{{- with .Get "datetime" -}}
{{- $datetime = . -}}
{{- with $.Get "text" -}}
{{- $text = . -}}
{{- else -}}
{{- $text = ($.Inner | $.Page.RenderString) -}}
{{- end -}}
{{- else -}}
{{- with .Get 1 -}}
{{- $datetime = . -}}
{{- $text = $.Get 0 -}}
{{- else -}}
{{- with .Get 0 -}}
{{- $datetime = . -}}
{{- $text = ($.Inner | $.Page.RenderString) -}}
{{- else -}}
{{ $datetime = .Inner -}}
{{- end -}}
{{- end -}}
{{- end -}}
{{- with $text -}}
<time datetime="{{ $datetime }}">{{ . }}</time>
{{- else -}}
<time>{{ $datetime }}</time>
{{- end -}}