Skip to content

Commit 597732d

Browse files
committedMay 9, 2015
stepstep
1 parent 94ed9f7 commit 597732d

File tree

3 files changed

+13
-6
lines changed

3 files changed

+13
-6
lines changed
 

Diff for: ‎nikola/nikola.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -1358,8 +1358,8 @@ def scan_posts(self):
13581358
# Why doesn't getPluginByName work????
13591359
if self._scanned:
13601360
return
1361-
p = [p for p in self.plugin_manager.getPluginsOfCategory('Task') if p.name == 'scan_posts'][0]
1362-
list(p.plugin_object.gen_tasks())
1361+
for p in self.plugin_manager.getPluginsOfCategory('PostScanner'):
1362+
p.plugin_object.scan()
13631363

13641364
def generic_page_renderer(self, lang, post, filters):
13651365
"""Render post fragments to final HTML pages."""

Diff for: ‎nikola/plugin_categories.py

+7
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,13 @@ def inject_dependency(self, target, dependency):
7979
"""Add 'dependency' to the target task's task_deps"""
8080
self.site.injected_deps[target].append(dependency)
8181

82+
class PostScanner(BasePlugin):
83+
"""The scan method of these plugins is called by Nikola.scan_posts."""
84+
85+
def scan(self):
86+
"""Load posts into the timeline."""
87+
raise NotImplementedError()
88+
8289

8390
class Command(BasePlugin, DoitCommand):
8491
"""These plugins are exposed via the command line.

Diff for: ‎nikola/plugins/task/scan_posts.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -32,17 +32,17 @@
3232

3333
from blinker import signal
3434

35-
from nikola.plugin_categories import Task
35+
from nikola.plugin_categories import PostScanner
3636
from nikola import utils
3737
from nikola.post import Post
3838

3939

40-
class ScanPosts(Task):
40+
class ScanPosts(PostScanner):
4141
"""Render pages into output."""
4242

4343
name = "scan_posts"
4444

45-
def gen_tasks(self):
45+
def scan(self):
4646
"""Build final pages from metadata and HTML fragments."""
4747
kw = {
4848
"post_pages": self.site.config["post_pages"],
@@ -73,7 +73,7 @@ def gen_tasks(self):
7373
if not self.site.quiet:
7474
print(".", end='', file=sys.stderr)
7575
dirname = os.path.dirname(wildcard)
76-
for dirpath, _, _ in os.walk(dirname, followlinks=True):
76+
for dirpath, _, _ in os.walk(dirname, followlinks=True ):
7777
dest_dir = os.path.normpath(os.path.join(destination,
7878
os.path.relpath(dirpath, dirname))) # output/destination/foo/
7979
# Get all the untranslated paths

0 commit comments

Comments
 (0)
Please sign in to comment.