{{ if .IsNamedParams }} {{ $.Scratch.Add "c-title" (.Get "title") }} {{ $.Scratch.Add "c-language" (lower (.Get "lang")) }} {{ $.Scratch.Add "c-url" (.Get "url") }} {{ $.Scratch.Add "c-link-text" (.Get "link-text") }} {{ else }} {{ if ge (len .Params) 1 }} {{ $.Scratch.Add "c-title" (.Get 0) }} {{ end }} {{ if ge (len .Params) 2 }} {{ $.Scratch.Add "c-language" (lower (.Get 1)) }} {{ end }} {{ if ge (len .Params) 3 }} {{ $.Scratch.Add "c-url" (.Get 2) }} {{ end }} {{ if ge (len .Params) 4 }} {{ $.Scratch.Add "c-link-text" (.Get 3) }} {{ end }} {{ end }} {{ $trimmedContent := trim .Inner "\n" }}
{{ if and ($.Scratch.Get "c-url") ($.Scratch.Get "c-title") }} {{ $.Scratch.Get "c-title" }}{{ $.Scratch.Get "c-link-text" | default ($.Scratch.Get "c-title") }} {{ else if $.Scratch.Get "c-title" }} {{ $.Scratch.Get "c-title" }} {{ end }}
{{ range $index,$value := (split $trimmedContent "\n") }}{{ add $index 1 }}
{{ end }}
{{ $trimmedContent }}