Module:WikiProject banner/sandbox: Difference between revisions

Content deleted Content added
embed function
mNo edit summary
Line 820:
 
local initialise = function(args, raw_args, parent_args, inactive_status)
---------------------------
args.demo_page = args_module.getArgs(frame, {parentOnly = true}).demo_page
-- Initialise arguments ---
local project_name = args.PROJECT_NAME or 'WikiProject ' .. (args.PROJECT or 'PROJECT')
---------------------------
local banner_name = mw.title.new(args.BANNER_NAME or 'Template:WikiProject ' .. (args.PROJECT or 'PROJECT'))
local demoargs.demo_page = not yesnoargs_module.getArgs(args.categoryframe, or{parentOnly true,= true}) or args.demo_page
local project_name = args.PROJECT_NAME or 'WikiProject ' .. (args.PROJECT or 'PROJECT')
local on_template_page = not demo and current_title.rootPageTitle==banner_name.rootPageTitle
local banner_name = mw.title.new(args.BANNER_NAME or 'Template:WikiProject ' .. (args.PROJECT or 'PROJECT'))
local unknown_parameters = ''
local demo = not yesno(args.category or true, true) or args.demo_page
if banner_name.exists and not demo then -- check for unknown parameters
local on_template_page = not demo and current_title.rootPageTitle==banner_name.rootPageTitle
local parameters = {}
local unknown_parameters = ''
for parameter in banner_name:getContent():gmatch('{{{([^|}]+)') do
if banner_name.exists and not demo then -- check for unknown parameters
table.insert(parameters, parameter)
local parameters = {}
for parameter in banner_name:getContent():gmatch('{{{([^|}]+)') do
table.insert(parameters, parameter)
end
local check_for_unknown = require('Module:Check for unknown parameters')._check
unknown_parameters local unknowns = check_for_unknown(parameters, parent_args)
if unknowns and unknowns~='' then-- there are some unknown parameters
parameters.preview = cfg.unknown_parameters.preview:format(wikilink(banner_name.fullText))
local unknown_category = cfg.unknown_parameters.tracking:format(project_name)
if not mw.title.new(unknown_category).exists then
unknown_category = cfg.unknown_parameters.default
end
parameters.unknown = unknown_category and '[[' .. unknown_category .. '|_VALUE_]]' or ''
local check_for_unknown = require('Module:Check for unknown parameters')._check
local unknownsunknown_parameters = check_for_unknown(parameters, parent_args)
if unknowns and unknowns~='' then-- there are some unknown parameters
parameters.preview = cfg.unknown_parameters.preview:format(wikilink(banner_name.fullText))
local unknown_category = cfg.unknown_parameters.tracking:format(project_name)
if not mw.title.new(unknown_category).exists then
unknown_category = cfg.unknown_parameters.default
end
parameters.unknown = unknown_category and '[[' .. unknown_category .. '|_VALUE_]]' or ''
unknown_parameters = check_for_unknown(parameters, parent_args)
end
end
if on_template_page then
local templatepage = require('Module:WikiProject banner/templatepage' .. (sandbox or '')).templatepage
return templatepage(args, raw_args, inactive_status)
else
return unknown_parameters
.. p._main(args, raw_args, demo or inactive_status, banner_name, inactive_status and true or false), nil -- nil to disregard subsequent returned values
end
end
if on_template_page then
local templatepage = require('Module:WikiProject banner/templatepage' .. (sandbox or '')).templatepage
return templatepage(args, raw_args, inactive_status)
else
return unknown_parameters
.. p._main(args, raw_args, demo or inactive_status, banner_name, inactive_status and true or false), nil -- nil to disregard subsequent returned values
end
end