summaryrefslogtreecommitdiff
path: root/sandbox/presentations/pycon2007/doctrees-lightning-talk/footnote.py
blob: 7c9b3d2a6c74824953ae245c3a326852c9830f9e (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
def visit_footnote(self, node):

    # ... lots of complicated code snipped ...
    #         self.output.append(...)
 
    if self.settings.footnote_backlinks and backrefs:
        if len(backrefs) == 1:
            self.stack.append('')
            self.stack.append('</a>')
            self.stack.append('<a class="fn-backref" href="#%s">'
                                % backrefs[0])
        else:
            i = 1
            for backref in backrefs:
                backlinks.append('<a class="fn-backref" href="#%s">%s</a>'
                                 % (backref, i))
                i += 1
            self.stack.append('<em>(%s)</em> ' % ', '.join(backlinks))
            self.stack += ['', '']
    else:
        self.stack.append('')
        self.stack += ['', '']

    # ... lots of code snipped ...


def depart_footnote(self, node):
    self.output.append('</td></tr>\n</tbody>\n</table>\n')
    # No stack.pop here!