Hi developers,
I catch an error when I process some wikipedia pages with mwlib, an
error is related to expanding magic word #tag:ref.
To repeat this error apply this patch
diff --git a/tests/test_expander.py b/tests/test_expander.py
index c36c79f..876394b 100755
--- a/tests/test_expander.py
+++ b/tests/test_expander.py
@@ -415,6 +415,9 @@ def test_tag_parametrs():
yield expandstr, '{{#tag:test|contents|a=b|c=d}}', '<test a="b"
c="d">contents</test>'
yield expandstr, "{{#tag:div|contents|a}}"
+def test_tag_ref():
+ yield expandstr, '{{#tag:ref|<ref>bbb</ref>|group=~}}', '<ref
group="~"><ref>bbb</ref></ref>'
+
def test_rel2abs():
yield expandstr, "{{#rel2abs: ./quok | Help:Foo/bar/baz }}",
"Help:Foo/bar/baz/quok"
yield expandstr, "{{#rel2abs: ../quok | Help:Foo/bar/baz }}",
"Help:Foo/bar/quok"
then, if you run py.test tests/test_expander.py you get following
error:
mwlib/templ/misc.py:49: AssertionError
------------------------------------------------------ Captured stdout
------------------------------------------------------
EXPAND: '{{#tag:ref|<ref>bbb</ref>|group=~}}' -> u'<ref group="~">
\x7fUNIQ-ref-0-254314c9175dc654-QINU\x7f</ref>'
=========================================== 1 failed, 130 passed in
0.81 seconds ============================================
I temporary resolve this problem with following patch.
diff --git a/mwlib/templ/magic_nodes.py b/mwlib/templ/magic_nodes.py
index 41f2788..1212ebb 100644
--- a/mwlib/templ/magic_nodes.py
+++ b/mwlib/templ/magic_nodes.py
@@ -95,7 +95,7 @@ class Tag(nodes.Node):
tmpres.append("</%s>" % (name,))
tmpres = u"".join(tmpres)
- tmpres = expander.uniquifier.replace_tags(tmpres)
+# tmpres = expander.uniquifier.replace_tags(tmpres)
res.append(tmpres)
now all tests passed, but there is an anti patch in repo log:
commit 113f2e7bc31ac624abe494dfefa6cc8f605df19f
Author: [email protected] <[email protected]>
Date: Mon Apr 6 14:02:59 2009 +0200
do UNIQ replacements in #tag magic
Can anyone resolve this problem?
--
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.