Commit 35cedcfd authored by glondu's avatar glondu

Les appels au formatter doivent etre faits dans l'ordre.

darcs-hash:20060430083626-68412-559822bc312cab9018661b42d23a8bf835c65697.gz
parent 3c3f1b10
......@@ -70,6 +70,18 @@ class TableOfContents:
return self.pre_re.sub('',apply(self.include_macro, args, kwargs)).split('\n')
def run(self):
f = self.macro.formatter
r = self.result
try:
# Wikipedia-style table of contents
r.append(f.open('div', True, {'id': 'tableOfContents'}))
r.append(f.open('h2', False, {'id': 'toctitle'}))
r.append(f.text(u'Sommaire'))
r.append(f.close('h2', True))
r.append(f.open('div', True, {'id': 'tableOfContentsList'}))
except:
pass
self.process_lines(self.pre_re.sub('',self.macro.parser.raw).split('\n'),
self.macro.formatter.page.page_name)
# Close pending lists
......@@ -78,26 +90,18 @@ class TableOfContents:
self.result.append(self.macro.formatter.number_list(0))
try:
html = [
self.macro.formatter.open('div', True, {'id': 'tableOfContents'}),
self.macro.formatter.open('h2', False, {'id': 'toctitle'}),
self.macro.formatter.text(u'Sommaire'),
self.macro.formatter.close('h2', True),
self.macro.formatter.open('div', True, {'id': 'tableOfContentsList'}),
''.join(self.result),
self.macro.formatter.close('div', True),
self.macro.formatter.close('div', True),
self.macro.formatter.open('div', False, {'class': 'visualClear'}),
self.macro.formatter.close('div', True),
self.macro.formatter.open('script', False,
{'type': 'text/javascript',
'src': '/wiki/common/toc/toc.js'}),
self.macro.formatter.close('script', True),
]
return u''.join(html)
r.append(f.close('div', True))
r.append(f.close('div', True))
r.append(f.open('div', False, {'class': 'visualClear'}))
r.append(f.close('div', True))
r.append(f.open('script', False,
{'type': 'text/javascript',
'src': '/wiki/common/toc/toc.js'}))
r.append(f.close('script', True))
except:
return ''.join(self.result)
pass
return u''.join(r)
def process_lines(self, lines, pagename):
for line in lines:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment