diff options
author | Thedro Neely <thedroneely@gmail.com> | 2021-06-05 23:05:48 -0400 |
---|---|---|
committer | Thedro Neely <thedroneely@gmail.com> | 2021-06-05 23:12:45 -0400 |
commit | 7baf433b53342ab55a32e74f3e3241ed5119032f (patch) | |
tree | 2599f315b3eafa2f2256af19ac9c8d4e4d63d18c /generators/hugo/themes/tdro/layouts/shortcodes/sideimage.html | |
parent | e2c59edb858a03ac44c2440c2a1d571e785b2301 (diff) | |
download | thedroneely.com-7baf433b53342ab55a32e74f3e3241ed5119032f.tar.gz thedroneely.com-7baf433b53342ab55a32e74f3e3241ed5119032f.tar.bz2 thedroneely.com-7baf433b53342ab55a32e74f3e3241ed5119032f.zip |
generators/shortcodes: Footnote and image enhancements
Defensive; hash footnote content and mark ids to ensure no conflicts on side-notes and
images.
Decouple PHP from image short-codes.
Add margin images.
Ensure consistency between foot-notes, side-notes, and side-images.
Diffstat (limited to 'generators/hugo/themes/tdro/layouts/shortcodes/sideimage.html')
-rw-r--r-- | generators/hugo/themes/tdro/layouts/shortcodes/sideimage.html | 33 |
1 files changed, 12 insertions, 21 deletions
diff --git a/generators/hugo/themes/tdro/layouts/shortcodes/sideimage.html b/generators/hugo/themes/tdro/layouts/shortcodes/sideimage.html index 39e22a4..3e4966c 100644 --- a/generators/hugo/themes/tdro/layouts/shortcodes/sideimage.html +++ b/generators/hugo/themes/tdro/layouts/shortcodes/sideimage.html @@ -1,23 +1,14 @@ -<span class="sidenote-container"> - -<label for="{{ .Get `mark` }}" class="sidenote-toggle sidenote-mark" title="{{ .Inner }}">{{ .Get `mark` }}</label> -<input type="checkbox" id="{{ .Get `mark` }}" class="sidenote-toggle"> - -<span class="sans-serif sidenote sideimage {{ .Get `set` }}note"> - -{{ safeHTML "<?php" }} -$width = getimagesize($_SERVER['DOCUMENT_ROOT'] . '{{.Get `source`}}')[0]; -$height = getimagesize($_SERVER['DOCUMENT_ROOT'] . '{{.Get `source`}}')[1]; -$ratio = ((($height / $width) * 100) > 100) ? $height . 'px' : $height / $width * 100 . '%'; -{{ safeHTML "?>" }} - - <a href="{{.Get `source`}}" onclick="return false;"> - <img data-image-zoom src="{{.Get `source`}}" alt="{{ .Inner }}" title="{{.Get `title`}}" - {{ safeHTMLAttr `<?php echo 'width=' . '"' . $width . '"'; ?>` }} - {{ safeHTMLAttr `<?php echo 'height=' . '"' . $height . '"'; ?>` }} /> - </a> - - <span class="sideimage-footer is-block has-text-centered has-text-grey-dark"><mark>{{ .Inner }}</mark></span> -</span> +{{ $id := md5 (printf (.Get `mark`) .Inner) }} +{{ $imageFile := print "public" (.Get `source`) }} +{{ $image := imageConfig $imageFile }} +<span class="sidenote-container"> + <label for="{{ $id }}" class="sidenote-toggle sidenote-mark" title="{{ .Inner }}"><span>{{ .Get `mark` }}</span></label> + <input type="checkbox" id="{{ $id }}" class="sidenote-toggle"> + <span class="sans-serif sidenote sideimage {{ .Get `set` }}note"> + <a href="{{.Get `source`}}" onclick="return false;"> + <img data-image-zoom src="{{ .Get `source`}}" alt="{{ .Inner }}" title="{{ .Get `title`}}" width="{{ $image.Width }}" height="{{ $image.Height }}"/> + </a> + <span class="sideimage-footer is-block has-text-centered has-text-grey-dark"><mark>{{ .Inner }}</mark></span> + </span> </span> |