aboutsummaryrefslogtreecommitdiff
path: root/formatter/formatter.go
diff options
context:
space:
mode:
Diffstat (limited to 'formatter/formatter.go')
-rw-r--r--formatter/formatter.go24
1 files changed, 2 insertions, 22 deletions
diff --git a/formatter/formatter.go b/formatter/formatter.go
index 6524747..25ecafc 100644
--- a/formatter/formatter.go
+++ b/formatter/formatter.go
@@ -27,20 +27,12 @@ func PrintAst(ast parser.AstNode) {
switch ast.Type {
case parser.Text:
printText(ast.Text)
- case parser.DocType:
- printDocType(ast)
case parser.Normal:
fmt.Printf("<%s", ast.Text)
printAttrs(ast.Attrs)
+ fmt.Print(">")
- if len(ast.Children) == 0 {
- if parser.Xml {
- fmt.Print("/>")
- } else {
- fmt.Print(">")
- }
- } else {
- fmt.Print(">")
+ if len(ast.Children) > 0 {
printChildren(ast.Children)
fmt.Printf("</%s>", ast.Text)
}
@@ -86,18 +78,6 @@ func printAttrs(attrs []parser.Attr) {
}
}
-func printDocType(node parser.AstNode) {
- if parser.Xml {
- fmt.Print("<?xml")
- printAttrs(node.Attrs)
- fmt.Print("?>")
- } else {
- fmt.Print("<!DOCTYPE")
- printAttrs(node.Attrs)
- fmt.Print(">")
- }
-}
-
func printText(s string) {
for _, r := range s {
if v, ok := stringEscapes[r]; ok {