add optional spaces in regexps

This commit is contained in:
Stanislav Seletskiy 2019-08-08 15:32:34 +03:00
parent de2c876632
commit 4cfda3afc1
No known key found for this signature in database
GPG Key ID: E6B40F71C367E6B5
2 changed files with 4 additions and 2 deletions

View File

@ -16,7 +16,9 @@ import (
)
var (
reIncludeDirective = regexp.MustCompile(`(?s)<!-- Include: (\S+)(.*?)-->`)
reIncludeDirective = regexp.MustCompile(
`(?s)<!--\s*Include:\s*(\S+)(.*?)-->`,
)
)
func LoadTemplate(

View File

@ -14,7 +14,7 @@ import (
)
var reMacroDirective = regexp.MustCompile(
`(?s)<!-- Macro: ([^\n]+)\n\s*Template: (\S+)\n(.*?)-->`,
`(?s)<!--\s*Macro:\s*([^\n]+)\n\s*Template:\s*(\S+)\n(.*?)-->`,
)
type Macro struct {