summaryrefslogtreecommitdiffstats
path: root/document.go
diff options
context:
space:
mode:
authorclsr <clsr@clsr.net>2017-08-24 15:55:47 +0200
committerclsr <clsr@clsr.net>2017-08-24 15:55:47 +0200
commit27a229a06f0354ee16bb97e6cf2dd1780923e74f (patch)
tree71ab917178a7615d8689df7cd6f2ae26398c4e46 /document.go
parentd62b2f6de6854b107601ea82611b845c6f830237 (diff)
downloadcnm-go-27a229a06f0354ee16bb97e6cf2dd1780923e74f.tar.gz
cnm-go-27a229a06f0354ee16bb97e6cf2dd1780923e74f.zip
Make Document a Block
Diffstat (limited to 'document.go')
-rw-r--r--document.go21
1 files changed, 21 insertions, 0 deletions
diff --git a/document.go b/document.go
index b5cdbe5..5137b80 100644
--- a/document.go
+++ b/document.go
@@ -63,6 +63,27 @@ func ParseDocument(r io.Reader) (doc *Document, err error) {
return
}
+// Name returns an empty string (top-level block context has no name).
+func (doc *Document) Name() string {
+ return ""
+}
+
+// Args returns a nil slice (top-level block context has no args).
+func (doc *Document) Args() []string {
+ return nil
+}
+
+// WriteIndent writes the document to w.
+//
+// n must be 0 or this function will panic.
+func (doc *Document) WriteIndent(w io.Writer, n int) error {
+ if n != 0 {
+ panic("cnm-go: Document.WriteIndent: n must be 0")
+ }
+ return doc.Write(w)
+}
+
+// Write writes the document to w.
func (doc *Document) Write(w io.Writer) error {
bw := bufio.NewWriter(w)
if doc.Title != "" {