Special case empty @@ in code blocks to be NOPs.

This commit is contained in:
mtail 2018-07-10 12:15:21 -07:00
parent 4e2b9233bc
commit 4bba186b81
1 changed files with 4 additions and 1 deletions

View File

@ -52,6 +52,9 @@ be invalid HTML
{{ $branch := .Site.Data.args.branch_name }}
{{ $links := findRE "@(.*?)@" ($scratch.Get "text") }}
{{ range $link := $links }}
{{ $href := printf "https://raw.githubusercontent.com/istio/istio/%s/%s" $branch (trim $link "@") }}
{{ $target := trim $link "@" }}
{{ if gt (len $target) 0 }}
{{ $href := printf "https://raw.githubusercontent.com/istio/istio/%s/%s" $branch $target }}
<a hidden style="display:none" href="{{ $href }}"></a>
{{ end }}
{{ end }}