Module:PD-US-expired-abroad

--[=[
Implements [[Template:PD-US-expired-abroad]]
]=]

local p = {} --p stands for package

local getArgs = require('Module:Arguments').getArgs
local yesno = require('Module:Yesno')
local PD = require('Module:PD')
local do_not_move_to_commons = require("Module:Do not move to Commons")._do_not_move_to_commons

function p._PD_US_expired_abroad(args)
	local text = "This file is in the '''[[w:public domain|public domain]]''' in the United States because it was first published '''outside the United States''' prior to January 1, " .. PD.PD_US_cutoff .. ". Other jurisdictions have other rules. Also note that this file may not be in the public domain in the [[w:9th Circuit|9th Circuit]] if it was published after July 1, 1909, unless the author is known to have died in " .. PD.currentyear - 71 .. " or earlier (more than 70 years ago) or the work was created in " .. PD.currentyear - 121 .. " or earlier (more than 120 years ago).<sup>[https://www.copyright.cornell.edu/resources/publicdomain.cfm#Footnote_12 &lsqb;1&rsqb;]</sup>"
	local license_template = PD.license({
		['image'] = PD.PD_image,
		['image_r'] = PD.US_flag_image,
		['text'] = text,
		['category'] = args.category or "Images published abroad that are in the public domain in the United States"
	})
	
	local pdsource = yesno(args.pdsource or 'no')
	local commons_template
	if pdsource then
		commons_template = mw.getCurrentFrame():expandTemplate {
			title = "Move to Wikimedia Commons",
			args = {}
		}
	else
		local expiry = args.out_of_copyright_in or args['out of copyright in'] or args[1]
		commons_template = do_not_move_to_commons({expiry = expiry}) .. "<div style='text-align:center; font-size:83%;'>If this file is in the public domain '''in its country of origin''', add <code>|pdsource=yes</code> to this template to hide this warning.</div>"
	end
	
	return license_template .. commons_template
end

function p.PD_US_expired_abroad(frame)
	return p._PD_US_expired_abroad(getArgs(frame))
end

return p