Mercurial > piecrust2
annotate piecrust/plugins/builtin.py @ 117:6827dcc9d3fb
Changes to the asset processing pipeline:
* Add semi-functional RequireJS processor.
* Processors now match on the relative path.
* Support for processors that add more processors of their own.
* A couple of related fixes.
author | Ludovic Chabant <ludovic@chabant.com> |
---|---|
date | Tue, 28 Oct 2014 08:20:38 -0700 |
parents | 69d5eecfa449 |
children | f49fcf9448df |
rev | line source |
---|---|
60
6e60e0fef2be
Add `import` command, Jekyll importer.
Ludovic Chabant <ludovic@chabant.com>
parents:
34
diff
changeset
|
1 from piecrust.commands.base import HelpCommand |
3
f485ba500df3
Gigantic change to basically make PieCrust 2 vaguely functional.
Ludovic Chabant <ludovic@chabant.com>
parents:
1
diff
changeset
|
2 from piecrust.commands.builtin.baking import (BakeCommand, ShowRecordCommand) |
f485ba500df3
Gigantic change to basically make PieCrust 2 vaguely functional.
Ludovic Chabant <ludovic@chabant.com>
parents:
1
diff
changeset
|
3 from piecrust.commands.builtin.info import (RootCommand, ShowConfigCommand, |
f485ba500df3
Gigantic change to basically make PieCrust 2 vaguely functional.
Ludovic Chabant <ludovic@chabant.com>
parents:
1
diff
changeset
|
4 FindCommand, ShowRoutesCommand, ShowPathsCommand) |
100
69d5eecfa449
Better `prepare` command, with templates and help topics.
Ludovic Chabant <ludovic@chabant.com>
parents:
76
diff
changeset
|
5 from piecrust.commands.builtin.scaffolding import (PrepareCommand, |
69d5eecfa449
Better `prepare` command, with templates and help topics.
Ludovic Chabant <ludovic@chabant.com>
parents:
76
diff
changeset
|
6 DefaultPrepareTemplatesCommandExtension, |
69d5eecfa449
Better `prepare` command, with templates and help topics.
Ludovic Chabant <ludovic@chabant.com>
parents:
76
diff
changeset
|
7 DefaultPrepareTemplatesHelpTopic) |
3
f485ba500df3
Gigantic change to basically make PieCrust 2 vaguely functional.
Ludovic Chabant <ludovic@chabant.com>
parents:
1
diff
changeset
|
8 from piecrust.commands.builtin.serving import (ServeCommand) |
f485ba500df3
Gigantic change to basically make PieCrust 2 vaguely functional.
Ludovic Chabant <ludovic@chabant.com>
parents:
1
diff
changeset
|
9 from piecrust.commands.builtin.util import (InitCommand, PurgeCommand, |
100
69d5eecfa449
Better `prepare` command, with templates and help topics.
Ludovic Chabant <ludovic@chabant.com>
parents:
76
diff
changeset
|
10 ImportCommand) |
3
f485ba500df3
Gigantic change to basically make PieCrust 2 vaguely functional.
Ludovic Chabant <ludovic@chabant.com>
parents:
1
diff
changeset
|
11 from piecrust.data.provider import (IteratorDataProvider, BlogDataProvider) |
f485ba500df3
Gigantic change to basically make PieCrust 2 vaguely functional.
Ludovic Chabant <ludovic@chabant.com>
parents:
1
diff
changeset
|
12 from piecrust.formatting.markdownformatter import MarkdownFormatter |
76
fdb08d986384
Add SmartyPants formatting.
Ludovic Chabant <ludovic@chabant.com>
parents:
62
diff
changeset
|
13 from piecrust.formatting.smartypantsformatter import SmartyPantsFormatter |
60
6e60e0fef2be
Add `import` command, Jekyll importer.
Ludovic Chabant <ludovic@chabant.com>
parents:
34
diff
changeset
|
14 from piecrust.importing.jekyll import JekyllImporter |
62
52e4d9a1f917
Simple importer for PieCrust 1 websites.
Ludovic Chabant <ludovic@chabant.com>
parents:
60
diff
changeset
|
15 from piecrust.importing.piecrust import PieCrust1Importer |
1
aaa8fb7c8918
Re-arranged modules to reduce dependencies to builtin stuff.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
16 from piecrust.plugins.base import PieCrustPlugin |
3
f485ba500df3
Gigantic change to basically make PieCrust 2 vaguely functional.
Ludovic Chabant <ludovic@chabant.com>
parents:
1
diff
changeset
|
17 from piecrust.processing.base import CopyFileProcessor |
f485ba500df3
Gigantic change to basically make PieCrust 2 vaguely functional.
Ludovic Chabant <ludovic@chabant.com>
parents:
1
diff
changeset
|
18 from piecrust.processing.less import LessProcessor |
117
6827dcc9d3fb
Changes to the asset processing pipeline:
Ludovic Chabant <ludovic@chabant.com>
parents:
100
diff
changeset
|
19 from piecrust.processing.requirejs import RequireJSProcessor |
34
bdb103c57168
Add `sitemap` processor.
Ludovic Chabant <ludovic@chabant.com>
parents:
3
diff
changeset
|
20 from piecrust.processing.sitemap import SitemapProcessor |
3
f485ba500df3
Gigantic change to basically make PieCrust 2 vaguely functional.
Ludovic Chabant <ludovic@chabant.com>
parents:
1
diff
changeset
|
21 from piecrust.sources.base import DefaultPageSource |
f485ba500df3
Gigantic change to basically make PieCrust 2 vaguely functional.
Ludovic Chabant <ludovic@chabant.com>
parents:
1
diff
changeset
|
22 from piecrust.sources.posts import (FlatPostsSource, ShallowPostsSource, |
f485ba500df3
Gigantic change to basically make PieCrust 2 vaguely functional.
Ludovic Chabant <ludovic@chabant.com>
parents:
1
diff
changeset
|
23 HierarchyPostsSource) |
f485ba500df3
Gigantic change to basically make PieCrust 2 vaguely functional.
Ludovic Chabant <ludovic@chabant.com>
parents:
1
diff
changeset
|
24 from piecrust.templating.jinjaengine import JinjaTemplateEngine |
1
aaa8fb7c8918
Re-arranged modules to reduce dependencies to builtin stuff.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
25 |
aaa8fb7c8918
Re-arranged modules to reduce dependencies to builtin stuff.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
26 |
aaa8fb7c8918
Re-arranged modules to reduce dependencies to builtin stuff.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
27 class BuiltInPlugin(PieCrustPlugin): |
aaa8fb7c8918
Re-arranged modules to reduce dependencies to builtin stuff.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
28 def __init__(self): |
aaa8fb7c8918
Re-arranged modules to reduce dependencies to builtin stuff.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
29 super(BuiltInPlugin, self).__init__() |
aaa8fb7c8918
Re-arranged modules to reduce dependencies to builtin stuff.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
30 self.name = '__builtin__' |
aaa8fb7c8918
Re-arranged modules to reduce dependencies to builtin stuff.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
31 |
aaa8fb7c8918
Re-arranged modules to reduce dependencies to builtin stuff.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
32 def getCommands(self): |
aaa8fb7c8918
Re-arranged modules to reduce dependencies to builtin stuff.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
33 return [ |
aaa8fb7c8918
Re-arranged modules to reduce dependencies to builtin stuff.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
34 InitCommand(), |
60
6e60e0fef2be
Add `import` command, Jekyll importer.
Ludovic Chabant <ludovic@chabant.com>
parents:
34
diff
changeset
|
35 ImportCommand(), |
6e60e0fef2be
Add `import` command, Jekyll importer.
Ludovic Chabant <ludovic@chabant.com>
parents:
34
diff
changeset
|
36 HelpCommand(), |
3
f485ba500df3
Gigantic change to basically make PieCrust 2 vaguely functional.
Ludovic Chabant <ludovic@chabant.com>
parents:
1
diff
changeset
|
37 RootCommand(), |
f485ba500df3
Gigantic change to basically make PieCrust 2 vaguely functional.
Ludovic Chabant <ludovic@chabant.com>
parents:
1
diff
changeset
|
38 PurgeCommand(), |
f485ba500df3
Gigantic change to basically make PieCrust 2 vaguely functional.
Ludovic Chabant <ludovic@chabant.com>
parents:
1
diff
changeset
|
39 ShowConfigCommand(), |
f485ba500df3
Gigantic change to basically make PieCrust 2 vaguely functional.
Ludovic Chabant <ludovic@chabant.com>
parents:
1
diff
changeset
|
40 FindCommand(), |
f485ba500df3
Gigantic change to basically make PieCrust 2 vaguely functional.
Ludovic Chabant <ludovic@chabant.com>
parents:
1
diff
changeset
|
41 PrepareCommand(), |
f485ba500df3
Gigantic change to basically make PieCrust 2 vaguely functional.
Ludovic Chabant <ludovic@chabant.com>
parents:
1
diff
changeset
|
42 ShowRoutesCommand(), |
f485ba500df3
Gigantic change to basically make PieCrust 2 vaguely functional.
Ludovic Chabant <ludovic@chabant.com>
parents:
1
diff
changeset
|
43 ShowPathsCommand(), |
f485ba500df3
Gigantic change to basically make PieCrust 2 vaguely functional.
Ludovic Chabant <ludovic@chabant.com>
parents:
1
diff
changeset
|
44 BakeCommand(), |
f485ba500df3
Gigantic change to basically make PieCrust 2 vaguely functional.
Ludovic Chabant <ludovic@chabant.com>
parents:
1
diff
changeset
|
45 ShowRecordCommand(), |
f485ba500df3
Gigantic change to basically make PieCrust 2 vaguely functional.
Ludovic Chabant <ludovic@chabant.com>
parents:
1
diff
changeset
|
46 ServeCommand()] |
f485ba500df3
Gigantic change to basically make PieCrust 2 vaguely functional.
Ludovic Chabant <ludovic@chabant.com>
parents:
1
diff
changeset
|
47 |
f485ba500df3
Gigantic change to basically make PieCrust 2 vaguely functional.
Ludovic Chabant <ludovic@chabant.com>
parents:
1
diff
changeset
|
48 def getCommandExtensions(self): |
100
69d5eecfa449
Better `prepare` command, with templates and help topics.
Ludovic Chabant <ludovic@chabant.com>
parents:
76
diff
changeset
|
49 return [ |
69d5eecfa449
Better `prepare` command, with templates and help topics.
Ludovic Chabant <ludovic@chabant.com>
parents:
76
diff
changeset
|
50 DefaultPrepareTemplatesCommandExtension(), |
69d5eecfa449
Better `prepare` command, with templates and help topics.
Ludovic Chabant <ludovic@chabant.com>
parents:
76
diff
changeset
|
51 DefaultPrepareTemplatesHelpTopic()] |
1
aaa8fb7c8918
Re-arranged modules to reduce dependencies to builtin stuff.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
52 |
3
f485ba500df3
Gigantic change to basically make PieCrust 2 vaguely functional.
Ludovic Chabant <ludovic@chabant.com>
parents:
1
diff
changeset
|
53 def getSources(self): |
f485ba500df3
Gigantic change to basically make PieCrust 2 vaguely functional.
Ludovic Chabant <ludovic@chabant.com>
parents:
1
diff
changeset
|
54 return [ |
f485ba500df3
Gigantic change to basically make PieCrust 2 vaguely functional.
Ludovic Chabant <ludovic@chabant.com>
parents:
1
diff
changeset
|
55 DefaultPageSource, |
f485ba500df3
Gigantic change to basically make PieCrust 2 vaguely functional.
Ludovic Chabant <ludovic@chabant.com>
parents:
1
diff
changeset
|
56 FlatPostsSource, |
f485ba500df3
Gigantic change to basically make PieCrust 2 vaguely functional.
Ludovic Chabant <ludovic@chabant.com>
parents:
1
diff
changeset
|
57 ShallowPostsSource, |
f485ba500df3
Gigantic change to basically make PieCrust 2 vaguely functional.
Ludovic Chabant <ludovic@chabant.com>
parents:
1
diff
changeset
|
58 HierarchyPostsSource] |
f485ba500df3
Gigantic change to basically make PieCrust 2 vaguely functional.
Ludovic Chabant <ludovic@chabant.com>
parents:
1
diff
changeset
|
59 |
f485ba500df3
Gigantic change to basically make PieCrust 2 vaguely functional.
Ludovic Chabant <ludovic@chabant.com>
parents:
1
diff
changeset
|
60 def getDataProviders(self): |
f485ba500df3
Gigantic change to basically make PieCrust 2 vaguely functional.
Ludovic Chabant <ludovic@chabant.com>
parents:
1
diff
changeset
|
61 return [ |
f485ba500df3
Gigantic change to basically make PieCrust 2 vaguely functional.
Ludovic Chabant <ludovic@chabant.com>
parents:
1
diff
changeset
|
62 IteratorDataProvider, |
f485ba500df3
Gigantic change to basically make PieCrust 2 vaguely functional.
Ludovic Chabant <ludovic@chabant.com>
parents:
1
diff
changeset
|
63 BlogDataProvider] |
f485ba500df3
Gigantic change to basically make PieCrust 2 vaguely functional.
Ludovic Chabant <ludovic@chabant.com>
parents:
1
diff
changeset
|
64 |
f485ba500df3
Gigantic change to basically make PieCrust 2 vaguely functional.
Ludovic Chabant <ludovic@chabant.com>
parents:
1
diff
changeset
|
65 def getTemplateEngines(self): |
f485ba500df3
Gigantic change to basically make PieCrust 2 vaguely functional.
Ludovic Chabant <ludovic@chabant.com>
parents:
1
diff
changeset
|
66 return [ |
f485ba500df3
Gigantic change to basically make PieCrust 2 vaguely functional.
Ludovic Chabant <ludovic@chabant.com>
parents:
1
diff
changeset
|
67 JinjaTemplateEngine()] |
f485ba500df3
Gigantic change to basically make PieCrust 2 vaguely functional.
Ludovic Chabant <ludovic@chabant.com>
parents:
1
diff
changeset
|
68 |
f485ba500df3
Gigantic change to basically make PieCrust 2 vaguely functional.
Ludovic Chabant <ludovic@chabant.com>
parents:
1
diff
changeset
|
69 def getFormatters(self): |
f485ba500df3
Gigantic change to basically make PieCrust 2 vaguely functional.
Ludovic Chabant <ludovic@chabant.com>
parents:
1
diff
changeset
|
70 return [ |
76
fdb08d986384
Add SmartyPants formatting.
Ludovic Chabant <ludovic@chabant.com>
parents:
62
diff
changeset
|
71 MarkdownFormatter(), |
fdb08d986384
Add SmartyPants formatting.
Ludovic Chabant <ludovic@chabant.com>
parents:
62
diff
changeset
|
72 SmartyPantsFormatter()] |
3
f485ba500df3
Gigantic change to basically make PieCrust 2 vaguely functional.
Ludovic Chabant <ludovic@chabant.com>
parents:
1
diff
changeset
|
73 |
f485ba500df3
Gigantic change to basically make PieCrust 2 vaguely functional.
Ludovic Chabant <ludovic@chabant.com>
parents:
1
diff
changeset
|
74 def getProcessors(self): |
f485ba500df3
Gigantic change to basically make PieCrust 2 vaguely functional.
Ludovic Chabant <ludovic@chabant.com>
parents:
1
diff
changeset
|
75 return [ |
f485ba500df3
Gigantic change to basically make PieCrust 2 vaguely functional.
Ludovic Chabant <ludovic@chabant.com>
parents:
1
diff
changeset
|
76 CopyFileProcessor(), |
34
bdb103c57168
Add `sitemap` processor.
Ludovic Chabant <ludovic@chabant.com>
parents:
3
diff
changeset
|
77 LessProcessor(), |
117
6827dcc9d3fb
Changes to the asset processing pipeline:
Ludovic Chabant <ludovic@chabant.com>
parents:
100
diff
changeset
|
78 RequireJSProcessor(), |
34
bdb103c57168
Add `sitemap` processor.
Ludovic Chabant <ludovic@chabant.com>
parents:
3
diff
changeset
|
79 SitemapProcessor()] |
3
f485ba500df3
Gigantic change to basically make PieCrust 2 vaguely functional.
Ludovic Chabant <ludovic@chabant.com>
parents:
1
diff
changeset
|
80 |
60
6e60e0fef2be
Add `import` command, Jekyll importer.
Ludovic Chabant <ludovic@chabant.com>
parents:
34
diff
changeset
|
81 def getImporters(self): |
6e60e0fef2be
Add `import` command, Jekyll importer.
Ludovic Chabant <ludovic@chabant.com>
parents:
34
diff
changeset
|
82 return [ |
62
52e4d9a1f917
Simple importer for PieCrust 1 websites.
Ludovic Chabant <ludovic@chabant.com>
parents:
60
diff
changeset
|
83 JekyllImporter(), |
52e4d9a1f917
Simple importer for PieCrust 1 websites.
Ludovic Chabant <ludovic@chabant.com>
parents:
60
diff
changeset
|
84 PieCrust1Importer()] |
60
6e60e0fef2be
Add `import` command, Jekyll importer.
Ludovic Chabant <ludovic@chabant.com>
parents:
34
diff
changeset
|
85 |