Jump to content

Module:PD-posthumous

From Wikisource

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

local p = {} --p stands for package

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

function p._PD_posthumous(args)
	local pubyear = PD.getPublicationYear({args[1], args.pubyear})
	
	local text
	local image
	if pubyear then
		text = PD.license_scope() .. PD.license_grammar({" a '''posthumous work''' which is", "'''posthumous works''' which are"}) .. " in the '''[[w:public domain|public domain]]''' in countries and areas where the [[w:List of countries' copyright length|copyright terms of posthumous works]] are '''" .. PD.currentyear - pubyear - 1 .. " years or less since posthumous publication'''."
		image = PD.PD_image
	else
		text = PD.license_scope() .. PD.license_grammar({" a '''posthumous work'''", " '''posthumous works'''"}) .. " and may be copyrighted in certain countries and areas where the [[w:List of countries' copyright length|copyright terms of posthumous works]] are based on time since posthumous publication."
		image = "PDmaybe-icon.svg"
	end
	
	return PD.license({
		['image'] = image,
		['image_r'] = 'Flag of the United States in red circle with slash.svg',
		['text'] = text,
		['category'] = args.category or PD.category_with_year_floor("PD-posthumous", {99, 70, 60, 50, 25}, pubyear),
		['warning'] = "This template must be accompanied by a tag indicating copyright status in the United States."
	})
end

function p.PD_posthumous(frame)
	return p._PD_posthumous(getArgs(frame))
end

return p