diff --git a/hyde/plugin.py b/hyde/plugin.py index 62a72fc..e881b41 100644 --- a/hyde/plugin.py +++ b/hyde/plugin.py @@ -40,11 +40,10 @@ class PluginProxy(object): # "\tCalling plugin [%s]", # plugin.__class__.__name__) function = getattr(plugin, method_name) - newres = function(*args) - if newres: - res = newres + res = function(*args) + last = None + if res: targs = list(args) - last = None if len(targs): last = targs.pop() targs.append(res if res else last) @@ -387,4 +386,4 @@ class TextyPlugin(Plugin): text_close = re.compile(self.close_pattern, re.UNICODE|re.MULTILINE) text = text_close.sub( partial(self.text_to_tag, start=False), text) - return text \ No newline at end of file + return text diff --git a/hyde/tests/test_plugin.py b/hyde/tests/test_plugin.py index c7739d9..93561d3 100644 --- a/hyde/tests/test_plugin.py +++ b/hyde/tests/test_plugin.py @@ -19,15 +19,17 @@ TEST_SITE = File(__file__).parent.child_folder('_test') class PluginLoaderStub(Plugin): pass - + class NoReturnPlugin(Plugin): - + def begin_text_resource(self, resource, text): + print "NoReturnPlugin" return None class ConstantReturnPlugin(Plugin): def begin_text_resource(self, resource, text): + print "ConstantReturnPlugin" return "Jam" @@ -318,11 +320,12 @@ class TestPlugins(object): def test_plugin_chaining(self): self.site.config.plugins = [ - 'hyde.tests.test_plugin.NoReturnPlugin', - 'hyde.tests.test_plugin.ConstantReturnPlugin'] + 'hyde.tests.test_plugin.ConstantReturnPlugin', + 'hyde.tests.test_plugin.NoReturnPlugin' + ] path = self.site.content.source_folder.child('about.html') gen = Generator(self.site) - gen.generate_resource_at_path(path, incremental=True) + gen.generate_resource_at_path(path) about = File(Folder( self.site.config.deploy_root_path).child('about.html')) assert about.read_all() == "Jam"