https://bugzilla.wikimedia.org/show_bug.cgi?id=55147

       Web browser: ---
            Bug ID: 55147
           Summary: templatesWithParams parser bug
           Product: Pywikibot
           Version: unspecified
          Hardware: All
                OS: All
            Status: ASSIGNED
          Severity: normal
          Priority: Unprioritized
         Component: General
          Assignee: [email protected]
          Reporter: [email protected]
    Classification: Unclassified
   Mobile Platform: ---

Originally from: http://sourceforge.net/p/pywikipediabot/bugs/1605/
Reported by: leeyc0
Created on: 2013-04-01 11:37:55
Subject: templatesWithParams parser bug
Assigned to: xqt
Original description:
version.py info:
Pywikipedia \[http\] trunk/pywikipedia \(r11308, 2013/03/30, 16:56:02,
OUTDATED\)
Python 2.7.3 \(default, Sep 26 2012, 21:51:14\)
\[GCC 4.7.2\]
config-settings:
use\_api = True
use\_api\_login = True
unicode test: ok


Below is the code snippet that demonstrates the bug:

\#\!/usr/bin/python
\# -\*- coding: utf-8 -\*-
import wikipedia as pywikibot
site = pywikibot.getSite\(\)
page = pywikibot.Page\(site, "Template:001"\) \# or some other page, the page
itself is irrelevant here
pageText = u"\{\{monster | \{\{\{1\}\}\} | id=001\}\}"
print\(page.templatesWithParams\(pageText\)\)

I found that the output is
\[\(u'1', \[\]\)\]

instead of expected value
\[\(u'Monster', \[u' \{\{\{1\}\}\}', u' id=001'\]\)\]

However, if I change pageText to

pageText = u"\{\{monster | abc | id=001\}\}"

Then the output would be
\[\(u'Monster', \[u' abc ', u' id=001'\]\)\]

Which is correct.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
Wikibugs-l mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/wikibugs-l

Reply via email to