blob: e20543a404e279b66bf3b627a0a396ba0c9f41cc (
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
37
38
39
40
41
42
43
44
45
46
47
48
|
<%!
trans = {ord(" "):u"-", ord("/"):u"-", ord("(") : None, ord(")"):None}
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.translate(trans)
tlist = getattr(self.attr, "tlist", [])
tlist.append((str(name), str(c)))
self.attr.tlist = tlist
id_tag = "id=\"%s\"" % name
else:
id_tag = ''
%>
<${tag}><a ${id_tag}><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>
|