Extract hardcoded URL to danilafe.com into a site param.

This commit is contained in:
Danila Fedorin 2023-12-30 13:58:56 -08:00
parent e82879434e
commit c728748106
4 changed files with 4 additions and 4 deletions

View File

@ -1,6 +1,6 @@
{{ $scratch := .scratch }}
{{ $scratch.Set "bestLength" -1 }}
{{ $scratch.Set "bestUrl" (printf "https://dev.danilafe.com/Web-Projects/blog-static/src/branch/master/code/%s" .path) }}
{{ $scratch.Set "bestUrl" (printf "%s/code/%s" .siteSourceUrl .path) }}
{{ $filePath := .path }}
{{ range $module, $props := .submoduleLinks }}
{{ $path := index $props "path" }}

View File

@ -1,2 +1,2 @@
{{ partial "geturl.html" (dict "scratch" .Scratch "path" (.Get 1) "submoduleLinks" .Site.Params.submoduleLinks) }}
{{ partial "geturl.html" (dict "scratch" .Scratch "path" (.Get 1) "siteSourceUrl" .Site.Params.siteSourceUrl "submoduleLinks" .Site.Params.submoduleLinks) }}
{{ 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") }}

View File

@ -13,7 +13,7 @@
{{ .Scratch.Set "opts" "" }}
{{ end }}
{{ partial "geturl.html" (dict "scratch" .Scratch "path" (.Get 1) "submoduleLinks" .Site.Params.submoduleLinks) }}
{{ partial "geturl.html" (dict "scratch" .Scratch "path" (.Get 1) "siteSourceUrl" .Site.Params.siteSourceUrl "submoduleLinks" .Site.Params.submoduleLinks) }}
{{ partial "linerangestr.html" (dict "scratch" .Scratch "from" (.Get 2) "to" (.Get 3)) }}
{{ 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"))) }}

View File

@ -1,2 +1,2 @@
{{ partial "geturl.html" (dict "scratch" .Scratch "path" (.Get 0) "submoduleLinks" .Site.Params.submoduleLinks) }}
{{ partial "geturl.html" (dict "scratch" .Scratch "path" (.Get 0) "siteSourceUrl" .Site.Params.siteSourceUrl "submoduleLinks" .Site.Params.submoduleLinks) }}
{{ partial "group.html" (dict "url" (.Scratch.Get "bestUrl") "path" (.Get 0) "comment" ", entire file" "content" (safeHTML (printf "<pre><code>%s</code></pre>" (htmlEscape (readFile (printf "code/%s" (.Get 0))))))) }}