From d95d30029f8d63190eb242c9914cee16b6b90627 Mon Sep 17 00:00:00 2001 From: XhmikosR Date: Tue, 8 Jan 2019 18:33:28 +0200 Subject: Switch to Hugo. No more Ruby dependency and most important more than 10 times less build time (at least on Windows)! --- site/layouts/shortcodes/example.html | 53 ++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 site/layouts/shortcodes/example.html (limited to 'site/layouts/shortcodes/example.html') diff --git a/site/layouts/shortcodes/example.html b/site/layouts/shortcodes/example.html new file mode 100644 index 000000000..67813b70f --- /dev/null +++ b/site/layouts/shortcodes/example.html @@ -0,0 +1,53 @@ +{{- /* + Usage: `example [args]` + + `args` are optional and can be one of the following: + id: the `div`'s id - default: "" + class: any extra class(es) to be added to the `div` - default "" + show_preview: if the preview should be output in the HTML - default: `true` + show_markup: if the markup should be output in the HTML - default: `true` +*/ -}} + +{{- $show_preview := .Get "show_preview" | default true -}} +{{- $show_markup := .Get "show_markup" | default true -}} +{{- $input := .Inner -}} + +{{- if eq $show_preview true -}} + + {{- $input -}} + +{{- end -}} + +{{- if eq $show_markup true -}} + {{- $.Scratch.Set "highlight_content" $input -}} + + {{- if (strings.Contains $input `\n" "✂️" -}} + {{- $modified_content = split $modified_content "✂️" -}} + + {{- if (strings.Contains $input `` $image_class) -}} + {{- else -}} + {{- $.Scratch.Add "highlight_content" `...` -}} + {{- end -}} + {{- else -}} + {{- $.Scratch.Add "highlight_content" $content_chunk -}} + {{- end -}} + {{- end -}} + {{- end -}} + + {{- highlight (trim ($.Scratch.Get "highlight_content") "\n") "html" "" -}} +{{- end -}} -- cgit v1.2.3