ee7dd64
Index: README
ee7dd64
===================================================================
ee7dd64
--- README	(revision 3275)
ee7dd64
+++ README	(revision 3276)
ee7dd64
@@ -66,7 +66,7 @@
ee7dd64
 -------------------
ee7dd64
 
ee7dd64
 Copyright 2005-2006, Bernhard Haumacher (haui at haumacher.de)
ee7dd64
-Copyright 2005-2008, Thomas Moschny (thomas.moschny at gmx.de)
ee7dd64
+Copyright 2005-2010, Thomas Moschny (thomas.moschny at gmx.de)
ee7dd64
 
ee7dd64
 This program is free software; you can redistribute it and/or modify
ee7dd64
 it under the terms of the GNU General Public License as published by
ee7dd64
Index: tracnav/tracnav.py
ee7dd64
===================================================================
ee7dd64
--- tracnav/tracnav.py	(revision 3275)
ee7dd64
+++ tracnav/tracnav.py	(revision 3276)
ee7dd64
@@ -34,7 +34,7 @@
ee7dd64
 == Author and License ==
ee7dd64
 
ee7dd64
  * Copyright 2005-2006, Bernhard Haumacher (haui at haumacher.de)
ee7dd64
- * Copyright 2005-2008, Thomas Moschny (thomas.moschny at gmx.de)
ee7dd64
+ * Copyright 2005-2010, Thomas Moschny (thomas.moschny at gmx.de)
ee7dd64
 
ee7dd64
 {{{
ee7dd64
 This program is free software; you can redistribute it and/or modify
ee7dd64
@@ -63,6 +63,7 @@
ee7dd64
 from trac.wiki.model import WikiPage
ee7dd64
 from trac.wiki.formatter import Formatter, OneLinerFormatter
ee7dd64
 from trac.util.html import Markup
ee7dd64
+from trac.util import arity
ee7dd64
 from genshi.builder import tag
ee7dd64
 from StringIO import StringIO
ee7dd64
 
ee7dd64
@@ -87,6 +88,7 @@
ee7dd64
         OneLinerFormatter.__init__(self, env, ctx)
ee7dd64
         self.lastlink = None
ee7dd64
         self.allowed_macros = allowed_macros
ee7dd64
+        self.mf_argcount = arity(OneLinerFormatter._macro_formatter)
ee7dd64
 
ee7dd64
     def format_toc(self, wikitext):
ee7dd64
         self.lastlink = None
ee7dd64
@@ -100,14 +102,20 @@
ee7dd64
         return OneLinerFormatter._make_link(
ee7dd64
             self, namespace, target, *args)
ee7dd64
 
ee7dd64
-    def _macro_formatter(self, match, fullmatch):
ee7dd64
+    def _macro_formatter(self, match, fullmatch, macro=None):
ee7dd64
         name = fullmatch.group('macroname')
ee7dd64
         if name in self.allowed_macros:
ee7dd64
             # leapfrog the OneLinerFormatter
ee7dd64
-            return Formatter._macro_formatter(self, match, fullmatch)
ee7dd64
+            if self.mf_argcount == 4:
ee7dd64
+                return Formatter._macro_formatter(self, match, fullmatch, macro)
ee7dd64
+            else:
ee7dd64
+                return Formatter._macro_formatter(self, match, fullmatch)
ee7dd64
         else:
ee7dd64
             # use the OneLinerFormatter
ee7dd64
-            return OneLinerFormatter._macro_formatter(self, match, fullmatch)
ee7dd64
+            if self.mf_argcount == 4:
ee7dd64
+                return OneLinerFormatter._macro_formatter(self, match, fullmatch, macro)
ee7dd64
+            else:
ee7dd64
+                return OneLinerFormatter._macro_formatter(self, match, fullmatch)
ee7dd64
 
ee7dd64
     # FIXME: what about _make_relative_link() ?
ee7dd64
     # FIXME: CamelCase links are special and not handled by the Formatter...