refactor: remove frontmatter related functions
This commit is contained in:
parent
36f145790d
commit
50f11456a2
41
lib/file.go
41
lib/file.go
@ -415,44 +415,3 @@ func isInTextExtensions(name string) bool {
|
|||||||
i := sort.SearchStrings(textExtensions, search)
|
i := sort.SearchStrings(textExtensions, search)
|
||||||
return i < len(textExtensions) && textExtensions[i] == search
|
return i < len(textExtensions) && textExtensions[i] == search
|
||||||
}
|
}
|
||||||
|
|
||||||
// hasRune checks if the file has the frontmatter rune
|
|
||||||
func hasRune(file string) bool {
|
|
||||||
return strings.HasPrefix(file, "---") ||
|
|
||||||
strings.HasPrefix(file, "+++") ||
|
|
||||||
strings.HasPrefix(file, "{")
|
|
||||||
}
|
|
||||||
|
|
||||||
func editorMode(language string) string {
|
|
||||||
switch language {
|
|
||||||
case "markdown", "asciidoc", "rst":
|
|
||||||
return "content+metadata"
|
|
||||||
}
|
|
||||||
|
|
||||||
return "content"
|
|
||||||
}
|
|
||||||
|
|
||||||
func editorLanguage(mode string) string {
|
|
||||||
mode = strings.TrimPrefix(mode, ".")
|
|
||||||
|
|
||||||
switch mode {
|
|
||||||
case "md", "markdown", "mdown", "mmark":
|
|
||||||
mode = "markdown"
|
|
||||||
case "yml":
|
|
||||||
mode = "yaml"
|
|
||||||
case "asciidoc", "adoc", "ad":
|
|
||||||
mode = "asciidoc"
|
|
||||||
case "rst":
|
|
||||||
mode = "rst"
|
|
||||||
case "html", "htm", "xml":
|
|
||||||
mode = "htmlmixed"
|
|
||||||
case "js":
|
|
||||||
mode = "javascript"
|
|
||||||
case "go":
|
|
||||||
mode = "golang"
|
|
||||||
case "":
|
|
||||||
mode = "text"
|
|
||||||
}
|
|
||||||
|
|
||||||
return mode
|
|
||||||
}
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user