Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/gohugoio/hugo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorspf13 <steve.francia@gmail.com>2014-05-02 09:01:44 +0400
committerspf13 <steve.francia@gmail.com>2014-05-02 09:01:44 +0400
commit6d9a2d24976abc486531b67a4533df7774085413 (patch)
tree5162d142cbd67f488c96a35a220e888a81577ad3 /parser/frontmatter.go
parentfb7d45e613e321410e847d39c3569434a5ffd81c (diff)
adding a front matter format to lead rune method
Diffstat (limited to 'parser/frontmatter.go')
-rw-r--r--parser/frontmatter.go15
1 files changed, 15 insertions, 0 deletions
diff --git a/parser/frontmatter.go b/parser/frontmatter.go
index 6ace0031d..374fe020b 100644
--- a/parser/frontmatter.go
+++ b/parser/frontmatter.go
@@ -17,6 +17,7 @@ import (
"bytes"
"encoding/json"
"fmt"
+ "strings"
"github.com/BurntSushi/toml"
"launchpad.net/goyaml"
@@ -86,6 +87,20 @@ func InterfaceToFrontMatter(in interface{}, mark rune) ([]byte, error) {
}
}
+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) {
switch mark {
case '-':