Add the ability to ignore errors in ExprTags

This commit is contained in:
2024-02-07 18:27:21 -08:00
parent 958a25d559
commit 703e55df04
6 changed files with 350 additions and 316 deletions

View File

@@ -112,7 +112,11 @@ func (t *Template) execute(w io.Writer, nodes []ast.Node, local map[string]any)
case ast.ExprTag:
v, err := t.getValue(node.Value, local)
if err != nil {
return err
if node.IgnoreError {
continue
} else {
return err
}
}
if _, ok := v.(ast.Assignment); ok {
continue