I've attached a patch against head that provides support for #tag
parameters[1] and a test in test_expander.py:

{{#tag:name|content|a=b|c=d}} -> <name a="b" c="d">content</name>

Should I open a ticket?

Footnotes: 
[1]  http://www.mediawiki.org/wiki/Help:Magic_words#Miscellaneous

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"mwlib" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [email protected]
For more options, visit this group at http://groups.google.com/group/mwlib?hl=en
-~----------~----~----~----~------~----~------~--~---

diff -r af0170a1c031 mwlib/templ/magic_nodes.py
--- a/mwlib/templ/magic_nodes.py        Fri Apr 03 16:30:40 2009 +0200
+++ b/mwlib/templ/magic_nodes.py        Sun Apr 05 00:08:19 2009 -0700
@@ -1,3 +1,4 @@
+from xml.sax.saxutils import quoteattr
 from mwlib.templ import nodes, evaluate
 
 class Subst(nodes.Node):
@@ -44,9 +45,18 @@
         name = []
         evaluate.flatten(self[0], expander, variables, name)
         name = u"".join(name).strip()
+        parameters = u''
+
+        for parm in self[2:]:
+            tmp = []
+            evaluate.flatten(parm, expander, variables, tmp)
+            evaluate._insert_implicit_newlines(tmp)
+            key, value = evaluate.equalsplit(tmp)
+            parameters += ' ' + u'='.join([u''.join(key),
+                                           quoteattr(u''.join(value))])
 
         tmpres = []
-        tmpres.append("<%s>" % (name,))
+        tmpres.append("<%s%s>" % (name, parameters))
         
         if len(self)>1:
             tmp = []
@@ -57,7 +67,6 @@
             
         tmpres.append("</%s>" % (name,))
         tmpres = u"".join(tmpres)
-        tmpres = expander.uniquifier.replace_tags(tmpres)
         res.append(tmpres)
         
         
diff -r af0170a1c031 tests/test_expander.py
--- a/tests/test_expander.py    Fri Apr 03 16:30:40 2009 +0200
+++ b/tests/test_expander.py    Sun Apr 05 00:08:19 2009 -0700
@@ -401,3 +401,5 @@
     db= DictDB(t1="{{{1}}}")
     expandstr("{{t1|[[abc|foo=5]]}}", "[[abc|foo=5]]", wikidb=db)
            
+def test_tag_parametrs():
+    expandstr('{{#tag:test|contents|a=b|c=d}}', '<test a="b" 
c="d">contents</test>')

Reply via email to