diff options
author | Thomas Voss <mail@thomasvoss.com> | 2023-09-11 05:11:14 +0200 |
---|---|---|
committer | Thomas Voss <mail@thomasvoss.com> | 2023-09-11 05:11:14 +0200 |
commit | cbbbfedd615915c5ffc09fd644a787158d8ef866 (patch) | |
tree | c547a36dbd6d6ffd64b43cd8cf566aa351688c3c /formatter/formatter.go | |
parent | 8bbf31f9f779ae9958ff3324f0f7735aa366f7bc (diff) |
Run ‘go fmt’
Diffstat (limited to 'formatter/formatter.go')
-rw-r--r-- | formatter/formatter.go | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/formatter/formatter.go b/formatter/formatter.go index af84ec3..6249c0a 100644 --- a/formatter/formatter.go +++ b/formatter/formatter.go @@ -14,11 +14,11 @@ var ( '&': "&", '<': "<", } - stringEscapes = map[rune]string { - '"': """, - '&': "&", - '<': "<", - '>': ">", + stringEscapes = map[rune]string{ + '"': """, + '&': "&", + '<': "<", + '>': ">", '\'': "'", } ) @@ -49,10 +49,10 @@ func PrintAst(ast parser.AstNode) { func printAttrs(attrs []parser.Attr) { classes := attrs - classes = slices.DeleteFunc(classes, func (a parser.Attr) bool { + classes = slices.DeleteFunc(classes, func(a parser.Attr) bool { return a.Key != "class" }) - attrs = slices.DeleteFunc(attrs, func (a parser.Attr) bool { + attrs = slices.DeleteFunc(attrs, func(a parser.Attr) bool { return a.Key == "class" }) @@ -60,7 +60,7 @@ func printAttrs(attrs []parser.Attr) { fmt.Print(" class=\"") for i, a := range classes { fmt.Print(a.Value) - if i != len(classes) - 1 { + if i != len(classes)-1 { fmt.Print(" ") } else { fmt.Print("\"") @@ -105,7 +105,7 @@ func printChildrenTrim(nodes []parser.AstNode) { if i == 0 && n.Type == parser.Text { n.Text = trimLeftSpaces(n.Text) } - if i == len(nodes) - 1 && n.Type == parser.Text { + if i == len(nodes)-1 && n.Type == parser.Text { n.Text = trimRightSpaces(n.Text) } |