diff --git a/lexers/g/go.go b/lexers/g/go.go index c90e1c4..7ce7912 100644 --- a/lexers/g/go.go +++ b/lexers/g/go.go @@ -87,7 +87,7 @@ func goTemplateRules() Rules { {`(range|if|else|while|with|template|end|true|false|nil|and|call|html|index|js|len|not|or|print|printf|println|urlquery|eq|ne|lt|le|gt|ge)\b`, Keyword, nil}, {`\||:?=|,`, Operator, nil}, {`[$]?[^\W\d]\w*`, NameOther, nil}, - {`[$]?\.(?:[^\W\d]\w*)?`, NameAttribute, nil}, + {`\$|[$]?\.(?:[^\W\d]\w*)?`, NameAttribute, nil}, {`"(\\\\|\\"|[^"])*"`, LiteralString, nil}, {`-?\d+i`, LiteralNumber, nil}, {`-?\d+\.\d*([Ee][-+]\d+)?i`, LiteralNumber, nil}, diff --git a/lexers/testdata/go-text-template.actual b/lexers/testdata/go-text-template.actual index a014cc1..7499632 100644 --- a/lexers/testdata/go-text-template.actual +++ b/lexers/testdata/go-text-template.actual @@ -7,4 +7,6 @@ {{ range $idx, $value := $variable }} Hello {{ $idx }} -{{ end }} \ No newline at end of file +{{ end }} + +{{ $ }} \ No newline at end of file diff --git a/lexers/testdata/go-text-template.expected b/lexers/testdata/go-text-template.expected index 651c727..fbab675 100644 --- a/lexers/testdata/go-text-template.expected +++ b/lexers/testdata/go-text-template.expected @@ -46,5 +46,11 @@ {"type":"TextWhitespace","value":" "}, {"type":"Keyword","value":"end"}, {"type":"TextWhitespace","value":" "}, + {"type":"CommentPreproc","value":"}}"}, + {"type":"Other","value":"\n\n"}, + {"type":"CommentPreproc","value":"{{"}, + {"type":"TextWhitespace","value":" "}, + {"type":"NameAttribute","value":"$"}, + {"type":"TextWhitespace","value":" "}, {"type":"CommentPreproc","value":"}}"} ]