From d340727b78288306685d1cb8047467971afd3147 Mon Sep 17 00:00:00 2001 From: Serghei Iakovlev Date: Tue, 10 May 2022 00:15:05 +0200 Subject: Create html-tag short code --- exampleSite/content/poems/o-captain.md | 15 ++++++++------- layouts/shortcodes/html-tag.html | 4 ++++ 2 files changed, 12 insertions(+), 7 deletions(-) create mode 100644 layouts/shortcodes/html-tag.html diff --git a/exampleSite/content/poems/o-captain.md b/exampleSite/content/poems/o-captain.md index 486027b..54383b7 100644 --- a/exampleSite/content/poems/o-captain.md +++ b/exampleSite/content/poems/o-captain.md @@ -41,14 +41,15 @@ source: Poetry Foundation [^1]: - The author had just landed in La Guardia Airport after the flight captain died. All the passengers stood up to applaud the co-pilot. We have it in good authority that the event in question led Yoko Ono to write her "Letter to John": + The author had just landed in La Guardia Airport after the flight captain died. All the passengers stood up to applaud the co-pilot. We have it in good authority that the event in question led Yoko Ono to write her "Letter to John": + {{< html-tag tag="blockquote" class="poetry" >}} + - On a windy day let's go flying + - There may be no trees to rest on + - There may be no clouds to ride + - But we'll have our wings and the wind will be with us + - That's enough for me, that's enough for me. + {{< /html-tag >}} - > - On a windy day let's go flying - > - There may be no trees to rest on - > - There may be no clouds to ride - > - But we'll have our wings and the wind will be with us - > - That's enough for me, that's enough for me. - {:.poetry} [^2]: The bugle is a small trumpet implicated in the military industrial complex. diff --git a/layouts/shortcodes/html-tag.html b/layouts/shortcodes/html-tag.html new file mode 100644 index 0000000..15a7814 --- /dev/null +++ b/layouts/shortcodes/html-tag.html @@ -0,0 +1,4 @@ +{{ $optBlock := dict "display" "block" }} +{{ print "<" | safeHTML }}{{ .Get "tag" | default "div" }}{{ with .Get "id" }} id="{{ . }}"{{ end }}{{ with .Get "class" }} class="{{ . }}"{{ end }}{{ with .Get "style" }} style="{{ . | safeCSS }}"{{ end }}{{ print ">" | safeHTML }} +{{ with .Inner }}{{ . | $.Page.RenderString $optBlock }}{{ end }} +{{ print "" | safeHTML }} -- cgit v1.2.3