diff piecrust/sources/posts.py @ 989:8adc27285d93

bake: Big pass on bake performance. - Reduce the amount of data passed between processes. - Make inter-process data simple objects to make it easier to test with alternatives to pickle. - Make sources have the basic requirement to be able to find a content item from an item spec (path). - Make Hoedown the default Markdown formatter.
author Ludovic Chabant <ludovic@chabant.com>
date Sun, 19 Nov 2017 14:29:17 -0800
parents d57fff79acc1
children 4cc020ff2537
line wrap: on
line diff
--- a/piecrust/sources/posts.py	Fri Nov 03 23:14:56 2017 -0700
+++ b/piecrust/sources/posts.py	Sun Nov 19 14:29:17 2017 -0800
@@ -50,10 +50,11 @@
 
         return FSContentSource.getRelatedContents(self, item, relationship)
 
-    def findGroup(self, spec):
-        return None
+    def findContentFromSpec(self, spec):
+        metadata = self._parseMetadataFromPath(spec)
+        return ContentItem(spec, metadata)
 
-    def findContent(self, route_params):
+    def findContentFromRoute(self, route_params):
         year = route_params.get('year')
         month = route_params.get('month')
         day = route_params.get('day')
@@ -111,10 +112,6 @@
         metadata = self._parseMetadataFromPath(path)
         return ContentItem(path, metadata)
 
-    def findContentFromPath(self, path):
-        metadata = self._parseMetadataFromPath(path)
-        return ContentItem(path, metadata)
-
     def _parseMetadataFromPath(self, path):
         regex_repl = {
             'year': '(?P<year>\d{4})',