13 lines
		
	
	
		
			575 B
		
	
	
	
		
			HTML
		
	
	
	
	
	
			
		
		
	
	
			13 lines
		
	
	
		
			575 B
		
	
	
	
		
			HTML
		
	
	
	
	
	
{{ $scratch := .scratch }}
 | 
						|
{{ $scratch.Set "bestLength" -1 }}
 | 
						|
{{ $scratch.Set "bestUrl" (printf "https://dev.danilafe.com/Web-Projects/blog-static/src/branch/master/code/%s" .path) }}
 | 
						|
{{ $filePath := .path }}
 | 
						|
{{ range $module, $props := .submoduleLinks }}
 | 
						|
{{ $path := index $props "path" }}
 | 
						|
{{ $bestLength := $scratch.Get "bestLength" }}
 | 
						|
{{ if and (le $bestLength (len $path)) (hasPrefix $filePath $path) }}
 | 
						|
{{ $scratch.Set "bestLength" (len $path) }}
 | 
						|
{{ $scratch.Set "bestUrl" (printf "%s%s" (index $props "url") (strings.TrimPrefix $path $filePath)) }}
 | 
						|
{{ end }}
 | 
						|
{{ end }}
 |