Module:PD-nonUK

From Wikisource
Jump to navigation Jump to search

--[=[
Implements [[Template:PD-nonUK]]
]=]

local p = {} --p stands for package

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

function p._PD_nonUK(args)
	local deathyear = PD.getAuthorDeathYear({args[1], args.deathyear})
	local pubyear = PD.getPublicationYear({args[2], args.pubyear})
	
	local text = ""
	if pubyear then
		text = PD.license_scope({past = true}) .. " published in " .. pubyear
	end
	if deathyear then
		if pubyear then
			text = text .. " and the author"
		else
			text = "The author of this work"
		end
		text = text .. " died " .. PD.currentyear - deathyear - 1 .. " years ago"
	end
	if pubyear or deathyear then
		text = text .. ". "
	end
	text = text .. PD.license_grammar({"This work is", "These works are"}) .. " in the '''[[w:public domain|public domain]]''' in some countries and areas outside the United Kingdom, '''including the United States'''.\n----\nHowever, owing to the subsistence of certain long-standing '''restrictions on publication and distribution''', the work is '''NOT necessarily copyright- or restriction-free in the United Kingdom.''' Potential re-users of this content are advised to check carefully if any restrictions would apply to their intended reuse."
	
	return PD.license({
		['image'] = 'SemiPD-icon.svg',
		['image_r'] = 'Flag of the United Kingdom in red circle with slash.svg',
		['text'] = text,
		['category'] = args.category or "PD-nonUK"
	})
end

function p.PD_nonUK(frame)
	return p._PD_nonUK(getArgs(frame))
end

return p