Skip to content

Commit c65be6e

Browse files
committedJul 4, 2015
Add CompilerExtension class (cc @felixfontein)
Signed-off-by: Chris Warrick <kwpolska@gmail.com>
1 parent d3fd670 commit c65be6e

16 files changed

+68
-2
lines changed
 

‎nikola/nikola.py

+2
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@
6060
Command,
6161
LateTask,
6262
PageCompiler,
63+
CompilerExtension,
6364
RestExtension,
6465
MarkdownExtension,
6566
Task,
@@ -668,6 +669,7 @@ def __init__(self, **config):
668669
"TemplateSystem": TemplateSystem,
669670
"PageCompiler": PageCompiler,
670671
"TaskMultiplier": TaskMultiplier,
672+
"CompilerExtension": CompilerExtension,
671673
"RestExtension": RestExtension,
672674
"MarkdownExtension": MarkdownExtension,
Has conversations. Original line has conversations.
673675
"SignalHandler": SignalHandler,

‎nikola/plugin_categories.py

+24-2
Original file line numberDiff line numberDiff line change
@@ -284,12 +284,34 @@ def split_metadata(self, data):
284284
return split_result[0], split_result[-1]
285285

286286

287-
class RestExtension(BasePlugin):
287+
class CompilerExtension(BasePlugin):
288+
289+
"""An extension for a Nikola compiler.
290+
291+
If you intend to implement those in your own compiler, you can:
292+
(a) create a new plugin class for them; or
293+
(b) use this class and filter them yourself.
294+
If you choose (b), you should the compiler name to the .plugin
295+
file in the Nikola/Compiler section and filter all plugins of
296+
this category, getting the compiler name with:
297+
p.details.get('Nikola', 'Compiler')
298+
Note that not all compiler plugins have this option and you might
299+
need to catch configparser.NoOptionError exceptions.
300+
"""
301+
302+
name = "dummy_compiler_extension"
303+
compiler_name = "dummy_compiler"
304+
305+
306+
307+
class RestExtension(CompilerExtension):
288308
name = "dummy_rest_extension"
309+
compiler_name = "rest"
289310

290311

291-
class MarkdownExtension(BasePlugin):
312+
class MarkdownExtension(CompilerExtension):
292313
name = "dummy_markdown_extension"
314+
compiler_name = "markdown"
293315

294316

295317
class SignalHandler(BasePlugin):

‎nikola/plugins/compile/markdown/mdx_gist.plugin

+3
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
Name = mdx_gist
33
Module = mdx_gist
44

5+
[Nikola]
6+
Compiler = markdown
7+
58
[Documentation]
69
Author = Roberto Alsina
710
Version = 0.1

‎nikola/plugins/compile/markdown/mdx_nikola.plugin

+3
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
Name = mdx_nikola
33
Module = mdx_nikola
44

5+
[Nikola]
6+
Compiler = markdown
7+
58
[Documentation]
69
Author = Roberto Alsina
710
Version = 0.1

‎nikola/plugins/compile/markdown/mdx_podcast.plugin

+3
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
Name = mdx_podcast
33
Module = mdx_podcast
44

5+
[Nikola]
6+
Compiler = markdown
7+
58
[Documentation]
69
Author = Roberto Alsina
710
Version = 0.1

‎nikola/plugins/compile/rest/chart.plugin

+3
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
Name = rest_chart
33
Module = chart
44

5+
[Nikola]
6+
Compiler = rest
7+
58
[Documentation]
69
Author = Roberto Alsina
710
Version = 0.1

‎nikola/plugins/compile/rest/doc.plugin

+3
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
Name = rest_doc
33
Module = doc
44

5+
[Nikola]
6+
Compiler = rest
7+
58
[Documentation]
69
Author = Manuel Kaufmann
710
Version = 0.1

‎nikola/plugins/compile/rest/gist.plugin

+3
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
Name = rest_gist
33
Module = gist
44

5+
[Nikola]
6+
Compiler = rest
7+
58
[Documentation]
69
Author = Roberto Alsina
710
Version = 0.1

‎nikola/plugins/compile/rest/listing.plugin

+3
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
Name = rest_listing
33
Module = listing
44

5+
[Nikola]
6+
Compiler = rest
7+
58
[Documentation]
69
Author = Roberto Alsina
710
Version = 0.1

‎nikola/plugins/compile/rest/media.plugin

+3
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
Name = rest_media
33
Module = media
44

5+
[Nikola]
6+
Compiler = rest
7+
58
[Documentation]
69
Author = Roberto Alsina
710
Version = 0.1

‎nikola/plugins/compile/rest/post_list.plugin

+3
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
Name = rest_post_list
33
Module = post_list
44

5+
[Nikola]
6+
Compiler = rest
7+
58
[Documentation]
69
Author = Udo Spallek
710
Version = 0.1

‎nikola/plugins/compile/rest/slides.plugin

+3
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
Name = rest_slides
33
Module = slides
44

5+
[Nikola]
6+
Compiler = rest
7+
58
[Documentation]
69
Author = Roberto Alsina
710
Version = 0.1

‎nikola/plugins/compile/rest/soundcloud.plugin

+3
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
Name = rest_soundcloud
33
Module = soundcloud
44

5+
[Nikola]
6+
Compiler = rest
7+
58
[Documentation]
69
Author = Roberto Alsina
710
Version = 0.1

‎nikola/plugins/compile/rest/thumbnail.plugin

+3
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
Name = rest_thumbnail
33
Module = thumbnail
44

5+
[Nikola]
6+
Compiler = rest
7+
58
[Documentation]
69
Author = Pelle Nilsson
710
Version = 0.1

‎nikola/plugins/compile/rest/vimeo.plugin

+3
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
Name = rest_vimeo
33
Module = vimeo
44

5+
[Nikola]
6+
Compiler = rest
7+
58
[Documentation]
69
Description = Vimeo directive
710

‎nikola/plugins/compile/rest/youtube.plugin

+3
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
Name = rest_youtube
33
Module = youtube
44

5+
[Nikola]
6+
Compiler = rest
7+
58
[Documentation]
69
Version = 0.1
710
Description = Youtube directive

0 commit comments

Comments
 (0)
Please sign in to comment.