Mercurial > piecrust2
comparison 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 |
comparison
equal
deleted
inserted
replaced
988:f83ae0a5d793 | 989:8adc27285d93 |
---|---|
48 return SimpleAssetsSubDirMixin._getRelatedAssetsContents( | 48 return SimpleAssetsSubDirMixin._getRelatedAssetsContents( |
49 self, item) | 49 self, item) |
50 | 50 |
51 return FSContentSource.getRelatedContents(self, item, relationship) | 51 return FSContentSource.getRelatedContents(self, item, relationship) |
52 | 52 |
53 def findGroup(self, spec): | 53 def findContentFromSpec(self, spec): |
54 return None | 54 metadata = self._parseMetadataFromPath(spec) |
55 | 55 return ContentItem(spec, metadata) |
56 def findContent(self, route_params): | 56 |
57 def findContentFromRoute(self, route_params): | |
57 year = route_params.get('year') | 58 year = route_params.get('year') |
58 month = route_params.get('month') | 59 month = route_params.get('month') |
59 day = route_params.get('day') | 60 day = route_params.get('day') |
60 slug = route_params.get('slug') | 61 slug = route_params.get('slug') |
61 | 62 |
106 return None | 107 return None |
107 path = possible_paths[0] | 108 path = possible_paths[0] |
108 elif not os.path.isfile(path): | 109 elif not os.path.isfile(path): |
109 return None | 110 return None |
110 | 111 |
111 metadata = self._parseMetadataFromPath(path) | |
112 return ContentItem(path, metadata) | |
113 | |
114 def findContentFromPath(self, path): | |
115 metadata = self._parseMetadataFromPath(path) | 112 metadata = self._parseMetadataFromPath(path) |
116 return ContentItem(path, metadata) | 113 return ContentItem(path, metadata) |
117 | 114 |
118 def _parseMetadataFromPath(self, path): | 115 def _parseMetadataFromPath(self, path): |
119 regex_repl = { | 116 regex_repl = { |