diff --git a/layouts/partials/geturl.html b/layouts/partials/geturl.html index 2101a73..7231db9 100644 --- a/layouts/partials/geturl.html +++ b/layouts/partials/geturl.html @@ -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" }} diff --git a/layouts/shortcodes/codeblock.html b/layouts/shortcodes/codeblock.html index 77224aa..8d801e7 100644 --- a/layouts/shortcodes/codeblock.html +++ b/layouts/shortcodes/codeblock.html @@ -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") }} diff --git a/layouts/shortcodes/codelines.html b/layouts/shortcodes/codelines.html index 70c5ed6..0d8e7d6 100644 --- a/layouts/shortcodes/codelines.html +++ b/layouts/shortcodes/codelines.html @@ -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"))) }} diff --git a/layouts/shortcodes/rawblock.html b/layouts/shortcodes/rawblock.html index c89a1d4..edfbbf3 100644 --- a/layouts/shortcodes/rawblock.html +++ b/layouts/shortcodes/rawblock.html @@ -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 "
%s
" (htmlEscape (readFile (printf "code/%s" (.Get 0))))))) }}