{{- .Scratch.Set "content" "" -}} {{- .Scratch.Set "identifier" "" -}} {{- $identifier := "" -}} {{- $titleview := "" -}} {{- $filepath := .Get "file" -}} {{- if ($filepath) -}} {{- .Scratch.Set "content" "\n" -}} {{- .Scratch.Add "content" ($filepath | readFile) -}} {{- .Scratch.Add "content" "\n" -}} {{- .Scratch.Set "identifier" (first 10 (md5 (.Scratch.Get "content"))) -}} {{- else -}} {{- .Scratch.Set "content" .Inner -}} {{- .Scratch.Add "content" "\n" -}} {{- .Scratch.Set "identifier" (first 10 (md5 .Inner)) -}} {{- end -}} {{- $lang := .Get "lang" -}} {{- $title := .Get "title" -}} {{- $options := .Get "options" -}} {{- "\n" | safeHTML -}}
{{- "\n" | safeHTML -}} {{- if eq $title "filename" -}} {{- if $filepath -}}
{{- (print "\t" $filepath "\t" ) -}}
{{- "\n" | safeHTML -}} {{- else -}}
{{- (print "\t" $title "\t" ) -}}
{{- end -}} {{- else if $title -}}
{{- (print "\t" $title "\t" ) -}}
{{- "\n" | safeHTML -}} {{- end -}}
{{- "\n" | safeHTML -}} {{- if ($options) -}} {{- highlight (.Scratch.Get "content") $lang $options -}} {{- else -}} {{- highlight (.Scratch.Get "content") $lang (default "linenos=false") -}} {{- end -}}