mirror of
https://github.com/gohugoio/hugo.git
synced 2024-11-21 20:46:30 -05:00
parent
058f230a1b
commit
46575baa02
4 changed files with 20 additions and 3 deletions
|
@ -47,3 +47,20 @@ d: {{ site.Data.d.v1 }}|
|
||||||
b.AssertFileContent("public/index.html", "a: a_v1|\nb: b_v1|\ncd: c_d_v1|\nd: d_v1_theme|")
|
b.AssertFileContent("public/index.html", "a: a_v1|\nb: b_v1|\ncd: c_d_v1|\nd: d_v1_theme|")
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestDataMixedCaseFolders(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
|
||||||
|
files := `
|
||||||
|
-- hugo.toml --
|
||||||
|
baseURL = "https://example.com"
|
||||||
|
-- data/MyFolder/MyData.toml --
|
||||||
|
v1 = "my_v1"
|
||||||
|
-- layouts/index.html --
|
||||||
|
{{ site.Data }}
|
||||||
|
v1: {{ site.Data.MyFolder.MyData.v1 }}|
|
||||||
|
`
|
||||||
|
b := Test(t, files)
|
||||||
|
|
||||||
|
b.AssertFileContent("public/index.html", "v1: my_v1|")
|
||||||
|
}
|
||||||
|
|
|
@ -502,7 +502,7 @@ func (h *HugoSites) handleDataFile(r *source.File) error {
|
||||||
|
|
||||||
// Crawl in data tree to insert data
|
// Crawl in data tree to insert data
|
||||||
current = h.data
|
current = h.data
|
||||||
dataPath := r.FileInfo().Meta().PathInfo.Dir()[1:]
|
dataPath := r.FileInfo().Meta().PathInfo.Unmormalized().Dir()[1:]
|
||||||
keyParts := strings.Split(dataPath, "/")
|
keyParts := strings.Split(dataPath, "/")
|
||||||
|
|
||||||
for _, key := range keyParts {
|
for _, key := range keyParts {
|
||||||
|
|
|
@ -1713,7 +1713,7 @@ Single: {{ .Title}}|{{ .RelPermalink }}|{{ .Path }}|
|
||||||
b := Test(t, files)
|
b := Test(t, files)
|
||||||
b.AssertFileContent("public/sect/p1/index.html", "Single: Page1|/sect/p1/|/sect/p1")
|
b.AssertFileContent("public/sect/p1/index.html", "Single: Page1|/sect/p1/|/sect/p1")
|
||||||
b.AssertFileContent("public/sect/PaGe2/index.html", "Single: Page2|/sect/PaGe2/|/sect/p2")
|
b.AssertFileContent("public/sect/PaGe2/index.html", "Single: Page2|/sect/PaGe2/|/sect/p2")
|
||||||
b.AssertFileContent("public/sect2/page3/index.html", "Single: Page3|/sect2/page3/|/sect2/page3|")
|
b.AssertFileContent("public/sect2/PaGe3/index.html", "Single: Page3|/sect2/PaGe3/|/sect2/page3|")
|
||||||
b.AssertFileContent("public/sect3/Pag.E4/index.html", "Single: Pag.E4|/sect3/Pag.E4/|/sect3/p4|")
|
b.AssertFileContent("public/sect3/Pag.E4/index.html", "Single: Pag.E4|/sect3/Pag.E4/|/sect3/p4|")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -130,7 +130,7 @@ func (fi *File) pathToDir(s string) string {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (fi *File) p() *paths.Path {
|
func (fi *File) p() *paths.Path {
|
||||||
return fi.fim.Meta().PathInfo
|
return fi.fim.Meta().PathInfo.Unmormalized()
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewFileInfoFrom(path, filename string) *File {
|
func NewFileInfoFrom(path, filename string) *File {
|
||||||
|
|
Loading…
Reference in a new issue