Also marshal Node by value
diff --git a/encode.go b/encode.go
index 1f37271..e998db9 100644
--- a/encode.go
+++ b/encode.go
@@ -119,6 +119,9 @@
case *Node:
e.nodev(in)
return
+ case Node:
+ e.nodev(in.Addr())
+ return
case time.Time:
e.timev(tag, in)
return
diff --git a/encode_test.go b/encode_test.go
index 3f32393..83b1f0e 100644
--- a/encode_test.go
+++ b/encode_test.go
@@ -428,6 +428,21 @@
map[string]string{"a": "\tB\n\tC\n"},
"a: |\n \tB\n \tC\n",
},
+
+ // yaml.Node
+ {
+ &struct {
+ Value yaml.Node
+ }{
+ yaml.Node{
+ Kind: yaml.ScalarNode,
+ Tag: "!!str",
+ Value: "foo",
+ Style: yaml.SingleQuotedStyle,
+ },
+ },
+ "value: 'foo'\n",
+ },
}
func (s *S) TestMarshal(c *C) {