Track the best path for a submodule that was added
For Agda, this is a proxy for 'root directory' of a project Signed-off-by: Danila Fedorin <danila.fedorin@gmail.com>
This commit is contained in:
parent
a6425c7510
commit
b1334455ea
|
@ -6,6 +6,7 @@
|
|||
{{ $bestLength := $scratch.Get "bestLength" }}
|
||||
{{ if and (le $bestLength (len $path)) (hasPrefix $filePath $path) }}
|
||||
{{ $scratch.Set "bestLength" (len $path) }}
|
||||
{{ $scratch.Set "bestPath" $path }}
|
||||
{{ $scratch.Set "bestUrl" (printf "%s%s" $url (strings.TrimPrefix $path $filePath)) }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
{{ partial "geturl.html" (dict "scratch" .Scratch "path" (.Get 1) "siteSourceUrl" .Site.Params.siteSourceUrl "submoduleLinks" .Site.Data.submodules) }}
|
||||
{{ $groupconfig := dict
|
||||
"url" (.Scratch.Get "bestUrl")
|
||||
"basePath" (.Scratch.Get "bestPath")
|
||||
"path" (.Get 1)
|
||||
"comment" ", entire file"
|
||||
"code" (readFile (printf "code/%s" (.Get 1)))
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
{{ end }}
|
||||
{{ $groupconfig := dict
|
||||
"url" (.Scratch.Get "bestUrl")
|
||||
"basePath" (.Scratch.Get "bestPath")
|
||||
"path" (.Get 1)
|
||||
"comment" (.Scratch.Get "comment")
|
||||
"code" (delimit $lines "\n")
|
||||
|
|
|
@ -1,2 +1,9 @@
|
|||
{{ partial "geturl.html" (dict "scratch" .Scratch "path" (.Get 0) "siteSourceUrl" .Site.Params.siteSourceUrl "submoduleLinks" .Site.Data.submodules) }}
|
||||
{{ 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))))))) }}
|
||||
{{ $groupconfig := dict
|
||||
"url" (.Scratch.Get "bestUrl")
|
||||
"basePath" (.Scratch.Get "bestPath")
|
||||
"path" (.Get 0)
|
||||
"comment" ", entire file"
|
||||
"content" (safeHTML (printf "<pre><code>%s</code></pre>" (htmlEscape (readFile (printf "code/%s" (.Get 0))))))
|
||||
}}
|
||||
{{ partial "group.html" $groupconfig }}
|
||||
|
|
Loading…
Reference in New Issue
Block a user