Wiki Basa Acèh 2022: Ôn Keue
Basa AcèhVietnameseEnglish

Dokumentasi untuk modul ini dapat dibuat di Modul:Unsubst/doc

local p = {}local specialParams = {['$N'] = 'template name',['$B'] = 'template content',}p[''] = function ( frame )if not frame:getParent() thenerror( '{{#invoke:Unsubst|unsubst}} makes no sense without a parent frame' )endfor k, v in pairs( specialParams ) doif not frame.args[k] thenerror( '{{#invoke:Unsubst|unsubst}} requires parameter ' .. k .. ' (' .. v .. ')' )endendif mw.isSubsting() then---- substing-- Combine passed args with passed defaultslocal args = {}for k, v in pairs( frame.args ) doif not specialParams[k] thenif v == '__DATE__' thenv = mw.getContentLanguage():formatDate( 'F Y' )endargs[k] = vendendfor k, v in pairs( frame:getParent().args ) doargs[k] = vend-- Now, build an equivalent template invocation-- First numbered args, then namedlocal ret = '{{' .. frame.args['$N']for k, v in ipairs( args ) doif string.find( v, '=', 1, true ) then-- likely something like 1=foo=bar, we need to do it as a named argbreakendret = ret .. '|' .. vargs[k] = nilendfor k, v in pairs( args ) doret = ret .. '|' .. k .. '=' .. vendreturn ret .. '}}'else---- Not substing-- Just return the "body"return frame.args['$B']endendreturn p