Break up code creating highlight groups and pass in line numbers
Signed-off-by: Danila Fedorin <danila.fedorin@gmail.com>
This commit is contained in:
parent
a6a14c3909
commit
67da389005
|
@ -1,2 +1,10 @@
|
|||
{{ partial "geturl.html" (dict "scratch" .Scratch "path" (.Get 1) "siteSourceUrl" .Site.Params.siteSourceUrl "submoduleLinks" .Site.Data.submodules) }}
|
||||
{{ partial "highlightgroup.html" (dict "url" (.Scratch.Get "bestUrl") "path" (.Get 1) "comment" ", entire file" "code" (readFile (printf "code/%s" (.Get 1))) "language" (.Get 0) "opts" "linenos=table") }}
|
||||
{{ $groupconfig := dict
|
||||
"url" (.Scratch.Get "bestUrl")
|
||||
"path" (.Get 1)
|
||||
"comment" ", entire file"
|
||||
"code" (readFile (printf "code/%s" (.Get 1)))
|
||||
"language" (.Get 0)
|
||||
"opts" "linenos=table"
|
||||
}}
|
||||
{{ partial "highlightgroup.html" $groupconfig }}
|
||||
|
|
|
@ -23,7 +23,17 @@
|
|||
{{ with (.Scratch.Get "hidden") }}
|
||||
<details><summary>{{ . | markdownify }}</summary>
|
||||
{{ end }}
|
||||
{{ partial "highlightgroup.html" (dict "url" (.Scratch.Get "bestUrl") "path" (.Get 1) "comment" (.Scratch.Get "comment") "code" (delimit $lines "\n") "language" (.Get 0) "opts" (printf "linenos=table,linenostart=%d%s" (.Get 2) (.Scratch.Get "opts"))) }}
|
||||
{{ $groupconfig := dict
|
||||
"url" (.Scratch.Get "bestUrl")
|
||||
"path" (.Get 1)
|
||||
"comment" (.Scratch.Get "comment")
|
||||
"code" (delimit $lines "\n")
|
||||
"firstLine" (int (.Get 2))
|
||||
"lastLine" (int (.Get 3))
|
||||
"language" (.Get 0)
|
||||
"opts" (printf "linenos=table,linenostart=%d%s" (.Get 2) (.Scratch.Get "opts"))
|
||||
}}
|
||||
{{ partial "highlightgroup.html" $groupconfig }}
|
||||
{{ with (.Scratch.Get "hidden") }}
|
||||
</details>
|
||||
{{ end }}
|
||||
|
|
Loading…
Reference in New Issue
Block a user