Skip to content

Commit

Permalink
quote name
Browse files Browse the repository at this point in the history
  • Loading branch information
Rob Farrow committed Jun 3, 2021
1 parent d16f8d2 commit 845ddc5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 4 additions & 1 deletion encoder.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,10 @@ func (node *Node) write(out *strings.Builder) []*Node {
indent := strings.Repeat(" ", node.Indent)
out.WriteString(indent + node.Type)
if len(node.Name) > 0 {
out.WriteString(":" + node.Name)
if NoQuote(node.Name) {
out.WriteString(":" + node.Name)
}
out.WriteString(fmt.Sprintf(":%q", node.Name))
}
for key, val := range node.Keys {
if NoQuote(val) {
Expand Down
2 changes: 1 addition & 1 deletion tests/test0.brf
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
html
head
head:"go-flags"
title `My Web Page`
body class:mybody
h1 `My Web Page`
Expand Down

0 comments on commit 845ddc5

Please sign in to comment.