hugolib: Continue the file context/line number errors work

See #5324
This commit is contained in:
Bjørn Erik Pedersen 2018-10-21 12:20:21 +02:00
parent 7930d2132a
commit d1661b823a
No known key found for this signature in database
GPG key ID: 330E6E2BD4859D8F
23 changed files with 444 additions and 236 deletions

View file

@ -72,7 +72,7 @@ var buildErrorTemplate = `<!doctype html>
<main>
{{ highlight .Error "apl" "noclasses=true,style=monokai" }}
{{ with .File }}
{{ $params := printf "noclasses=true,style=monokai,linenos=table,hl_lines=%d,linenostart=%d" (add .Pos 1) .LineNumber }}
{{ $params := printf "noclasses=true,style=monokai,linenos=table,hl_lines=%d,linenostart=%d" (add .Pos 1) (sub .LineNumber .Pos) }}
{{ $lexer := .ChromaLexer | default "go-html-template" }}
{{ highlight (delimit .Lines "\n") $lexer $params }}
{{ end }}