{{- /* Including file contents in article. If no syntax highlighting language is specified, the syntax highlighting language from the file extension will be automatically selected. @param {string} (positional parameter 0) File path. @param {string} (positional parameter 1) Syntax highlighting. If not specified, the syntax is determined by the file extension. @returns {template.HTML} @examples {{< file "README.md" "md" >}} */ -}} {{- if (.Get 0) -}} {{ $file := (.Get 0) }} {{ $lang := (.Get 1) }} {{ with ($.Page.Resources.Match ($file)) }} {{ range . }} {{ $cp := ((printf "clipboard-%s-%s" ($.Name) (delimit (shuffle (seq 11 99)) "")) | md5) }}
{{ (.Name) }}
{{ if (eq (($lang) | len) 0) }} {{ $lang = ((replace (path.Ext (.Name)) "." "") | default "plaintext") }} {{ end }} {{ (highlight ((.Content) | chomp) ($lang)) }}
{{ end }} {{ end }} {{- else -}} {{ (partial "alerts/no_params" .) }} {{- end -}}