forked from caddyserver/caddy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
metadata_none.go
42 lines (34 loc) · 970 Bytes
/
metadata_none.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
package metadata
import (
"bytes"
)
// NoneParser is the parser for plaintext markdown with no metadata.
type NoneParser struct {
metadata Metadata
markdown *bytes.Buffer
}
// Type returns the kind of parser this struct is.
func (n *NoneParser) Type() string {
return "None"
}
// Init prepases and parses the metadata and markdown file
func (n *NoneParser) Init(b *bytes.Buffer) bool {
m := make(map[string]interface{})
n.metadata = NewMetadata(m)
n.markdown = bytes.NewBuffer(b.Bytes())
return true
}
// Parse the metadata
func (n *NoneParser) Parse(b []byte) ([]byte, error) {
return nil, nil
}
// Metadata returns parsed metadata. It should be called
// only after a call to Parse returns without error.
func (n *NoneParser) Metadata() Metadata {
return n.metadata
}
// Markdown returns parsed markdown. It should be called
// only after a call to Parse returns without error.
func (n *NoneParser) Markdown() []byte {
return n.markdown.Bytes()
}