Module:Unsubst: Difference between revisions

265 bytes removed ,  6 years ago
m
all uses removed
No edit summary
m (all uses removed)
Line 1:
local p = {}
 
local specialParams = {
['$N'] = 'template name', -- Deprecated, but keeping until it is removed from transcluding templates
['$B'] = 'template content',
}
 
p[''] = function ( frame )
if not frame:getParent() then
Line 13 ⟶ 12:
error( '{{#invoke:Unsubst|}} requires parameter $B (template content)' )
end
if mw.isSubsting() then
---- substing
Line 29 ⟶ 28:
args[k] = v
end
 
-- Build an equivalent template invocation
-- First, find the title to use
Line 41 ⟶ 40:
title = titleobj.prefixedText
end
 
-- Build the invocation body with numbered args first, then named
local ret = '{{' .. title
Line 55 ⟶ 54:
ret = ret .. '|' .. k .. '=' .. v
end
return ret .. '}}'
else
---- Not substing
-- Just return the "body"
return frame.args['$B']
return frame.args['$B'] .. (frame.args['$N'] and frame:getParent():getTitle() == mw.title.getCurrentTitle().prefixedText and '[[Category:Calls to Module:Unsubst that use $N]]' or '')
end
end
 
return p
Anonymous user