parent
992f1c2c01
commit
686a909e23
File diff suppressed because one or more lines are too long
|
@ -17,7 +17,7 @@ $(document).on('ready pjax:success', function() {
|
||||||
$(this).data("previewing", "false");
|
$(this).data("previewing", "false");
|
||||||
|
|
||||||
notification({
|
notification({
|
||||||
text: "You've gone into editing mode.",
|
text: "Think, relax and do the better you can!",
|
||||||
type: 'information',
|
type: 'information',
|
||||||
timeout: 2000
|
timeout: 2000
|
||||||
});
|
});
|
||||||
|
@ -31,7 +31,7 @@ $(document).on('ready pjax:success', function() {
|
||||||
$(this).data("previewing", "true");
|
$(this).data("previewing", "true");
|
||||||
|
|
||||||
notification({
|
notification({
|
||||||
text: "You've gone into preview mode.",
|
text: "This is how your post looks like.",
|
||||||
type: 'information',
|
type: 'information',
|
||||||
timeout: 2000
|
timeout: 2000
|
||||||
});
|
});
|
||||||
|
|
|
@ -35,27 +35,6 @@ type frontmatter struct {
|
||||||
Parent *frontmatter
|
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{} {
|
func rawToPretty(config interface{}, parent *frontmatter) interface{} {
|
||||||
objects := []*frontmatter{}
|
objects := []*frontmatter{}
|
||||||
arrays := []*frontmatter{}
|
arrays := []*frontmatter{}
|
||||||
|
@ -96,6 +75,27 @@ func rawToPretty(config interface{}, parent *frontmatter) interface{} {
|
||||||
return settings
|
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 {
|
func handleObjects(content interface{}, parent *frontmatter, name string) *frontmatter {
|
||||||
c := new(frontmatter)
|
c := new(frontmatter)
|
||||||
c.Parent = parent
|
c.Parent = parent
|
||||||
|
|
Loading…
Reference in New Issue