Module:Auto license

--[=[ This module maps from the generic data returned by 'Work license' to actual templates as used by Wikisource pages. ]=]

local p = {} --p stands for package local getArgs = require('Module:Arguments').getArgs local wikibaseUtils = require( 'Module:Wikibase utils' ) local workLicense = require( 'Module:Work license' )

function p.autoLicensesFromEntity( entity ) license = 'PD-US' args = {} return { title = license, args = args } end

--[=[ Function docs ]=] function p.autoLicenses(frame) local args = getArgs(frame) local entity if args[ 1 ] then -- load a suitable entity entity = wikibaseUtils.getEntity( args[ 1 ] ) else entity = wikibase.getEntity end local templates = p.autoLicensesFromEntity( entity ) out = '' for _, t in pairs( templates ) do out = out .. frame:expandTemplate( t ) .. '\n' end return out end

return p