diff options
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> |