From 52ea5abbc8b16ee543427a06fa2e857d3ab06d48 Mon Sep 17 00:00:00 2001 From: Danila Fedorin Date: Tue, 21 May 2024 20:39:28 -0700 Subject: [PATCH] For Agda code blocks, thread through line numbers Signed-off-by: Danila Fedorin --- layouts/partials/highlightgroup.html | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/layouts/partials/highlightgroup.html b/layouts/partials/highlightgroup.html index 6208044..0957d8d 100644 --- a/layouts/partials/highlightgroup.html +++ b/layouts/partials/highlightgroup.html @@ -1 +1,9 @@ -{{ partial "group.html" (dict "url" .url "path" .path "comment" .comment "content" (highlight .code .language .opts)) }} +{{- if eq .language "Agda" -}} +{{- page.Scratch.Set "highlightGroupAttrs" (printf "data-agda-block") -}} +{{- if (or .firstLine .lastLine) -}} +{{- page.Scratch.Add "highlightGroupAttrs" (printf " data-agda-first-line=\"%v\" data-agda-last-line=\"%v\"" .firstLine .lastLine) -}} +{{- end -}} +{{- else -}} +{{- page.Scratch.Set "highlightGroupAttrs" nil -}} +{{- end -}} +{{ partial "group.html" (dict "url" .url "path" .path "comment" .comment "content" (highlight .code .language .opts) "attrs" (page.Scratch.Get "highlightGroupAttrs")) }}