diff options
author | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2016-03-14 17:52:11 +0100 |
---|---|---|
committer | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2016-03-14 17:52:11 +0100 |
commit | 3a82ae7114b72704a4711844787e4f119939b8e2 (patch) | |
tree | d0675840ab9155d0128ae8179e93d6b8b69d46b2 | |
parent | 5d915e7e9655288124695b9589e71c7c9011bf3d (diff) |
parser: Unexport some internals
-rw-r--r-- | parser/frontmatter.go | 11 | ||||
-rw-r--r-- | parser/page.go | 2 |
2 files changed, 7 insertions, 6 deletions
diff --git a/parser/frontmatter.go b/parser/frontmatter.go index af58d5654..cbeb10be3 100644 --- a/parser/frontmatter.go +++ b/parser/frontmatter.go @@ -23,7 +23,7 @@ import ( "gopkg.in/yaml.v2" ) -type FrontmatterType struct { +type frontmatterType struct { markstart, markend []byte Parse func([]byte) (interface{}, error) includeMark bool @@ -135,6 +135,7 @@ func FormatToLeadRune(kind string) rune { } } +// TODO(bep) move to helpers func FormatSanitize(kind string) string { switch strings.ToLower(kind) { case "yaml", "yml": @@ -148,14 +149,14 @@ func FormatSanitize(kind string) string { } } -func DetectFrontMatter(mark rune) (f *FrontmatterType) { +func detectFrontMatter(mark rune) (f *frontmatterType) { switch mark { case '-': - return &FrontmatterType{[]byte(YAML_DELIM), []byte(YAML_DELIM), HandleYAMLMetaData, false} + return &frontmatterType{[]byte(YAML_DELIM), []byte(YAML_DELIM), HandleYAMLMetaData, false} case '+': - return &FrontmatterType{[]byte(TOML_DELIM), []byte(TOML_DELIM), HandleTOMLMetaData, false} + return &frontmatterType{[]byte(TOML_DELIM), []byte(TOML_DELIM), HandleTOMLMetaData, false} case '{': - return &FrontmatterType{[]byte{'{'}, []byte{'}'}, HandleJSONMetaData, true} + return &frontmatterType{[]byte{'{'}, []byte{'}'}, HandleJSONMetaData, true} default: return nil } diff --git a/parser/page.go b/parser/page.go index 9bffc6993..018b3d35d 100644 --- a/parser/page.go +++ b/parser/page.go @@ -79,7 +79,7 @@ func (p *page) Metadata() (meta interface{}, err error) { frontmatter := p.FrontMatter() if len(frontmatter) != 0 { - fm := DetectFrontMatter(rune(frontmatter[0])) + fm := detectFrontMatter(rune(frontmatter[0])) meta, err = fm.Parse(frontmatter) if err != nil { return |