Logger loggers.Logger
// One or both of these may be pre-set.
- Info FileMetaInfo // The start info.
- DirEntries []FileMetaInfo // The start info's dir entries.
+ Info FileMetaInfo // The start info.
+ DirEntries []FileMetaInfo // The start info's dir entries.
+ IgnoreFile func(filename string) bool // Optional
// Will be called in order.
HookPre WalkHook // Optional.
}
+ if w.cfg.IgnoreFile != nil {
+ n := 0
+ for _, fi := range dirEntries {
+ if !w.cfg.IgnoreFile(fi.Meta().Filename) {
+ dirEntries[n] = fi
+ n++
+ }
+ }
+ dirEntries = dirEntries[:n]
+ }
+
if w.cfg.HookPre != nil {
var err error
dirEntries, err = w.cfg.HookPre(info, path, dirEntries)
h.data = make(map[string]any)
w := hugofs.NewWalkway(
hugofs.WalkwayConfig{
- Fs: h.PathSpec.BaseFs.Data.Fs,
+ Fs: h.PathSpec.BaseFs.Data.Fs,
+ IgnoreFile: h.SourceSpec.IgnoreFile,
WalkFn: func(path string, fi hugofs.FileMetaInfo) error {
if fi.IsDir() {
return nil
NumFmt: -98,765.43
`)
}
+
+// Issue 11993.
+func TestI18nDotFile(t *testing.T) {
+ files := `
+-- hugo.toml --{}
+baseURL = "https://example.com"
+-- i18n/.keep --
+-- data/.keep --
+`
+ Test(t, files)
+}
func (c *pagesCollector) collectDirDir(path string, root hugofs.FileMetaInfo, inFilter func(fim hugofs.FileMetaInfo) bool) error {
filter := func(fim hugofs.FileMetaInfo) bool {
- if c.sp.IgnoreFile(fim.Meta().Filename) {
- return false
- }
if inFilter != nil {
return inFilter(fim)
}
w := hugofs.NewWalkway(
hugofs.WalkwayConfig{
- Logger: c.logger,
- Root: path,
- Info: root,
- Fs: c.fs,
- HookPre: preHook,
- HookPost: postHook,
- WalkFn: wfn,
+ Logger: c.logger,
+ Root: path,
+ Info: root,
+ Fs: c.fs,
+ IgnoreFile: c.h.SourceSpec.IgnoreFile,
+ HookPre: preHook,
+ HookPost: postHook,
+ WalkFn: wfn,
})
return w.Walk()
Logger: c.logger,
Info: dir,
DirEntries: readdir,
+ IgnoreFile: c.h.SourceSpec.IgnoreFile,
WalkFn: walk,
})
w := hugofs.NewWalkway(
hugofs.WalkwayConfig{
- Fs: dst.BaseFs.I18n.Fs,
+ Fs: dst.BaseFs.I18n.Fs,
+ IgnoreFile: dst.SourceSpec.IgnoreFile,
WalkFn: func(path string, info hugofs.FileMetaInfo) error {
if info.IsDir() {
return nil