mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-31 22:41:53 +02:00
hugolib: Read default output formats from site config
This commit is contained in:
@@ -56,11 +56,11 @@ type TemplateLookupDescriptor struct {
|
||||
ContainsAny func(filename string, subslices [][]byte) (bool, error)
|
||||
}
|
||||
|
||||
func CreateTemplateID(d TemplateLookupDescriptor) (TemplateNames, error) {
|
||||
func CreateTemplateNames(d TemplateLookupDescriptor) (TemplateNames, error) {
|
||||
|
||||
var id TemplateNames
|
||||
|
||||
name := filepath.FromSlash(d.RelPath)
|
||||
name := filepath.ToSlash(d.RelPath)
|
||||
|
||||
if d.Prefix != "" {
|
||||
name = strings.Trim(d.Prefix, "/") + "/" + name
|
||||
|
@@ -124,6 +124,8 @@ func TestLayoutBase(t *testing.T) {
|
||||
} {
|
||||
t.Run(this.name, func(t *testing.T) {
|
||||
|
||||
this.basePathMatchStrings = filepath.FromSlash(this.basePathMatchStrings)
|
||||
|
||||
fileExists := func(filename string) (bool, error) {
|
||||
stringsToMatch := strings.Split(this.basePathMatchStrings, "|")
|
||||
for _, s := range stringsToMatch {
|
||||
@@ -148,7 +150,7 @@ func TestLayoutBase(t *testing.T) {
|
||||
this.expect.MasterFilename = filepath.FromSlash(this.expect.MasterFilename)
|
||||
this.expect.OverlayFilename = filepath.FromSlash(this.expect.OverlayFilename)
|
||||
|
||||
id, err := CreateTemplateID(this.d)
|
||||
id, err := CreateTemplateNames(this.d)
|
||||
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, this.expect, id, this.name)
|
||||
|
Reference in New Issue
Block a user