Module talk:Template invocation: Difference between revisions

Content deleted Content added
No edit summary
Line 68:
# A page name like "Template:User:Theknightwho" should not return "User:Theknightwho", but instead should remain "Template:User:Theknightwho".
# The function should throw an error if it receives a title with an interwiki prefix (e.g. {{fr:foo}}) or one which starts with "#" (e.g. {{#foo}}), since both of these generate valid title objects, but neither can be used with template invocations.
# (Harder to fix): when a template hasname theoverlaps samewith namethat asof a magic word, the "Template:" prefix is required in order to disambiguate it: e.g. <nowiki>{{Template:!}}</nowiki> or <nowiki>{{Template:PAGENAME:foo}}</nowiki>.
I've done a full implementation at [[wikt:Module:template parser#L-218]], but it relies on loading data for point 3, which might not be desirable to import to Wikipedia. However, points 1 and 2 are pretty simple to deal with. I've drafted a new version of the function below, incorporating fixes for both of them:
<syntaxhighlight lang=lua>