diff options
author | René 'Necoro' Neumann <necoro@necoro.net> | 2010-05-03 18:21:53 +0200 |
---|---|---|
committer | René 'Necoro' Neumann <necoro@necoro.net> | 2010-05-03 18:21:53 +0200 |
commit | f0012811f8af8b1334b46781861a6dd3777ee392 (patch) | |
tree | e59c3e5d141ecff244584ba786ce191497a9e311 /templates/page.mako | |
download | kosten-f0012811f8af8b1334b46781861a6dd3777ee392.tar.gz kosten-f0012811f8af8b1334b46781861a6dd3777ee392.tar.bz2 kosten-f0012811f8af8b1334b46781861a6dd3777ee392.zip |
First import from portato proj
Diffstat (limited to '')
-rw-r--r-- | templates/page.mako | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/templates/page.mako b/templates/page.mako new file mode 100644 index 0000000..aa2aa51 --- /dev/null +++ b/templates/page.mako @@ -0,0 +1,46 @@ +<%! + title = "" + uses_toc = False +%> +<% + page_text = capture(next.body) +%> + +<%inherit file="/root.mako" /> + +## content + +<h1 class="title">${self.attr.title}</h1> +% if self.attr.uses_toc: + ${self.preface()} + ${self.toc()} +% endif + +${page_text} + +## functions + +<%def name="h2(tag='h2')"> + <% + if self.attr.uses_toc: + c = capture(caller.body) + name = c.replace(" ", "_").replace("/", "_").lower() + tlist = getattr(self.attr, "tlist", []) + tlist.append((str(name), str(c))) + + self.attr.tlist = tlist + else: + name = "#" + %> + <${tag}><a name="${name}"><span class="hstart">» </span></a>${caller.body()}</${tag}> +</%def> + +<%def name="toc()"> + <ul id="toc"> + % for url, name in self.attr.tlist: + <li><a class="tocLink" href="#${url}">${name}</a></li> + % endfor + </ul> +</%def> + +<%def name="preface()"></%def> |