summaryrefslogtreecommitdiff
path: root/templates/page.mako
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--templates/page.mako26
1 files changed, 25 insertions, 1 deletions
diff --git a/templates/page.mako b/templates/page.mako
index 264ddee..49671ff 100644
--- a/templates/page.mako
+++ b/templates/page.mako
@@ -1,5 +1,6 @@
<%!
title = ""
+ uses_menu = False
%>
<%inherit file="/root.mako" />
@@ -7,6 +8,29 @@
<h1 class="title">${self.attr.title}</h1>
${next.body()}
+% if self.attr.uses_menu:
+ <script type="text/javascript">
+ createToc(${h.toJS(self.attr.mlist)})
+ </script>
+% endif
+
+
+<%def name="style()">
+ ${parent.style()}
+ <script src=${"/static/js/toc.js" | url} type="text/javascript"></script>
+</%def>
+
<%def name="h2()">
- <h2><span class="hstart">» </span>${caller.body()}</h2>
+ <%
+ if self.attr.uses_menu:
+ c = capture(caller.body)
+ name = c.replace(" ", "_").lower()
+ mlist = getattr(self.attr, "mlist", [])
+ mlist.append((str(name), str(c)))
+
+ self.attr.mlist = mlist
+ else:
+ name = "#"
+ %>
+ <h2><a name="${name}"><span class="hstart">» </span></a>${caller.body()}</h2>
</%def>