Mercurial > piecrust2
comparison piecrust/sources/default.py @ 853:f070a4fc033c
core: Continue PieCrust3 refactor, simplify pages.
The asset pipeline is still the only function pipeline at this point.
* No more `QualifiedPage`, and several other pieces of code deleted.
* Data providers are simpler and more focused. For instance, the page iterator
doesn't try to support other types of items.
* Route parameters are proper known source metadata to remove the confusion
between the two.
* Make the baker and pipeline more correctly manage records and record
histories.
* Add support for record collapsing and deleting stale outputs in the asset
pipeline.
author | Ludovic Chabant <ludovic@chabant.com> |
---|---|
date | Sun, 21 May 2017 00:06:59 -0700 |
parents | 4850f8c21b6e |
children | 08e02c2a2a1a |
comparison
equal
deleted
inserted
replaced
852:4850f8c21b6e | 853:f070a4fc033c |
---|---|
17 IPreparingSource, IInteractiveSource): | 17 IPreparingSource, IInteractiveSource): |
18 SOURCE_NAME = 'default' | 18 SOURCE_NAME = 'default' |
19 | 19 |
20 def __init__(self, app, name, config): | 20 def __init__(self, app, name, config): |
21 super().__init__(app, name, config) | 21 super().__init__(app, name, config) |
22 | |
23 config.setdefault('data_type', 'page_iterator') | |
24 | |
22 self.auto_formats = app.config.get('site/auto_formats') | 25 self.auto_formats = app.config.get('site/auto_formats') |
23 self.default_auto_format = app.config.get('site/default_auto_format') | 26 self.default_auto_format = app.config.get('site/default_auto_format') |
24 self.supported_extensions = list(self.auto_formats) | 27 self.supported_extensions = list(self.auto_formats) |
25 | 28 |
26 def _createItemMetadata(self, path): | 29 def _createItemMetadata(self, path): |
31 self, parent_group, items, groups) | 34 self, parent_group, items, groups) |
32 | 35 |
33 def _doCreateItemMetadata(self, path): | 36 def _doCreateItemMetadata(self, path): |
34 slug = self._makeSlug(path) | 37 slug = self._makeSlug(path) |
35 metadata = { | 38 metadata = { |
36 'slug': slug | 39 'route_params': { |
40 'slug': slug | |
41 } | |
37 } | 42 } |
38 _, ext = os.path.splitext(path) | 43 _, ext = os.path.splitext(path) |
39 if ext: | 44 if ext: |
40 fmt = self.auto_formats.get(ext.lstrip('.')) | 45 fmt = self.auto_formats.get(ext.lstrip('.')) |
41 if fmt: | 46 if fmt: |