{{- $src := (.Get "file") -}} {{- $lang := .Get "language" | default ("python") }} {{- $opt := .Get "opt" | default ("linenos=table") }} {{- if in $src "/" -}} {{$file := $src | readFile}} {{ highlight (print $file) $lang $opt}} {{ $filelink := (replaceRE "^[/]+static" "" $src) }} {{ $justTheSplit := split $filelink "/" }} {{ $lastPartOnly := index (last 1 $justTheSplit) 0}} {{ .Scratch.Set "link" $filelink }} {{ .Scratch.Set "linkname" $lastPartOnly }} {{- else -}} {{ $file := (printf "%s%s" $.Page.File.Dir $src) }} {{ highlight (readFile (printf "content/%s" $file)) $lang $opt}} {{ .Scratch.Set "link" $file }} {{ .Scratch.Set "linkname" $src }} {{- end -}} {{ $link := .Scratch.Get "link" }} {{ $linkname := .Scratch.Get "linkname" }} {{ $linkname }}