Module:PD-old-US
Appearance
This module depends on the following other modules: |
Implements {{PD-old-US}}.
--[=[
Implements [[Template:PD-old-US]]
]=]
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_US(args)
local deathyear = PD.getAuthorDeathYear({args[1], args.deathyear})
local pubyear = PD.getPublicationYear({args[2], args.pubyear})
local film = args.film
local template = "PD-old-US"
-- Is it correct to use this license?
if pubyear and pubyear <= PD.PD_US_cutoff then
return require('Module:PD-US')._PD_US({['deathyear'] = deathyear, ['category'] = args.category, ['film'] = film})
end
if pubyear and pubyear <= 2003 then
return PD.error_text(template .. " does not apply to works published before 2003.", template)
end
if deathyear and PD.currentyear - deathyear <= 70 then
return PD.error_text(template .. " does not apply to works whose authors died after " .. PD.currentyear - 71 .. ".", template)
end
--[=[
assume 2002 < pubyear
require deathyear < currentyear - 70
work is posthumous only when deathyear <= pubyear
work must be posthumous when:
* deathyear < pubyear
* deathyear <= 2002 < pubyear
* deathyear < currentyear - 70 <= 2002 < pubyear
works using this license will all be posthumous until 2073
]=]
local posthumous = yesno(args.posthumous) == true or (deathyear and pubyear and deathyear < pubyear) or (deathyear and deathyear <= 2002) or PD.currentyear - 70 <= 2002
local death_years_ago
if deathyear then
death_years_ago = PD.currentyear - deathyear
else
death_years_ago = "more than 70"
end
local text = "<p>" .. PD.license_scope() .. " from the United States and in the '''[[w:public domain|public domain]]''' because " .. PD.license_grammar({"it was", "they were"}) .. " not ''[[United States Code/Title 17/Chapter 1/Section 101#publication|legally published]]'' with the permission of the copyright holder before January 1, 2003 and the author died " .. death_years_ago .. " years ago."
if posthumous then
text = text .. " " .. PD.license_grammar({" This is a '''posthumous work''' and its copyright", " These are '''posthumous works''' and their copyrights"}) .. " in certain countries and areas may depend on years since [[w:List of countries' copyright length|posthumous publication]], rather than years since the author's death."
end
text = text .. " Translations or editions published later may be copyrighted.</p>" .. PD.shorter_term_text(deathyear, film)
return PD.license({
['image'] = PD.PD_image,
['image_r'] = PD.US_flag_image,
['text'] = text,
['category'] = args.category or template
})
end
function p.PD_old_US(frame)
return p._PD_old_US(getArgs(frame))
end
return p