2017-06-16 21:14:56 +02:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"path/filepath"
|
|
|
|
"strings"
|
2017-06-17 01:17:22 +02:00
|
|
|
|
|
|
|
. "github.com/osteele/gojekyll/helpers"
|
2017-06-16 21:14:56 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
// IsMarkdown returns a boolean indicating whether the file is a Markdown file, according to the current project.
|
|
|
|
func (s *Site) IsMarkdown(path string) bool {
|
|
|
|
ext := filepath.Ext(path)
|
2017-06-16 22:44:09 +02:00
|
|
|
return s.MarkdownExtensions()[strings.TrimLeft(ext, ".")]
|
2017-06-16 21:14:56 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
// MarkdownExtensions returns a set of markdown extension, without the final dots.
|
|
|
|
func (s *Site) MarkdownExtensions() map[string]bool {
|
|
|
|
extns := strings.SplitN(s.config.MarkdownExt, `,`, -1)
|
2017-06-17 01:17:22 +02:00
|
|
|
return StringArrayToMap(extns)
|
2017-06-16 21:14:56 +02:00
|
|
|
}
|