Module:PD-anon-US/sandbox
Appearance
This is the module sandbox page for Module:PD-anon-US (diff). |
This module depends on the following other modules: |
Implements {{PD-anon-US}}.
--[=[
Implements [[Template:PD-anon-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_anon_US(args)
local pubyear = PD.getPublicationYear({args[1], args.pubyear})
local category = args.category
local template = "PD-anon-US"
-- Is this template appropriate?
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
local published_in
local protection_term
if pubyear then
published_in = "in " .. pubyear
protection_term = PD.currentyear - (pubyear + 1)
else
published_in = "before January 1, " .. PD.PD_US_cutoff
protection_term = PD.currentyear - PD.PD_US_cutoff
end
local text = license_scope({past = true}) .. " published " .. published_in .. " and " .. license_grammar({"is", "are"}) .. " anonymous or pseudonymous due to unknown authorship. " .. license_grammar({"It is", "They are"}) .. " in the '''[[w:public domain|public domain]]''' in the United States as well as countries and areas where the [[w:List of countries' copyright length based on publication and creation dates|copyright terms of anonymous or pseudonymous works]] are '''" .. protection_term .. " years or less since publication'''."
return PD.license({
['image'] = PD.PD_image,
['image_r'] = PD.US_flag_image,
['text'] = text,
['category'] = category or template
})
end
function p.PD_anon_US(frame)
return p._PD_anon_US(getArgs(frame))
end
return p