2017-06-17 10:51:32 -04:00
|
|
|
package gojekyll
|
2017-06-16 15:14:56 -04:00
|
|
|
|
|
|
|
import (
|
|
|
|
"path/filepath"
|
|
|
|
"strings"
|
2017-06-16 19:17:22 -04:00
|
|
|
|
2017-06-16 20:11:52 -04:00
|
|
|
"github.com/osteele/gojekyll/helpers"
|
2017-06-16 15:14:56 -04:00
|
|
|
)
|
|
|
|
|
|
|
|
// IsMarkdown returns a boolean indicating whether the file is a Markdown file, according to the current project.
|
2017-06-16 20:06:55 -04:00
|
|
|
func (s *Site) IsMarkdown(name string) bool {
|
|
|
|
ext := filepath.Ext(name)
|
2017-06-16 16:44:09 -04:00
|
|
|
return s.MarkdownExtensions()[strings.TrimLeft(ext, ".")]
|
2017-06-16 15:14:56 -04: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-16 20:11:52 -04:00
|
|
|
return helpers.StringArrayToMap(extns)
|
2017-06-16 15:14:56 -04:00
|
|
|
}
|