From 3a82ae7114b72704a4711844787e4f119939b8e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Pedersen?= Date: Mon, 14 Mar 2016 17:52:11 +0100 Subject: [PATCH] parser: Unexport some internals --- parser/frontmatter.go | 11 ++++++----- 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