From d42fb91ac4b4ae75c0ba02126965e71c2d8a68eb Mon Sep 17 00:00:00 2001 From: tdro Date: Thu, 7 Jul 2022 04:13:18 -0400 Subject: themes/default/layouts/shortcodes/mark: Allow inner blocks Inner can contain no content with self-closing short code tags. --- content/canory/messages/highlighting.md | 2 +- content/canory/messages/pinned.md | 2 +- content/canory/messages/wikipedia.md | 2 +- themes/default/layouts/shortcodes/mark.html | 10 +++++++--- 4 files changed, 10 insertions(+), 6 deletions(-) diff --git a/content/canory/messages/highlighting.md b/content/canory/messages/highlighting.md index 4bc2908..f49b217 100644 --- a/content/canory/messages/highlighting.md +++ b/content/canory/messages/highlighting.md @@ -5,7 +5,7 @@ tags = [ "docs", "highlighting" ] author = "canory" +++ -Sometimes I'll {{< mark "highlight stuff" >}} to draw attention to my fine +Sometimes I'll {{< mark "highlight stuff" />}} to draw attention to my fine eloquence. If I don't think things through, I'll ~~hide the what I wrote~~. Whoops, let's just {{< ins "correct the record." >}} {{< spoiler "Move along --- nothing to see here." >}} diff --git a/content/canory/messages/pinned.md b/content/canory/messages/pinned.md index 1e1bd16..feb20eb 100644 --- a/content/canory/messages/pinned.md +++ b/content/canory/messages/pinned.md @@ -10,5 +10,5 @@ author = "canory" This message is pinned for reasons unknown. For a quick start guide, [@default](/tags/hugo/#default-messages-quickstart.md) might be able to help you. The [#docs](/tags/docs) explain what we are currently capable of doing. -{{< mark Warning >}}: This micro blog is _remarkably_ experimental, don't hurt +{{< mark Warning />}}: This micro blog is _remarkably_ experimental, don't hurt yourself. diff --git a/content/canory/messages/wikipedia.md b/content/canory/messages/wikipedia.md index cb65635..86a4af2 100644 --- a/content/canory/messages/wikipedia.md +++ b/content/canory/messages/wikipedia.md @@ -8,7 +8,7 @@ author = "canory" Reason, meaning, and knowledge are the ground truths of society but only when all other methods have failed. Invoke the world's most used encyclopedia... -{{< mark Warning >}}: +{{< mark Warning />}}: Article text may *change* as it appears --- the pedia's not guaranteed to be consistent across discrete spacetimes. If the below does not say "knowledge" you've been had. diff --git a/themes/default/layouts/shortcodes/mark.html b/themes/default/layouts/shortcodes/mark.html index 02af225..122a521 100644 --- a/themes/default/layouts/shortcodes/mark.html +++ b/themes/default/layouts/shortcodes/mark.html @@ -1,5 +1,9 @@ -{{- $text := default "highligted text" (.Get "text" | default (.Get 0)) -}} -{{- $title := default $text (.Get "title" | default (.Get 1)) -}} +{{- $text := default "mark" (.Get "text" | default (.Get 0)) -}} +{{- $title := default "highlighted text" (.Get "title" | default (.Get 1)) -}} -{{ $text }} +{{- if gt (len .Inner) 1 -}} + {{- $text = .Inner -}} +{{- end -}} + +{{- $text -}} {{- /* This comment removes trailing newlines and white spaces. */ -}} -- cgit v1.2.3