changeset 27:105f24f490cb

Various fixes for the default page source: * Use forward slashes in ref paths * `auto_format` extensions should be stripped * Don't ignore pages with arbitrary extensions
author Ludovic Chabant <ludovic@chabant.com>
date Tue, 19 Aug 2014 11:50:21 -0700
parents 3701daa97927
children 19f3ac27c3d5
files piecrust/sources/base.py
diffstat 1 files changed, 6 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/piecrust/sources/base.py	Tue Aug 19 11:22:29 2014 -0700
+++ b/piecrust/sources/base.py	Tue Aug 19 11:50:21 2014 -0700
@@ -306,6 +306,9 @@
             dirnames[:] = list(filter(self._filterPageDirname, dirnames))
             for f in filter(self._filterPageFilename, filenames):
                 slug, ext = os.path.splitext(os.path.join(rel_dirpath, f))
+                slug = slug.replace('\\', '/')
+                if ext not in self.supported_extensions:
+                    slug += ext
                 if slug.startswith('./') or slug.startswith('.\\'):
                     slug = slug[2:]
                 if slug == '_index':
@@ -353,10 +356,9 @@
 
     def _filterPageFilename(self, f):
         name, ext = os.path.splitext(f)
-        return (f[0] != '.' and
-                f[-1] != '~' and
-                ext.lstrip('.') in self.supported_extensions and
-                f not in ['Thumbs.db'])
+        return (f[0] != '.' and   # .DS_store and other crap
+                f[-1] != '~' and  # Vim temp files and what-not
+                f not in ['Thumbs.db']) # Windows bullshit
 
 
 class DefaultPageSource(SimplePageSource, IPreparingSource,