mirror of
https://github.com/adnanh/webhook.git
synced 2025-07-01 00:38:31 +00:00
feat: allow override of template delims
When you want to use "source":"template" arguments inside your hook file but also parse the hook file itself as a template, it is necessary use different delimiters on the two template parsers to avoid having to pepper all the inner templates with constructs like {{"{{"}}. Added an extra command line argument -template-delims that expects a comma-separated pair of delimiters like '[[,]]' that will be used when parsing the whole hooks file template. Inner templates in an Argument always use the default double-brace style.
This commit is contained in:
parent
9892bc678b
commit
bb8be5ed9a
3 changed files with 13 additions and 6 deletions
|
@ -433,7 +433,7 @@ func TestHooksLoadFromFile(t *testing.T) {
|
|||
|
||||
for _, tt := range hooksLoadFromFileTests {
|
||||
h := &Hooks{}
|
||||
err := h.LoadFromFile(tt.path, tt.asTemplate)
|
||||
err := h.LoadFromFile(tt.path, tt.asTemplate, "")
|
||||
if (err == nil) != tt.ok {
|
||||
t.Errorf(err.Error())
|
||||
}
|
||||
|
@ -450,7 +450,7 @@ func TestHooksTemplateLoadFromFile(t *testing.T) {
|
|||
}
|
||||
|
||||
h := &Hooks{}
|
||||
err := h.LoadFromFile(tt.path, tt.asTemplate)
|
||||
err := h.LoadFromFile(tt.path, tt.asTemplate, "")
|
||||
if (err == nil) != tt.ok {
|
||||
t.Errorf(err.Error())
|
||||
continue
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue