پودمان:PD-US
ظاهر
Implements {{PD-US}}.
--[=[
Implements [[Template:PD-US]]
]=]
local p = {} --p stands for package
local getArgs = require('Module:Arguments').getArgs
local PD = require('Module:PD')
local license_scope = require('Module:License_scope')._license_scope
local license_grammar = require('Module:License_scope')._license_grammar
function p._PD_US(args)
local deathyear = tonumber(args[1] or args.deathyear)
local pubyear = tonumber(args[2] or args.pubyear)
local film = args.film
local category = args.category
local template = "PD-US"
-- Is this work after the cutoff date?
if pubyear and pubyear >= PD.PD_US_cutoff then
return PD.error_text(template .. " does not apply to works published after " .. PD.PD_US_cutoff - 1 .. ".", template)
end
-- Should we use PD-old?
if deathyear and PD.currentyear - deathyear > 100 then
return require('Module:PD-old')._PD_old({['category'] = category})
end
local published_info
if pubyear then
published_info = "in " .. pubyear .. ", before the cutoff of January 1, " .. PD.PD_US_cutoff
else
published_info = "before January 1, " .. PD.PD_US_cutoff
end
local text = license_scope() .. " in the '''[[w:public domain|public domain]]''' in the '''United States''' because " .. license_grammar({"it was", "they were"}) .. " published " .. published_info .. "." .. PD.shorter_term_text(deathyear, film)
return PD.license({
['image'] = PD.PD_image,
['image_r'] = PD.US_flag_image,
['text'] = text,
['category'] = category or PD.category_with_deathyear_floor("PD", deathyear) .. "-US"
})
end
function p.PD_US(frame)
return p._PD_US(getArgs(frame))
end
return p