Browse Source

Added blockdown plugin

main
Lakshmi Vyasarajan 14 years ago
parent
commit
0535ccc060
2 changed files with 20 additions and 0 deletions
  1. +18
    -0
      hyde/template.py
  2. +2
    -0
      hyde/tests/test_plugin.py

+ 18
- 0
hyde/template.py View File

@@ -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):
"""


+ 2
- 0
hyde/tests/test_plugin.py View File

@@ -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)


Loading…
Cancel
Save