Module:PD-nonIsrael

From Wikisource
Jump to navigation Jump to search

--[=[
Implements [[Template:PD-nonIsrael]]
]=]

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_nonIsrael(args)
	local deathyear = tonumber(args[1] or args.deathyear)
	local pubyear = tonumber(args[2] or args.pubyear)
	
	local text = ""
	if pubyear then
		text = license_scope({past = true}) .. " published in " .. pubyear
	end
	if deathyear then
		if pubyear then
			text = text .. " and the author"
		else
			text = "The author of this work"
		end
		text = text .. " died " .. PD.currentyear - deathyear - 1 .. " years ago"
	end
	if pubyear or deathyear then
		text = text .. ". "
	end
	text = text .. license_grammar({"This work is", "These works are"}) .. " in the '''[[w:public domain|public domain]]''' in some countries and areas outside Israel, '''including the United States'''.\n----\nHowever, owing to the subsistence of certain long-standing '''restrictions on publication and distribution''', the work is ''' - or restriction-free in Israel.''' Potential re-users of this content are advised to check carefully if any restrictions would apply to their intended reuse."
	
	return PD.license({
		['image'] = 'SemiPD-icon.svg',
		['image_r'] = 'No Israel.svg',
		['text'] = text,
		['category'] = args.category or "PD-nonIsrael"
	})
end

function p.PD_nonIsrael(frame)
	return p._PD_nonIsrael(getArgs(frame))
end

return p