e222f8992014 — Oben Sonne 5 years ago
Merge in default
3 files changed, 33 insertions(+), 14 deletions(-)

M .hgignore
M poole.py
M .hgignore +11 -10
@@ 1,10 1,11 @@ 
-syntax: glob
+syntax: glob
  No newline at end of file

M README.md +13 -2
@@ 32,7 32,7 @@ yours).
 **You** should know Markdown and optionally Python if you want to use Poole's
 dirty content generation capability.
-**Your system** should have installed Python ≥ 2.5 and [python-markdown][pymd].
+**Your system** should have installed Python ≥ 2.7 and [python-markdown][pymd].
 Poole has been tested on Linux but should also work on other Unix systems and
 Windows (in theory, [report an issue][issues] if it fails).

@@ 78,7 78,8 @@ Run `poole.py --build` whenever you've m
 Poole takes files from a project's `input` directory and copies them to the
 `output` directory. In this process files ending with *md*, *mkd*, *mdown* or
-*markdown* get converted to HTML using the project's `page.html` as a skeleton.
+*markdown* get converted to HTML using the project's `page.html` as a template
+(unless a custom template is set on an individual page).
 Additionally Poole expands any macros used in a page. Don't care about that for
 now ..

@@ 128,6 129,16 @@ It's easy to apply one of the numerous f
 site. For more information read [this blog post with step-by-step
+In case you need special templates for individual pages, you can add the
+property `tempalte` in the front matter of each page:
+    title: This looks different
+    template: a-special-page-template.html
+    ---
+In that case the given file is used as the page template instead of the default
+`page.html` file.
 [pimp]: http://obensonne.bitbucket.org/blog/20091122-using-a-free-css-templates-in-poole.html
 ## Content Generation

M poole.py +9 -2
@@ 617,16 617,23 @@ def build(project, opts):
     # -------------------------------------------------------------------------
     with open(opj(project, "page.html"), 'r', encoding=UTF8) as fp:
-        skeleton = fp.read()
+        default_template = fp.read()
     for page in pages:
+        if 'template' in page:
+            fname = opj(project, page['template'])
+            with open(fname, 'r', opts.input_enc) as fp:
+                template = fp.read()
+        else:
+            template = default_template
         print("info   : render %s" % page.url)
         # replace expressions and statements in page.html
         macros["page"] = page
         macros["__content__"] = page.html
-        out = regx_eval.sub(repl_eval, skeleton)
+        out = regx_eval.sub(repl_eval, template)
         out = regx_exec.sub(repl_exec, out)
         # un-escape escaped python code blocks