Page MenuHomePhabricator

template.py does not recognize nested templates
Closed, ResolvedPublic

Description

When using template.py (compat) on Wikimedia Labs to remove a template from a list of articles using the command:

python template.py "Persondata" -remove

I noticed that the template (ar:Template:Persondata) gets removed only partially if one of the template parameters is another template.
Examples:

I used the compat version of template.py. Didn't test the core version of the script.

Event Timeline

Meno25 raised the priority of this task from to Needs Triage.
Meno25 updated the task description. (Show Details)
Meno25 added a project: Pywikibot-compat.
Meno25 subscribed.
Xqt subscribed.

Won't fix in compat. Try core and file a new bug when it's failing.

Xqt triaged this task as High priority.
Xqt added projects: Pywikibot, Pywikibot-tests.

Reopened due to the bug also exists in core. Refer https://en.wikipedia.org/wiki/User_talk:Xqt#T110529

Xqt added a subscriber: jayvdb.

Looks like the textlib._MultiTemplateMatchBuilder does not recognize nested templates.

Xqt renamed this task from template.py (compat) removes template partially if one of template parameters contains another template to template.py does not recognize nested templates.Apr 8 2016, 7:47 AM

Correct. There are three TODOs in that cls iirc.

Change 770956 had a related patch set uploaded (by Xqt; author: Xqt):

[pywikibot/core@master] [bugfix] Enable nested templates with MultiTemplateMatchBuilder

https://gerrit.wikimedia.org/r/770956

Change 770956 merged by jenkins-bot:

[pywikibot/core@master] [bugfix] Enable nested templates with MultiTemplateMatchBuilder

https://gerrit.wikimedia.org/r/770956