{{ $tabs := findRE "\\n([\\w\\W\\s\\S]*?)" .Inner }} {{ range $index,$value := $tabs }} {{ $language := replaceRE "" "$1" (index (findRE "" .) 0) }} {{ $language := lower $language }} {{ $content := replaceRE "\\n([\\w\\W\\s\\S]*?)" "$2" . }} {{ $.Scratch.Add "tc-languages" (slice $language) }} {{ $.Scratch.Add "tc-content" (slice $content) }} {{ end }} {{ if .IsNamedParams }} {{ $.Scratch.Add "tc-title" (.Get "title") }} {{ $.Scratch.Add "tc-url" (.Get "url") }} {{ else }} {{ if ge (len .Params) 1 }} {{ $.Scratch.Add "tc-title" (.Get 0) }} {{ end }} {{ if len .Params | eq 2 }} {{ $.Scratch.Add "tc-url" (.Get 1) }} {{ end }} {{ end }}
{{ if and ($.Scratch.Get "tc-url") ($.Scratch.Get "tc-title") }} {{ $.Scratch.Get "tc-title" }} {{ else if $.Scratch.Get "tc-title" }} {{ $.Scratch.Get "tc-title" }} {{ end }}
{{ range $index, $value := $.Scratch.Get "tc-content" }} {{ $trimmedContent := trim $value "\n" }}
{{ range $index,$value := (split $trimmedContent "\n") }}{{ add $index 1 }}
{{ end }}
{{ $trimmedContent }}
{{ end }}