fix #7 and resolve #8

pull/20/head
Henrique Dias 2015-09-17 15:45:59 +01:00
parent 992f1c2c01
commit 686a909e23
3 changed files with 24 additions and 24 deletions

File diff suppressed because one or more lines are too long

View File

@ -17,7 +17,7 @@ $(document).on('ready pjax:success', function() {
$(this).data("previewing", "false");
notification({
text: "You've gone into editing mode.",
text: "Think, relax and do the better you can!",
type: 'information',
timeout: 2000
});
@ -31,7 +31,7 @@ $(document).on('ready pjax:success', function() {
$(this).data("previewing", "true");
notification({
text: "You've gone into preview mode.",
text: "This is how your post looks like.",
type: 'information',
timeout: 2000
});

View File

@ -35,27 +35,6 @@ type frontmatter struct {
Parent *frontmatter
}
func sortByTitle(config []*frontmatter) {
keys := make([]string, len(config))
positionByTitle := make(map[string]int)
for index, element := range config {
keys[index] = element.Title
positionByTitle[element.Title] = index
}
sort.Strings(keys)
cnf := make([]*frontmatter, len(config))
for index, title := range keys {
cnf[index] = config[positionByTitle[title]]
}
for index := range config {
config[index] = cnf[index]
}
}
func rawToPretty(config interface{}, parent *frontmatter) interface{} {
objects := []*frontmatter{}
arrays := []*frontmatter{}
@ -96,6 +75,27 @@ func rawToPretty(config interface{}, parent *frontmatter) interface{} {
return settings
}
func sortByTitle(config []*frontmatter) {
keys := make([]string, len(config))
positionByTitle := make(map[string]int)
for index, element := range config {
keys[index] = element.Title
positionByTitle[element.Title] = index
}
sort.Strings(keys)
cnf := make([]*frontmatter, len(config))
for index, title := range keys {
cnf[index] = config[positionByTitle[title]]
}
for index := range config {
config[index] = cnf[index]
}
}
func handleObjects(content interface{}, parent *frontmatter, name string) *frontmatter {
c := new(frontmatter)
c.Parent = parent