some updates related to #28

This commit is contained in:
Henrique Dias
2015-10-24 10:54:10 +01:00
parent 8affc3136f
commit a7fcdfa430
9 changed files with 48 additions and 21 deletions

View File

@@ -29,11 +29,12 @@ func Pretty(content []byte) (interface{}, error) {
}
type frontmatter struct {
Name string
Title string
Content interface{}
Type string
Parent *frontmatter
Name string
Title string
Content interface{}
Type string
HTMLType string
Parent *frontmatter
}
func rawToPretty(config interface{}, parent *frontmatter) interface{} {
@@ -129,6 +130,15 @@ func handleFlatValues(content interface{}, parent *frontmatter, name string) *fr
c.Type = "string"
}
switch strings.ToLower(name) {
case "description":
c.HTMLType = "textarea"
case "date", "publishdate":
c.HTMLType = "datetime"
default:
c.HTMLType = "text"
}
if parent.Type == "array" {
c.Name = parent.Name + "[]"
c.Title = content.(string)