Mercurial > moin > 1.9
changeset 3670:a799b224389f
macro.FootNote: reverted changeset 3243 1ad6243cdf06, fixed test (port from 1.7)
author | Reimar Bauer <rb.proj AT googlemail DOT com> |
---|---|
date | Fri, 06 Jun 2008 16:25:55 +0200 |
parents | 86f8f213d044 |
children | 757a3e521a3c 1976b1fdabd0 |
files | MoinMoin/macro/FootNote.py MoinMoin/macro/_tests/test_FootNote.py |
diffstat | 2 files changed, 11 insertions(+), 11 deletions(-) [+] |
line wrap: on
line diff
--- a/MoinMoin/macro/FootNote.py Thu Jun 05 11:31:57 2008 +0200 +++ b/MoinMoin/macro/FootNote.py Fri Jun 06 16:25:55 2008 +0200 @@ -18,7 +18,7 @@ Dependencies = ["time"] # footnote macro cannot be cached -def macro_FootNote(macro, text=u''): +def execute(macro, args): request = macro.request formatter = macro.formatter @@ -28,27 +28,27 @@ request.footnote_ctr = 0 request.footnote_show_ctr = 0 - if not text: + if not args: return emit_footnotes(request, formatter) else: # grab new footnote backref number idx = request.footnote_ctr request.footnote_ctr += 1 - shahex = sha.new(text.encode(config.charset)).hexdigest() + shahex = sha.new(args.encode(config.charset)).hexdigest() backlink_id = "fndef-%s-%d" % (shahex, idx) fwdlink_id = "fnref-%s" % shahex - if not text in request.footnotes: + if not args in request.footnotes: showidx = request.footnote_show_ctr request.footnote_show_ctr += 1 - request.footnotes[text] = ([], fwdlink_id, showidx) - flist, dummy, showidx = request.footnotes[text] - request.footnotes[text] = (flist + [(backlink_id, idx)], fwdlink_id, showidx) + request.footnotes[args] = ([], fwdlink_id, showidx) + flist, dummy, showidx = request.footnotes[args] + request.footnotes[args] = (flist + [(backlink_id, idx)], fwdlink_id, showidx) # do index -> text mapping in the same dict, that's fine because - # text is always a string and idx alwas a number. - request.footnotes[idx] = text + # args is always a string and idx alwas a number. + request.footnotes[idx] = args return "%s%s%s%s%s" % ( formatter.sup(1),
--- a/MoinMoin/macro/_tests/test_FootNote.py Thu Jun 05 11:31:57 2008 +0200 +++ b/MoinMoin/macro/_tests/test_FootNote.py Fri Jun 06 16:25:55 2008 +0200 @@ -41,9 +41,9 @@ """ module_tested: enumbering of Footnotes""" m = self._make_macro() text = 'a' - FootNote.macro_FootNote(m, text) + FootNote.execute(m, text) text = 'b' - FootNote.macro_FootNote(m, text) + FootNote.execute(m, text) result = FootNote.emit_footnotes(m.request, m.request.formatter) assert result.endswith('2</a>)</li></ol></div>')