Jump to content

Module:PD-old/sandbox

From Wikisource
--[=[
Implements [[Template:PD-old]]
]=]

local p = {} --p stands for package

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

function p._PD_old(args)
	local text = PD.license_scope({past = true}) .. " published before January 1, " .. PD.PD_US_cutoff .. ", and " .. PD.license_grammar({"is", "are"}) .. " in the '''[[w:Public domain|public domain]]''' worldwide because the author died at least 100 years ago."
	
	local edition_warning = yesno(args.edition_warning) or PD.namespace == "Author" or PD.namespace == 'Author talk'
	local posthumous_warning = yesno(args.posthumous_warning) or PD.namespace == "Author" or PD.namespace == 'Author talk'
	
	if edition_warning then
		text = text .. ' Translations or editions published later may be copyrighted.'
	end
	if posthumous_warning then
		text = text .. " Posthumous works may be [[w:List of countries' copyright length based on publication and creation dates|copyrighted based on how long they have been published]] in certain countries and areas."
	end
	
	return PD.license({
		['image'] = PD.PD_image,
		['text'] = text,
		['category'] = args.category or "PD-old",
	})
end

function p.PD_old(frame)
	return p._PD_old(getArgs(frame))
end

return p