From 0535ccc0608346e12eb6ff6154cfa4dd987cfa43 Mon Sep 17 00:00:00 2001 From: Lakshmi Vyasarajan Date: Wed, 5 Jan 2011 10:22:59 +0530 Subject: [PATCH] Added blockdown plugin --- hyde/template.py | 18 ++++++++++++++++++ hyde/tests/test_plugin.py | 2 ++ 2 files changed, 20 insertions(+) diff --git a/hyde/template.py b/hyde/template.py index 42500f9..17355b9 100644 --- a/hyde/template.py +++ b/hyde/template.py @@ -36,8 +36,26 @@ class Template(object): return HydeException def get_include_statement(self, path_to_include): + """ + Returns a include statement for the current template, + given the path to include. + """ return "{%% include '%s' %%}" % path_to_include + def get_block_open_statement(self, block_name): + """ + Returns a open block statement for the current template, + given the block name. + """ + return "{%% block %s %%}" % block_name + + def get_block_close_statement(self, block_name): + """ + Returns a close block statement for the current template, + given the block name. + """ + return "{%% endblock %s %%}" % block_name + @staticmethod def find_template(site): """ diff --git a/hyde/tests/test_plugin.py b/hyde/tests/test_plugin.py index 7cd61ed..7da189c 100644 --- a/hyde/tests/test_plugin.py +++ b/hyde/tests/test_plugin.py @@ -203,6 +203,7 @@ class TestPlugins(object): def test_generator_template_begin_text_resource_called(self): with patch.object(PluginLoaderStub, 'begin_text_resource') as begin_text_resource_stub: + begin_text_resource_stub.return_value = '' gen = Generator(self.site) gen.generate_all() @@ -214,6 +215,7 @@ class TestPlugins(object): def test_generator_template_begin_text_resource_called_for_single_resource(self): with patch.object(PluginLoaderStub, 'begin_text_resource') as begin_text_resource_stub: + begin_text_resource_stub.return_value = '' gen = Generator(self.site) path = self.site.content.source_folder.child('about.html') gen.generate_resource_at_path(path)