local p =
function p.decide_migration(args) if args['migration'] then return args['migration'] end local licsense_migration_data = mw.loadJsonData('Module:Self/license_migration_data.json') for _, template_name in ipairs(args) do local migration_data = licsense_migration_data[string.lower(template_name)] if migration_data
function p.setup_template_params(template_name, frame, args, migration) local title = mw.title.new(template_name, 10) if not title.exists then return end
return end
function p.more_than_one(args) local c = 0 for _, __ in ipairs(args) do c = c + 1 if c
function p.start_line(args) local more_than_one = p.more_than_one(args) return mw.ustring.format('\'\'\'\'\'%s, the copyright holder of this work,\'\'\' hereby publish%s it under the following license%s:\'\, args['author'] or 'I', args['author'] and 'es' or , more_than_one and 's' or )end
function p.categories(args) local currentTitle = mw.title.getCurrentTitle local is_in_file_namespace = currentTitle.nsText
if args['author'] then return mw.ustring.format('', currentTitle.fullText) else return mw.ustring.format('', currentTitle.fullText) endend
function p.main(frame) local args = frame:getParent.args local tstyles = frame:extensionTag('templatestyles', ,) local fmt_string_tmpl = '
' .. '
%s
%s
%s
%s' local initial_text = p.start_line(args) local final_line = p.more_than_one(args) and "
You may select the license of your choice.
" or local categories = p.categories(args) local templates = local errors = local migration = p.decide_migration(args) for _, template_name in ipairs(args) do tmpl_with_args = p.setup_template_params(template_name, frame, args, migration) templates = templates .. tmpl_with_args.txt errors = errors .. tmpl_with_args.errors end return tstyles .. mw.ustring.format(fmt_string_tmpl, initial_text, templates, final_line, categories) .. errorsend
return p--