forked from markus/AMPERION_Webpage
new
This commit is contained in:
commit
1d8da2b6dd
824 changed files with 76366 additions and 0 deletions
1
layouts/shortcodes/button.html
Normal file
1
layouts/shortcodes/button.html
Normal file
|
|
@ -0,0 +1 @@
|
|||
<a href="{{.Get 1 | absLangURL}}" class="btn btn-primary text-white" {{ if strings.HasPrefix (.Get 1) `http` }} target="_blank" rel="noopener"{{ end }} >{{.Get 0}}</a>
|
||||
10
layouts/shortcodes/cloak_email.html
Normal file
10
layouts/shortcodes/cloak_email.html
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
<!-- {{/*
|
||||
Cloak an e-mail address
|
||||
|
||||
Usage: {{< cloak_email EMAIL >}}
|
||||
*/}} -->
|
||||
{{- $address_parts := split (.Get 0) "@" -}}
|
||||
{{- $user := index $address_parts 0 -}}
|
||||
{{- $domain := index $address_parts 1 -}}
|
||||
<span class="cloaked-e-mail" data-user="{{ range $index := seq (sub (len $user) 1) 0 }}{{ substr $user $index 1 }}{{ end }}" data-domain="{{ range $index := seq (sub (len $domain) 1) 0 }}{{ substr $domain $index 1 }}{{ end }}"></span>
|
||||
{{- /* Dummy comment to strip trailing newline */ -}}
|
||||
8
layouts/shortcodes/codepen.html
Normal file
8
layouts/shortcodes/codepen.html
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
<div class="codepen" data-height="400" data-theme-id="light" data-default-tab="html,result" data-user="codepen" data-slug-hash="{{.Get 0}}"></div>
|
||||
|
||||
<!-- codepen plugin, use it in config.toml -->
|
||||
<!--
|
||||
[[params.plugins.js]]
|
||||
link = "https://cpwebassets.codepen.io/assets/embed/ei.js"
|
||||
attributes = "async"
|
||||
-->
|
||||
12
layouts/shortcodes/collapse.html
Normal file
12
layouts/shortcodes/collapse.html
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
<div class="accordion accordion-flush border">
|
||||
<div class="accordion-item">
|
||||
<h2 class="accordion-header my-0" id="title-{{.Get 0 | urlize}}">
|
||||
<button class="accordion-button collapsed" type="button" data-bs-toggle="collapse" data-bs-target="#{{ .Get 0 | urlize}}" aria-expanded="false" aria-controls="{{ .Get 0 | urlize}}">
|
||||
{{ .Get 0 | markdownify }}
|
||||
</button>
|
||||
</h2>
|
||||
<div id="{{.Get 0 | urlize}}" class="accordion-collapse collapse" aria-labelledby="title-{{.Get 0 | urlize}}">
|
||||
<div class="accordion-body">{{ .Inner | markdownify }}</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
9
layouts/shortcodes/date_l10n.html
Normal file
9
layouts/shortcodes/date_l10n.html
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
<!-- {{/*
|
||||
Localize a date string like "2006-01-02" based on the current language; returns e.g. "January 2, 2006" if current language is English
|
||||
|
||||
Usage: {{< date_l10n INPUT [LAYOUT] >}}
|
||||
*/}} -->
|
||||
{{ $layout := ":date_long" -}}
|
||||
{{ with .Get 1 }}{{ $layout = . }}{{ end -}}
|
||||
{{ time.Format $layout (.Get 0) -}}
|
||||
{{/* Dummy comment to strip trailing newline */ -}}
|
||||
116
layouts/shortcodes/image.html
Normal file
116
layouts/shortcodes/image.html
Normal file
|
|
@ -0,0 +1,116 @@
|
|||
<!-- get value from params -->
|
||||
{{ $imagePath:= .Get "src" }}
|
||||
{{ $caption:= .Get "caption" }}
|
||||
{{ $position:= .Get "position" }}
|
||||
{{ $class:= .Get "class" }}
|
||||
{{ $height:= replace (replace (.Get "height") "px" "") "x" "" }}
|
||||
{{ $width:= replace (replace (.Get "width") "px" "") "x" "" }}
|
||||
{{ $alt:= .Get "alt" }}
|
||||
{{ $title:= .Get "title" }}
|
||||
{{ $command:= .Get "command" | humanize }}
|
||||
{{ $option:= .Get "option" }}
|
||||
|
||||
<!-- image position -->
|
||||
{{ if eq $position `center` }}
|
||||
{{ .Scratch.Set "position" "img-center" }}
|
||||
{{ else if eq $position `left` }}
|
||||
{{ .Scratch.Set "position" "img-left" }}
|
||||
{{ else if eq $position `right` }}
|
||||
{{ .Scratch.Set "position" "img-right" }}
|
||||
{{ else if eq $position `float-left` }}
|
||||
{{ .Scratch.Set "position" "img-float-left" }}
|
||||
{{ else if eq $position `float-right` }}
|
||||
{{ .Scratch.Set "position" "img-float-right" }}
|
||||
{{ end }}
|
||||
|
||||
<!-- check cdn image -->
|
||||
{{ if or (hasPrefix $imagePath "http") (fileExists (add `static/` $imagePath)) }}
|
||||
<!-- cdn image figure -->
|
||||
{{ if $caption }}
|
||||
<figure class="{{.Scratch.Get `position`}}" role="group" aria-describedby="caption-{{ $caption | markdownify }}">
|
||||
<img title="{{$title}}" loading="lazy" decoding="async" src="{{ $imagePath | absURL }}" alt="{{ $alt }}" class="{{$class}}" width="{{$width}}" height="{{$height}}">
|
||||
<figcaption id="caption-{{ $caption | markdownify }}">{{$caption | markdownify}}</figcaption>
|
||||
</figure>
|
||||
{{ else }}
|
||||
<!-- cdn image tag -->
|
||||
<img title="{{$title}}" loading="lazy" decoding="async" src="{{ $imagePath | absURL }}" alt="{{ $alt }}" class="{{$class}} {{.Scratch.Get `position`}}" width="{{$width}}" height="{{$height}}">
|
||||
{{ end }}
|
||||
<!-- /cdn image -->
|
||||
|
||||
{{ else }}
|
||||
|
||||
<!-- content and assets image path variable -->
|
||||
{{ $contentImage:= .Page.Resources.GetMatch (printf "*%s*" $imagePath) }}
|
||||
{{ $assetImage:= fileExists (add `assets/` $imagePath) }}
|
||||
|
||||
<!-- check image existence -->
|
||||
{{ if or $contentImage $assetImage }}
|
||||
|
||||
<!-- content or assets folder detection -->
|
||||
{{ if $contentImage }}
|
||||
{{ .Scratch.Set "image-exists" $contentImage }}
|
||||
{{ else if $assetImage }}
|
||||
{{ .Scratch.Set "image-exists" (resources.Get $imagePath) }}
|
||||
{{ end }}
|
||||
|
||||
{{ $image:= .Scratch.Get "image-exists" }}
|
||||
|
||||
<!-- image extension -->
|
||||
{{ $imageExt := path.Ext $image }}
|
||||
|
||||
<!-- image height, width (if not svg) -->
|
||||
{{ if eq $imageExt `.svg` }}
|
||||
{{ .Scratch.Set "image-height" "" }}
|
||||
{{ .Scratch.Set "image-width" "" }}
|
||||
{{ else }}
|
||||
{{ .Scratch.Set "image-height" $image.Height }}
|
||||
{{ .Scratch.Set "image-width" $image.Width }}
|
||||
{{ end }}
|
||||
{{ $imageHeight:= .Scratch.Get "image-height" }}
|
||||
{{ $imageWidth:= .Scratch.Get "image-width" }}
|
||||
|
||||
|
||||
<!-- checking gif/svg image -->
|
||||
{{ if or (eq $imageExt `.gif`) (eq $imageExt `.svg`) }}
|
||||
{{ .Scratch.Set `image` $image.RelPermalink }}
|
||||
{{ else }}
|
||||
|
||||
<!-- image processing -->
|
||||
{{ $options:= add (add (add (add (string ($width | default $imageWidth)) "x") (string ($height | default $imageHeight))) " webp ") (string $option) }}
|
||||
|
||||
<!-- image Fit -->
|
||||
{{ if eq $command `Fit` }}
|
||||
{{ .Scratch.Set `image` ($image.Fit $options).RelPermalink }}
|
||||
{{ .Scratch.Set `fallback` ($image.Fit (replace $options `webp` ``)).RelPermalink }}
|
||||
<!-- image Fill -->
|
||||
{{ else if eq $command `Fill` }}
|
||||
{{ .Scratch.Set `image` ($image.Fill $options).RelPermalink }}
|
||||
{{ .Scratch.Set `fallback` ($image.Fill (replace $options `webp` ``)).RelPermalink }}
|
||||
<!-- image Resize -->
|
||||
{{ else }}
|
||||
{{ .Scratch.Set `image` ($image.Resize $options).RelPermalink }}
|
||||
{{ .Scratch.Set `fallback` ($image.Resize (replace $options `webp` ``)).RelPermalink }}
|
||||
{{ end }}
|
||||
|
||||
{{ end }}
|
||||
<!-- /checking gif/svg image -->
|
||||
|
||||
<!-- image figure -->
|
||||
{{ if $caption }}
|
||||
<figure class="{{.Scratch.Get `position`}}" role="group" aria-describedby="caption-{{ $caption | markdownify }}">
|
||||
<img title="{{$title}}" loading="lazy" decoding="async" class="{{$class}}" width="{{$width | default $imageWidth }}" height="{{$height | default $imageHeight}}" src="{{.Scratch.Get `image`}}" alt="{{$alt}}" onerror="this.onerror='null';this.src='{{.Scratch.Get `fallback`}}'">
|
||||
<figcaption id="caption-{{ $caption | markdownify }}">{{$caption | markdownify}}</figcaption>
|
||||
</figure>
|
||||
{{ else }}
|
||||
<!-- image tag -->
|
||||
<img title="{{$title}}" loading="lazy" decoding="async" class="{{$class}} {{.Scratch.Get `position`}}" width="{{$width | default $imageWidth }}" height="{{$height | default $imageHeight}}" src="{{.Scratch.Get `image`}}" alt="{{$alt}}" onerror="this.onerror='null';this.src='{{.Scratch.Get `fallback`}}'">
|
||||
{{ end }}
|
||||
|
||||
{{ else }}
|
||||
<!-- image not found -->
|
||||
<strong class="text-danger mb-3 d-inline-block">{{site.BaseURL}}{{$imagePath}} does not exist</strong>
|
||||
{{ end }}
|
||||
<!-- /check image existance -->
|
||||
|
||||
{{ end }}
|
||||
<!-- /check cdn image -->
|
||||
3
layouts/shortcodes/tab.html
Normal file
3
layouts/shortcodes/tab.html
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
<div class="tab-pane" title="{{ .Get 0 }}">
|
||||
{{ .Inner | markdownify}}
|
||||
</div>
|
||||
4
layouts/shortcodes/tabs.html
Normal file
4
layouts/shortcodes/tabs.html
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
<div class="code-tabs">
|
||||
<ul class="nav nav-tabs"></ul>
|
||||
<div class="tab-content">{{ .Inner }}</div>
|
||||
</div>
|
||||
Loading…
Add table
Add a link
Reference in a new issue