changeset 3671:6bd61e4063e3

macro.FootNote: reverted changeset 3243 1ad6243cdf06, fixed test
author Reimar Bauer <rb.proj AT googlemail DOT com>
date Wed, 04 Jun 2008 11:32:20 +0200
parents ae77b776457b
children fee546fba271
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	Sun Jun 01 22:33:41 2008 +0200
+++ b/MoinMoin/macro/FootNote.py	Wed Jun 04 11:32:20 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	Sun Jun 01 22:33:41 2008 +0200
+++ b/MoinMoin/macro/_tests/test_FootNote.py	Wed Jun 04 11:32:20 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>')