diff options
-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) } |