diff piecrust/processing/base.py @ 55:45828c4167ad

Processors can match on other things than just the extension.
author Ludovic Chabant <ludovic@chabant.com>
date Mon, 25 Aug 2014 21:40:25 -0700
parents 2f717f961996
children 6827dcc9d3fb
line wrap: on
line diff
--- a/piecrust/processing/base.py	Mon Aug 25 08:46:11 2014 -0700
+++ b/piecrust/processing/base.py	Mon Aug 25 21:40:25 2014 -0700
@@ -36,7 +36,7 @@
     def onPipelineEnd(self, pipeline):
         pass
 
-    def supportsExtension(self, ext):
+    def matches(self, filename):
         return False
 
     def getDependencies(self, path):
@@ -56,7 +56,7 @@
         super(CopyFileProcessor, self).__init__()
         self.priority = PRIORITY_LAST
 
-    def supportsExtension(self, ext):
+    def matches(self, filename):
         return True
 
     def getOutputFilenames(self, filename):
@@ -74,8 +74,11 @@
         super(SimpleFileProcessor, self).__init__()
         self.extensions = extensions or {}
 
-    def supportsExtension(self, ext):
-        return ext.lstrip('.') in self.extensions
+    def matches(self, filename):
+        for ext in self.extensions:
+            if filename.endswith('.' + ext):
+                return True
+        return False
 
     def getOutputFilenames(self, filename):
         basename, ext = os.path.splitext(filename)