refactor: new version of lorem

fix: change image parameters to width and padding
master
Kebler Network System Administrator 2021-11-24 09:34:40 -08:00
parent f6217a6abc
commit 1ad4d928af
2 changed files with 20 additions and 17 deletions

View File

@ -5,17 +5,21 @@
{{ with .Get "style"}} box--image-{{ . }}{{ end }}
{{ with .Get "link"}}{{ if eq . "lightbox" }} box--image-lightbox{{ end }}{{ end }}
"
{{ with .Get "maxwidth"}} maxWidth="{{ . }}"{{ end }}
{{ with .Get "wpad"}} wPad="{{ . }}"{{ end }}
style="
{{ with .Get "width"}} width:{{ . }};{{ end }}
{{ with .Get "pad"}} padding:{{ . }}{{ end }}
"
>
{{ with .Get "title" }}
<div class="box__title">{{ . }}</div>
{{ end }}
{{ with .Get "link"}}
{{ if eq . "lightbox" }}<a href="{{ $path }}{{ $filename }}">{{ else }}<a href="{{.}}" target="_blank" >{{ end }}
{{ end }}
<img src="{{ $path }}{{ .Get "filename" }}" />
{{ if .Get "link"}}</a>{{ end }}
{{ with .Get "title" }}<div class="box__title">{{ . }}</div>{{ end }}
<a href="{{ if .Get "link" }}{{ .Get "link" }}{{ else }}{{ $path }}{{ $filename }}{{ end }}" target="_blank" >
<img
style="
{{ with .Get "width"}} width={{ . }};{{ end }}
{{ with .Get "pad"}} padding={{ . }}{{ end }}
"
src="{{ $path }}{{ .Get "filename" }}" />
</a>
{{ with .Get "caption"}}
<div class="box__caption">{{ . }}</div>
{{ end }}

View File

@ -1,7 +1,6 @@
<!-- https://github.com/f/loremjs
shorcode parameter
2p = 2 paragraphs
5s = 5 sentences
6w = 6 words
1-6w = between 1 and 6 words -->
<div data-lorem={{ .Get 0 | default "2p" }}></div>
{{/* parameter is number of paragraphs */}}
{{ $lorem := "<p><em>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse accumsan rutrum consectetur. Vivamus eu ex quis leo posuere convallis. Nunc laoreet velit sed ullamcorper mollis. Mauris porta consequat tortor aliquet maximus. Quisque sed purus condimentum orci sodales aliquam non vel tellus. Praesent lorem arcu, scelerisque a semper at, iaculis eget purus. Etiam ullamcorper orci a porttitor sodales. Nullam tincidunt nibh et hendrerit auctor. Quisque vitae quam ut lorem vehicula condimentum. In commodo cursus elit, non volutpat lectus sagittis non.</em></p>" }}
{{ range seq (.Get 0 | default "2") }}
{{ $lorem | safeHTML }}
{{ end }}