mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-29 22:29:56 +02:00
tpl/tplimpl: Allow alternate comment syntax
Allow alternate comment syntax before block definitions: {{/* foo */}} {{- /* foo */}} {{- /* foo */ -}} Fixes #10495
This commit is contained in:
committed by
Bjørn Erik Pedersen
parent
a49e51fd0b
commit
0b976d2b40
@@ -91,9 +91,15 @@ func needsBaseTemplate(templ string) bool {
|
||||
if !inComment && strings.HasPrefix(templ[i:], "{{/*") {
|
||||
inComment = true
|
||||
i += 4
|
||||
} else if !inComment && strings.HasPrefix(templ[i:], "{{- /*") {
|
||||
inComment = true
|
||||
i += 6
|
||||
} else if inComment && strings.HasPrefix(templ[i:], "*/}}") {
|
||||
inComment = false
|
||||
i += 4
|
||||
} else if inComment && strings.HasPrefix(templ[i:], "*/ -}}") {
|
||||
inComment = false
|
||||
i += 6
|
||||
} else {
|
||||
r, size := utf8.DecodeRuneInString(templ[i:])
|
||||
if !inComment {
|
||||
|
Reference in New Issue
Block a user