Navigation Menu

Skip to content

Commit

Permalink
stepstep
Browse files Browse the repository at this point in the history
  • Loading branch information
ralsina committed May 9, 2015
1 parent 94ed9f7 commit 597732d
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 6 deletions.
4 changes: 2 additions & 2 deletions nikola/nikola.py
Expand Up @@ -1358,8 +1358,8 @@ def scan_posts(self):
# Why doesn't getPluginByName work????
if self._scanned:
return
p = [p for p in self.plugin_manager.getPluginsOfCategory('Task') if p.name == 'scan_posts'][0]
list(p.plugin_object.gen_tasks())
for p in self.plugin_manager.getPluginsOfCategory('PostScanner'):
p.plugin_object.scan()

def generic_page_renderer(self, lang, post, filters):
"""Render post fragments to final HTML pages."""
Expand Down
7 changes: 7 additions & 0 deletions nikola/plugin_categories.py
Expand Up @@ -79,6 +79,13 @@ def inject_dependency(self, target, dependency):
"""Add 'dependency' to the target task's task_deps"""
self.site.injected_deps[target].append(dependency)

class PostScanner(BasePlugin):
"""The scan method of these plugins is called by Nikola.scan_posts."""

def scan(self):
"""Load posts into the timeline."""
raise NotImplementedError()


class Command(BasePlugin, DoitCommand):
"""These plugins are exposed via the command line.
Expand Down
8 changes: 4 additions & 4 deletions nikola/plugins/task/scan_posts.py
Expand Up @@ -32,17 +32,17 @@

from blinker import signal

from nikola.plugin_categories import Task
from nikola.plugin_categories import PostScanner
from nikola import utils
from nikola.post import Post


class ScanPosts(Task):
class ScanPosts(PostScanner):
"""Render pages into output."""

name = "scan_posts"

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

0 comments on commit 597732d

Please sign in to comment.