From 8bbf31f9f779ae9958ff3324f0f7735aa366f7bc Mon Sep 17 00:00:00 2001 From: Thomas Voss Date: Mon, 11 Sep 2023 05:10:54 +0200 Subject: Add the ‘=’ node for whitespace trimming MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- formatter/formatter.go | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'formatter/formatter.go') 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) -- cgit v1.2.3