{{/* Handle the "file" and "lang" named parameter or two unnamed parameter as the filepath and coding language*/}} {{/* The first parameter should be a relative path to the "static" directory. Ex: "examples/jobs/sample-job.yaml" */}} {{ if .IsNamedParams }} {{ $.Scratch.Set "fparameter" ( .Get "file" ) }} {{ $.Scratch.Set "lang" ( .Get "lang") }} {{ else }} {{ $.Scratch.Set "fparameter" ( .Get 0 ) }} {{ $.Scratch.Set "lang" ( .Get 1 ) }} {{ end }} {{/* If coding language are specified, then the static file is a code file; If not, then the static are non-code file. */}} {{ if eq ($.Scratch.Get "lang") "" }} {{ $.Scratch.Set "iscode" "false"}} {{ else }} {{ $.Scratch.Set "iscode" "true" }} {{ end }} {{/* `fparameter is a relative path of the static file from the `static` directory. For example, `/example/python/install-kueue-queues.py` */}} {{ $.Scratch.Set "filepath" "/" }} {{ $.Scratch.Add "filepath" "static/" }} {{ $.Scratch.Add "filepath" ($.Scratch.Get "fparameter") }} {{/* If the file exists, read it and highlight it if it's code. Throw a compile error or print an error on the page if the file is not found */}} {{ if fileExists ($.Scratch.Get "filepath") }} {{ $filename := (path.Split ($.Scratch.Get "filepath")).File }} {{ $link := printf "/%s" ($.Scratch.Get "fparameter") | safeURL }}
The file {{ $.Scratch.Get "filepath" }} was not found.