diff options
-rw-r--r-- | document.go | 21 |
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 != "" { |