1.1 --- a/moinformat/input/directory.py Fri Apr 12 00:20:45 2019 +0200
1.2 +++ b/moinformat/input/directory.py Fri Apr 12 00:22:22 2019 +0200
1.3 @@ -45,15 +45,27 @@
1.4
1.5 self.level_sep = metadata.get("input_separator", sep)
1.6
1.7 + # Search recursively in nested directories for pages and files.
1.8 +
1.9 + self.nested = self.level_sep == sep
1.10 +
1.11 + # Support attachments directories.
1.12 +
1.13 + self.attachments_dir = metadata.get("attachments", "attachments")
1.14 +
1.15 def all(self):
1.16
1.17 "Return all pages in the context."
1.18
1.19 - nested = self.level_sep == sep
1.20 -
1.21 # Ignore dotfiles.
1.22
1.23 - return map(self.to_pagename, self.dir.select_files("[!.]*", nested))
1.24 + return map(self.to_pagename, self.dir.select_files("[!.]*", self.nested))
1.25 +
1.26 + def all_attachments(self):
1.27 +
1.28 + "Return all attachment filenames in the context."
1.29 +
1.30 + return self.dir.select_files("%s/*" % self.attachments_dir, self.nested)
1.31
1.32 # Page characteristics.
1.33
1.34 @@ -61,9 +73,8 @@
1.35
1.36 "Return the subpage filenames of 'pagename'."
1.37
1.38 - nested = self.level_sep == sep
1.39 pattern = self.to_filename("%s/*" % pagename)
1.40 - return self.dir.select_files(pattern, nested)
1.41 + return self.dir.select_files(pattern, self.nested)
1.42
1.43 def subpages(self, pagename):
1.44