Module:Template invocation and Module:Template invocation/sandbox: Difference between pages
(Difference between pages)
imported>Pppery Update name call to fix a few edge cases per request |
imported>Andrybak typo |
||
| Line 20: | Line 20: | ||
if type(title) == 'string' then | if type(title) == 'string' then | ||
title = mw.title.new(title) | title = mw.title.new(title) | ||
if not title | if not title then | ||
error("invalid title in parameter #1 of function 'name'", 2) | error("invalid title in parameter #1 of function 'name'", 2) | ||
end | end | ||
| Line 27: | Line 27: | ||
end | end | ||
if title.namespace == 10 then | if title.namespace == 10 then | ||
return title.text | |||
return | |||
elseif title.namespace == 0 then | elseif title.namespace == 0 then | ||
return ':' .. title.prefixedText | return ':' .. title.prefixedText | ||
| Line 37: | Line 34: | ||
end | end | ||
end | end | ||
------------------------------------------------------------------------ | ------------------------------------------------------------------------ | ||
-- Name: p.invocation | -- Name: p.invocation | ||