diff --git a/Param.go b/Param.go index cfe749d..89ded49 100644 --- a/Param.go +++ b/Param.go @@ -100,28 +100,32 @@ func (p *Param) SetValue(val any) { // Placeholder .. {{Key}} func (p *Param) Placeholder() string { - var formatter string = "" + var formatter, trigger, params string if p.Formatter != nil { formatter = p.Formatter.String() } - var trigger string = "" if p.Trigger != nil { trigger = p.Trigger.String() } - return "{{" + p.AbsoluteKey + " " + formatter + trigger + "}}" + if p.Formatter != nil || p.Trigger != nil { + params = " " + formatter + trigger + } + return "{{" + p.AbsoluteKey + params + "}}" } // PlaceholderKey .. {{#Key}} func (p *Param) PlaceholderKey() string { - var formatter string = "" + var formatter, trigger, params string if p.Formatter != nil { formatter = p.Formatter.String() } - var trigger string = "" if p.Trigger != nil { trigger = p.Trigger.String() } - return "{{#" + p.AbsoluteKey + " " + formatter + trigger + "}}" + if p.Formatter != nil || p.Trigger != nil { + params = " " + formatter + trigger + } + return "{{#" + p.AbsoluteKey + params + "}}" } // PlaceholderInline .. {{Key ,}} diff --git a/Template.stage.funcs.go b/Template.stage.funcs.go index fb22f14..4952ab0 100644 --- a/Template.stage.funcs.go +++ b/Template.stage.funcs.go @@ -67,15 +67,16 @@ func (t *Template) expandPlaceholders(xnode *xmlNode) { placeholderType = rowPlaceholder } - var formatter string + var formatter, trigger, params string if rowParam.Formatter != nil { formatter = rowParam.Formatter.String() } - - var trigger string if rowParam.Trigger != nil { trigger = rowParam.Trigger.String() } + if rowParam.Formatter != nil || rowParam.Trigger != nil { + params = " " + formatter + trigger + } paramData := t.params.FindAllByKey(rowParam.AbsoluteKey) if len(paramData) == 0 { @@ -84,7 +85,7 @@ func (t *Template) expandPlaceholders(xnode *xmlNode) { placeholders := make([]string, paramData[len(paramData)-1].Index) for _, param := range paramData { - placeholders[param.Index-1] = "{{" + param.AbsoluteKey + " " + formatter + trigger + "}}" + placeholders[param.Index-1] = "{{" + param.AbsoluteKey + params + "}}" } rowPlaceholders[rowParam.RowPlaceholder] = &placeholder{ Type: placeholderType,