Module:PD-old-collective

From Wikisource
Jump to navigation Jump to search

--[=[
Implements [[Template:PD-old-collective]]
]=]

local p = {} --p stands for package

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

function p._PD_old_collective(args)
	local deathyear = PD.getAuthorDeathYear({args[1], args.deathyear})
	local pubyear = PD.getPublicationYear({args[2], args.pubyear})
	local term = tonumber(args.term)
	local checked = yesno(args.checked or false)
	local category = args.category
	
	-- when the work can move to Commons
	local pub_offset
	if checked then
		pub_offset = 120
	else
		pub_offset = 150
	end
	
	-- collective work + pubyear
	local text = PD.license_scope() .. " " .. PD.license_grammar({"a collective work", "collective works"}) .. " (''i.e.'' the product of multiple authors), and " .. PD.license_grammar({"was", "were"}) .. " published outside the US"
	if pubyear then
		text = text .. " in " .. pubyear
	end
	text = text .. ", and not all of the authors have known death dates. " .. PD.license_grammar({"It was", "They were"}) .. " published before January 1, " .. PD.PD_US_cutoff .. ", so " .. PD.license_grammar({"it is", "they are"}) .. " in the [[H:Public domain|public domain]] in the US. "
	
	-- deathyear
	if deathyear then
		text = text .. "The latest known year an author died is " .. deathyear
		if term and deathyear + term >= PD.currentyear then
			text = text .. ", meaning that the " .. PD.license_grammar({"work", "works"}) .. " as a whole " .. PD.license_grammar({"is", "are"}) .. " in copyright in " .. PD.license_grammar({"its country", "their countries"}) .. " of origin until at least " .. deathyear + term + 1
		end
		text = text .. "."
	end
	
	-- reasonably diligent search
	text = text .. "\n\nA [[commons:Commons:Collective work|reasonably diligent search]] for authors who died was"
	if not checked then
		text = text .. " '''not'''"
	end
	text = text .. " conducted, so according to Wikimedia Commons [[commons:Commons:Collective_work|guidelines]], " .. PD.license_grammar({"this work", "these works"}) .. " can only be assumed to be free of copyright in " .. PD.license_grammar({"its country", "their countries"}) .. " of origin if " .. PD.license_grammar({"it was", "they were"}) .. " published more than " .. pub_offset .. " years ago (before " .. PD.currentyear - pub_offset .. ")"
	if pubyear then
		text = text .. "—that is, " .. PD.license_grammar({"it", "they"}) .. " cannot be assumed to be free of copyright until " .. pubyear + pub_offset + 1
	end
	text = text .. ". Therefore, " .. PD.license_grammar({"it", "they"}) .. " must be hosted locally at Wikisource. If it can be conclusively demonstrated that ''all'' parts of " .. PD.license_grammar({"this work", "a work"}) .. " are in the public domain in the country of origin, the file should be moved to Commons. Individual parts of " .. PD.license_grammar({"this work", "these works"}) .. " may be in the public domain in the country of origin based on the authorship for that part alone."
	
	return PD.license({
		['image'] = PD.PD_image,
		['image_r'] = PD.US_flag_image,
		['text'] = text,
		['category'] = category or "PD-old-collective"
	})
end


function p.PD_old_collective(frame)
	return p._PD_old_collective(getArgs(frame))
end

return p