Skip to content
Permalink
Browse files

stepstep

  • Loading branch information
ralsina committed May 9, 2015
1 parent 94ed9f7 commit 597732df06714176c1e54a7692829aac4b8f9e64
Showing with 13 additions and 6 deletions.
  1. +2 −2 nikola/nikola.py
  2. +7 −0 nikola/plugin_categories.py
  3. +4 −4 nikola/plugins/task/scan_posts.py
@@ -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."""
@@ -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.
@@ -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"],
@@ -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

0 comments on commit 597732d

Please sign in to comment.
You can’t perform that action at this time.