Difference between revisions of "Module:PageTemplate"

From Moegirlpedia
Jump to: navigation, search
 
(Translated text (by SublimeText.Mediawiker))
 
Line 7: Line 7:
 
local tl = args['tl'] or ''
 
local tl = args['tl'] or ''
 
if tl == '' then
 
if tl == '' then
error('未定义“'..(args['use'] or '')..'”模板!')
+
error('Template "'..(args['use'] or '')..'" is not defined!')
 
return
 
return
 
end
 
end

Latest revision as of 17:27, 23 December 2023

Template-info.svg Module Documentation  [Create] [Refresh]
local module = {}

local getArgs = require('Module:Arguments').getArgs

function module._main(args, frame)
	if args['define'] ~= nil then return end
	local tl = args['tl'] or ''
	if tl == '' then
		error('Template "'..(args['use'] or '')..'" is not defined!')
		return
	end
	tl = mw.text.unstripNoWiki(tl)
	tl = mw.text.decode(tl)
	local params = args
	params['tl'] = nil
	params['use'] = nil
	
	local frame_child = frame:newChild({args = params})
	return frame_child:preprocess(tl)
end

function module.main(frame)
	local args = getArgs(frame, { removeBlanks = false })
	return module._main(args, frame)
end

return module