{{/* Inserts a text file into the HTML. See https://preliminary.istio.io/about/contribute/writing-a-new-topic/#embedding-preformatted-blocks for details */}} {{ $scratch := .Scratch }} {{ $name := split (.Get "file") "/" | last 1 }} {{ $scratch.Set "downloadas" (index $name 0) }} {{ if .Get "downloadas" }} {{ $scratch.Set "downloadas" (.Get "downloadas") }} {{ end }} {{ $file := readFile (.Get "file") }} {{ if (.Get "snippet") }} {{ $pattern := printf "(?msU)(.*\\$snippet %s.*$\\n)(.*)(?-s)(\\n^.*\\$endsnippet.*$)(?s-U)(.*)" (.Get "snippet") }} {{ $match := replaceRE $pattern "$2" $file }}
{{ $match }}
{{ else }}
{{ $file }}
{{ end }}