diff --git a/ciclostile.py b/ciclostile.py index e116413..16bd01e 100755 --- a/ciclostile.py +++ b/ciclostile.py @@ -3,7 +3,7 @@ import os import markdown import jinja2 -template_file = 'template.html' +template_path = 'templates' md_path = './markdown' html_path = './target' @@ -15,6 +15,9 @@ def write_page(page, out_name): def render_page(data): + template_name = data.get('template', 'default') + template_file = os.path.join(template_path, template_name + '.html') + with open(template_file) as f: template = f.read() diff --git a/example/markdown/test_other_template.md b/example/markdown/test_other_template.md new file mode 100644 index 0000000..fa0ebbe --- /dev/null +++ b/example/markdown/test_other_template.md @@ -0,0 +1,8 @@ +Title: Other Test Page +Template: other_template + + +# Title + +Some other text + diff --git a/example/template.html b/example/templates/default.html similarity index 100% rename from example/template.html rename to example/templates/default.html diff --git a/example/templates/other_template.html b/example/templates/other_template.html new file mode 100644 index 0000000..a1939c6 --- /dev/null +++ b/example/templates/other_template.html @@ -0,0 +1,11 @@ + + + + {{ title }} + + + +

Other Template

+ {{ content }} + +