Page MenuHomePhabricator

templatesWithParams parser bug
Closed, ResolvedPublic

Description

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.


Version: unspecified
Severity: normal
See Also:
https://sourceforge.net/p/pywikipediabot/bugs/1605

Details

Reference
bz55147

Event Timeline

bzimport raised the priority of this task from to Needs Triage.Nov 22 2014, 2:22 AM
bzimport set Reference to bz55147.
bzimport added a subscriber: Unknown Object (????).
  • assigned_to: nobody --> xqt
  • status: open --> closed-fixed

reopened due to bug \#3609794

I only chanced textlib.extract\_templates\_and\_params\(\) which worked good for me. But Page.templatesWithParams\(\) still fails

https://sourceforge.net/tracker/?func=detail&aid=3609794&group\_id=93107&atid=603138

  • status: closed-fixed --> open

fixed in r11324. Would you please check the new commit.

  • status: open --> pending-fixed