diff --git a/layouts/partials/highlightgroup.html b/layouts/partials/highlightgroup.html index ff4f92b..34387e6 100644 --- a/layouts/partials/highlightgroup.html +++ b/layouts/partials/highlightgroup.html @@ -1,8 +1,9 @@ -{{- page.Scratch.Set "highlightGroupAttrs" (printf "data-base-path=\"%s\" data-file-path=\"%v\"" .basePath .path) -}} +{{- $scratch := newScratch -}} +{{- $scratch.Set "highlightGroupAttrs" (printf "data-base-path=\"%s\" data-file-path=\"%v\"" .basePath .path) -}} {{- if (or .firstLine .lastLine) -}} -{{- page.Scratch.Add "highlightGroupAttrs" (printf " data-first-line=\"%v\" data-last-line=\"%v\"" .firstLine .lastLine) -}} +{{- $scratch.Add "highlightGroupAttrs" (printf " data-first-line=\"%v\" data-last-line=\"%v\"" .firstLine .lastLine) -}} {{- end -}} {{- if eq (lower .language) "agda" -}} -{{- page.Scratch.Add "highlightGroupAttrs" " data-agda-block" -}} +{{- $scratch.Add "highlightGroupAttrs" " data-agda-block" -}} {{- end -}} -{{ partial "group.html" (dict "url" .url "path" .path "comment" .comment "content" (highlight .code .language .opts) "attrs" (page.Scratch.Get "highlightGroupAttrs")) }} +{{ partial "group.html" (dict "url" .url "path" .path "comment" .comment "content" (highlight .code .language .opts) "attrs" ($scratch.Get "highlightGroupAttrs")) }} diff --git a/layouts/shortcodes/block.html b/layouts/shortcodes/block.html index 4169e92..2da311e 100644 --- a/layouts/shortcodes/block.html +++ b/layouts/shortcodes/block.html @@ -1,3 +1,3 @@
- {{ .Inner }} + {{- .Inner -}}
diff --git a/layouts/shortcodes/githubsnippet.html b/layouts/shortcodes/githubsnippet.html index 4629313..6ffc901 100644 --- a/layouts/shortcodes/githubsnippet.html +++ b/layouts/shortcodes/githubsnippet.html @@ -5,6 +5,7 @@ {{- $line := .Get 4 -}} {{- $lines := split (trim .Inner "\n") "\n" -}} +{{- $scratch := newScratch -}} {{- $url := printf "https://github.com/%s/blob/%s/%s#L%d" $repo $commit $file $line -}} -{{- partial "linerangestr.html" (dict "scratch" .Scratch "from" 0 "to" $line) -}} -{{- partial "highlightgroup.html" (dict "url" $url "path" $file "comment" (.Scratch.Get "comment") "code" (trim .Inner "\n") "language" $lang) -}} +{{- partial "linerangestr.html" (dict "scratch" $scratch "from" 0 "to" $line) -}} +{{- partial "highlightgroup.html" (dict "url" $url "path" $file "comment" ($scratch.Get "comment") "code" (trim .Inner "\n") "language" $lang) -}} diff --git a/layouts/shortcodes/message.html b/layouts/shortcodes/message.html index 6a1c5c8..4c84f9f 100644 --- a/layouts/shortcodes/message.html +++ b/layouts/shortcodes/message.html @@ -1,10 +1,10 @@ diff --git a/layouts/shortcodes/rawblock.html b/layouts/shortcodes/rawblock.html index 01a42bb..9511479 100644 --- a/layouts/shortcodes/rawblock.html +++ b/layouts/shortcodes/rawblock.html @@ -1,9 +1,10 @@ -{{ partial "geturl.html" (dict "scratch" .Scratch "path" (.Get 0) "siteSourceUrl" .Site.Params.siteSourceUrl "submoduleLinks" .Site.Data.submodules) }} +{{- $scratch := newScratch -}} +{{- partial "geturl.html" (dict "scratch" $scratch "path" (.Get 0) "siteSourceUrl" .Site.Params.siteSourceUrl "submoduleLinks" .Site.Data.submodules) -}} {{- $groupconfig := dict - "url" (.Scratch.Get "bestUrl") - "basePath" (.Scratch.Get "bestPath") + "url" ($scratch.Get "bestUrl") + "basePath" ($scratch.Get "bestPath") "path" (.Get 0) "comment" ", entire file" "content" (safeHTML (printf "%s
" (htmlEscape (readFile (printf "code/%s" (.Get 0))))))
-}}
-{{ partial "group.html" $groupconfig }}
+{{- partial "group.html" $groupconfig -}}
diff --git a/layouts/shortcodes/sidenote.html b/layouts/shortcodes/sidenote.html
index 65dda90..e488f9c 100644
--- a/layouts/shortcodes/sidenote.html
+++ b/layouts/shortcodes/sidenote.html
@@ -1,13 +1,13 @@
-
-
-{{ if $offset := .Get 3 }}
-
-{{ else }}
-
-{{ end }}
-[{{ i18n "note" }}:
-{{ .Inner }}
+
+
+{{- if $offset := .Get 3 -}}
+
+{{- else -}}
+
+{{- end -}}
+[{{- i18n "note" -}}:
+{{- .Inner -}}
]
diff --git a/layouts/shortcodes/todo.html b/layouts/shortcodes/todo.html
index b8e2537..e93f0fa 100644
--- a/layouts/shortcodes/todo.html
+++ b/layouts/shortcodes/todo.html
@@ -1,3 +1,3 @@