diff options
author | Thomas Voss <mail@thomasvoss.com> | 2023-09-11 05:10:54 +0200 |
---|---|---|
committer | Thomas Voss <mail@thomasvoss.com> | 2023-09-11 05:10:54 +0200 |
commit | 8bbf31f9f779ae9958ff3324f0f7735aa366f7bc (patch) | |
tree | 0f6d6f70b2758df577dc8cd47e74b5e8636c1aba /formatter/formatter.go | |
parent | 977f794ab8b28d7462fd0e85eee7d4343f946d3a (diff) |
Add the ‘=’ node for whitespace trimming
Diffstat (limited to 'formatter/formatter.go')
-rw-r--r-- | formatter/formatter.go | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/formatter/formatter.go b/formatter/formatter.go index 157b0ab..af84ec3 100644 --- a/formatter/formatter.go +++ b/formatter/formatter.go @@ -42,6 +42,8 @@ func PrintAst(ast parser.AstNode) { } case parser.Tagless: printChildren(ast.Children) + case parser.TaglessTrim: + printChildrenTrim(ast.Children) } } @@ -93,6 +95,12 @@ func printText(s string) { } func printChildren(nodes []parser.AstNode) { + for _, n := range nodes { + PrintAst(n) + } +} + +func printChildrenTrim(nodes []parser.AstNode) { for i, n := range nodes { if i == 0 && n.Type == parser.Text { n.Text = trimLeftSpaces(n.Text) |