mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-13 20:24:00 +02:00
@@ -232,7 +232,6 @@ func (sp *SourceSpec) NewFileInfoFrom(path, filename string) (*FileInfo, error)
|
||||
}
|
||||
|
||||
func (sp *SourceSpec) NewFileInfo(fi hugofs.FileMetaInfo) (*FileInfo, error) {
|
||||
|
||||
m := fi.Meta()
|
||||
|
||||
filename := m.Filename()
|
||||
@@ -290,5 +289,4 @@ func (sp *SourceSpec) NewFileInfo(fi hugofs.FileMetaInfo) (*FileInfo, error) {
|
||||
}
|
||||
|
||||
return f, nil
|
||||
|
||||
}
|
||||
|
@@ -38,18 +38,15 @@ func TestFileInfo(t *testing.T) {
|
||||
c.Assert(f.Section(), qt.Equals, "b")
|
||||
c.Assert(f.TranslationBaseName(), qt.Equals, filepath.FromSlash("page"))
|
||||
c.Assert(f.BaseFileName(), qt.Equals, filepath.FromSlash("page"))
|
||||
|
||||
}},
|
||||
{filepath.FromSlash("/a/"), filepath.FromSlash("/a/b/c/d/page.md"), func(f *FileInfo) {
|
||||
c.Assert(f.Section(), qt.Equals, "b")
|
||||
|
||||
}},
|
||||
{filepath.FromSlash("/a/"), filepath.FromSlash("/a/b/page.en.MD"), func(f *FileInfo) {
|
||||
c.Assert(f.Section(), qt.Equals, "b")
|
||||
c.Assert(f.Path(), qt.Equals, filepath.FromSlash("b/page.en.MD"))
|
||||
c.Assert(f.TranslationBaseName(), qt.Equals, filepath.FromSlash("page"))
|
||||
c.Assert(f.BaseFileName(), qt.Equals, filepath.FromSlash("page.en"))
|
||||
|
||||
}},
|
||||
} {
|
||||
path := strings.TrimPrefix(this.filename, this.base)
|
||||
@@ -57,5 +54,4 @@ func TestFileInfo(t *testing.T) {
|
||||
c.Assert(err, qt.IsNil)
|
||||
this.assert(f)
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -102,11 +102,9 @@ func (f *Filesystem) captureFiles() error {
|
||||
})
|
||||
|
||||
return w.Walk()
|
||||
|
||||
}
|
||||
|
||||
func (f *Filesystem) shouldRead(filename string, fi hugofs.FileMetaInfo) (bool, error) {
|
||||
|
||||
ignore := f.SourceSpec.IgnoreFile(fi.Meta().Filename())
|
||||
|
||||
if fi.IsDir() {
|
||||
|
@@ -74,7 +74,6 @@ func TestUnicodeNorm(t *testing.T) {
|
||||
t.Fatalf("file %q name in NFD form should be normalized (%s)", f.BaseFileName(), path.NFC)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
func newTestConfig() *viper.Viper {
|
||||
|
@@ -74,7 +74,6 @@ func NewSourceSpec(ps *helpers.PathSpec, fs afero.Fs) *SourceSpec {
|
||||
}
|
||||
|
||||
return &SourceSpec{ignoreFilesRe: regexps, PathSpec: ps, SourceFs: fs, Languages: languages, DefaultContentLanguage: defaultLang, DisabledLanguages: disabledLangsSet}
|
||||
|
||||
}
|
||||
|
||||
// IgnoreFile returns whether a given file should be ignored.
|
||||
|
Reference in New Issue
Block a user