summaryrefslogtreecommitdiff
path: root/templates/page.mako
blob: cc3f4807acc7f1e2e1de3073a397eb16a5d17c87 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
<%!
    title = ""
    uses_toc = False
%>

<%inherit file="/root.mako" />

<h1 class="title">${self.attr.title}</h1>
${next.body()}

% if self.attr.uses_toc:
    <script type="text/javascript">
        createToc(${h.toJS(self.attr.tlist)})
    </script>
% endif


<%def name="style()">
    ${parent.style()}
    <script src=${"/static/js/toc.js" | url} type="text/javascript"></script>
</%def>

<%def name="h2()">
    <% 
        if self.attr.uses_toc:
            c = capture(caller.body)
            name = c.replace(" ", "_").lower()
            tlist = getattr(self.attr, "tlist", [])
            tlist.append((str(name), str(c)))

            self.attr.tlist = tlist
        else:
            name = "#"
    %>
    <h2><a name="${name}"><span class="hstart">» </span></a>${caller.body()}</h2>
</%def>