magnusmanske / petscan_rs

The repo for the PetScan tool
https://petscan.wmflabs.org/
GNU General Public License v3.0
43 stars 10 forks source link

Support non-template-namespace templates #142

Open tacsipacsi opened 9 months ago

tacsipacsi commented 9 months ago

In wikitext, page titles after {{ default to the template namespace, but can be overridden by explicitly specifying a namespace, or : to transclude a mainspace page. PetScan implements the first part – defaulting to the template namespace –, but not the second, the ability to override the namespace. Consequently, pages transcluded from other namespaces cannot be searched for using the textareas at Templates&links / Templates.

If I understand the code correctly, this is what happens when I input something in the Has all of these templates: field:

Input Actual SQL fragment Expected SQL fragment Correct?
Title lt_namespace=10 AND lt_title='Title' lt_namespace=10 AND lt_title='Title' Yes
Module:Title lt_namespace=10 AND lt_title='Module:Title' lt_namespace=828 AND lt_title='Title' No
:Title lt_namespace=10 AND lt_title=':Title' lt_namespace=0 AND lt_title='Title' No

The latter two should be fixed.

Reference: https://en.wikipedia.org/w/index.php?title=User_talk:Magnus_Manske&diff=1178068305