ref: 6d9a2d24976abc486531b67a4533df7774085413
parent: fb7d45e613e321410e847d39c3569434a5ffd81c
author: spf13 <[email protected]>
date: Thu May 1 21:01:44 EDT 2014
adding a front matter format to lead rune method
--- a/parser/frontmatter.go
+++ b/parser/frontmatter.go
@@ -17,6 +17,7 @@
"bytes"
"encoding/json"
"fmt"
+ "strings"
"github.com/BurntSushi/toml"
"launchpad.net/goyaml"
@@ -84,6 +85,20 @@
default:
return nil, fmt.Errorf("Unsupported Format provided")
}
+}
+
+func FormatToLeadRune(kind string) rune {
+ switch strings.ToLower(kind) {
+ case "yaml":
+ return rune([]byte(YAML_LEAD)[0])
+ case "toml":
+ return rune([]byte(TOML_LEAD)[0])
+ case "json":
+ return rune([]byte(JSON_LEAD)[0])
+ default:
+ return rune([]byte(TOML_LEAD)[0])
+ }
+
}
func DetectFrontMatter(mark rune) (f *FrontmatterType) {