2023-11-06 03:23:48

This commit is contained in:
z17CX 2023-11-06 03:23:48 +00:00
parent 4bb2331c20
commit 4a11aaf64f
Signed by: z17cx
GPG key ID: 3F5F87C84EE943E4
3 changed files with 19 additions and 20 deletions

View file

@ -18,22 +18,22 @@ EXAMPLE:
{{ $icon := "fas fa-sticky-note" }}
{{ $class := "primary" }}
{{ if (eq ($type) ("tip")) }}
{{ if (eq ($type) "tip") }}
{{ $icon = "fas fa-lightbulb" }}
{{ $class = "success" }}
{{ end }}
{{ if (eq ($type) ("important")) }}
{{ if (eq ($type) "important") }}
{{ $icon = "fas fa-exclamation-triangle" }}
{{ $class = "warning" }}
{{ end }}
{{ if (eq ($type) ("warning")) }}
{{ if (eq ($type) "warning") }}
{{ $icon = "fas fa-circle-radiation" }}
{{ $class = "danger" }}
{{ end }}
{{ if (eq ($type) ("info")) }}
{{ if (eq ($type) "info") }}
{{ $icon = "fas fa-info" }}
{{ $class = "info" }}
{{ end }}

View file

@ -27,7 +27,7 @@ EXAMPLE:
{{ $group := (getJSON ($api.gitlab.url) "/groups/" . "?with_projects=0&ts=" ($ts) ($headers)) }}
{{ if (eq ($group.visibility) ("public")) }}
{{ if (eq ($group.visibility) "public") }}
<div class="col">
<div class="card">

View file

@ -11,26 +11,25 @@ EXAMPLE:
{{- if (.IsNamedParams) -}}
{{ $file := ((.Get "id") | default "") }}
{{ $size := ((.Get "size") | default "m") }}
{{ $caption := ((.Get "caption") | htmlEscape) }}
{{ $align := (printf "float-%s" (.Get "align") | default "none") }}
{{ $file := (.Get "id") }}
{{ $size := (.Get "size") }}
{{ $caption := ((.Get "caption") | plainify) }}
{{ $align := (.Get "align") }}
{{ $ext := (path.Ext ($file)) }}
{{ $extSize := (print $size (path.Ext ($file))) }}
{{ $img := (replace ($file) ($ext) ($extSize)) }}
{{ $img := (replace ($file) (path.Ext ($file)) (print $size (path.Ext ($file)))) }}
{{ $space := "me-3" }}
{{ if (eq ($align) ("float-end")) }}{{ $space = "ms-3" }}{{ end }}
{{ if (eq ($align) ("float-center")) }}{{ $align = "text-center" }}{{ end }}
{{ if (eq ($align) "right") }}{{ $align = "float-end ms-3" }}{{ end }}
{{ if (eq ($align) "left") }}{{ $align = "float-start me-3" }}{{ end }}
{{ if (eq ($align) "center") }}{{ $align = "d-flex justify-content-center" }}{{ end }}
<div class="shortcode shortcode-{{ ($.Name) }} {{ ($align) }} {{ ($space) }}">
{{ $class := "img-fluid rounded" }}
{{ with $size }}{{ $class = "img-fluid img-thumbnail" }}{{ end }}
<div class="shortcode shortcode-{{ ($.Name) }} {{ ($align) }}">
<figure class="figure">
<a class="d-inline-block" href="https://i.imgur.com/{{ ($file) }}"
<a title="{{ ($caption) }}" class="d-inline-block" href="https://i.imgur.com/{{ ($file) }}"
rel="noopener nofollow" data-fancybox="gallery" data-caption="{{ ($caption) }}">
<picture>
<img class="figure-img img-thumbnail" src="https://i.imgur.com/{{ ($img) }}" alt="{{ ($img) }}" loading="lazy"/>
</picture>
<img class="figure-img {{ ($class) }}" src="https://i.imgur.com/{{ ($img) }}" alt="{{ ($img) }}" loading="lazy"/>
</a>
{{ with ($caption) }}
<figcaption class="figure-caption">{{ . }}</figcaption>