Module talk:Template invocation: Difference between revisions

Content deleted Content added
 
(2 intermediate revisions by one other user not shown)
Line 63:
== Title clash in a few edge cases ==
 
{{editprotected|answered=yes}}
 
Currently, the "name" function returns the wrong result in three edge cases. Two of these are relatively straightforward to fix, but the third is more tricky:
Line 74:
if type(title) == 'string' then
title = mw.title.new(title)
if not (title or #title.prefixedText >== 0 andor #title.interwiki ==> 0) then
error("invalid title in parameter #1 of function 'name'", 2)
end
Line 84:
local check = mw.title.new(text, 10)
-- Exclude the prefix, unless we have something like "Template:Category:Foo", which can't be abbreviated to "Category:Foo".
return check and mw_titlemw.title.equals(title, check) and text or title.prefixedText
elseif title.namespace == 0 then
return ':' .. title.prefixedText
Line 93:
</syntaxhighlight>
[[User:Theknightwho|Theknightwho]] ([[User talk:Theknightwho|talk]]) 20:07, 31 August 2024 (UTC)
: {{done}} and you should consider [[WP:Requests for permissions/Template editor|running for template editor here]] since you seem to know what you are doing. [[User:Pppery|* Pppery *]] [[User talk:Pppery|<sub style="color:#800000">it has begun...</sub>]] 20:22, 5 September 2024 (UTC)