2021-04-15 01:37:18 -07:00
|
|
|
{{ $scratch := .scratch }}
|
|
|
|
{{ $scratch.Set "bestLength" -1 }}
|
2023-12-30 13:58:56 -08:00
|
|
|
{{ $scratch.Set "bestUrl" (printf "%s/code/%s" .siteSourceUrl .path) }}
|
2021-04-15 01:37:18 -07:00
|
|
|
{{ $filePath := .path }}
|
2024-05-16 15:33:44 -07:00
|
|
|
{{ range $path, $url := .submoduleLinks }}
|
2021-04-15 01:37:18 -07:00
|
|
|
{{ $bestLength := $scratch.Get "bestLength" }}
|
|
|
|
{{ if and (le $bestLength (len $path)) (hasPrefix $filePath $path) }}
|
|
|
|
{{ $scratch.Set "bestLength" (len $path) }}
|
2024-05-16 15:33:44 -07:00
|
|
|
{{ $scratch.Set "bestUrl" (printf "%s%s" $url (strings.TrimPrefix $path $filePath)) }}
|
2021-04-15 01:37:18 -07:00
|
|
|
{{ end }}
|
|
|
|
{{ end }}
|