Module:Sandbox/Aude/NRHP

This is an old revision of this page, as edited by Aude (talk | contribs) at 10:21, 22 June 2016 (test). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.
local p = {}

local function makeNRHPReferenceLink( number )
	return 'http://focus.nps.gov/AssetDetail/NRIS' .. number
end

function p.getNRHPReference(frame)
	local entity = mw.wikibase.getEntity()
	
	if entity then
		local claims = entity['claims']['P649']
		
		for idx in pairs(claims) do
			local snak = claims[idx].mainsnak;
			return makeNRHPReferenceLink( mw.wikibase.renderSnak( snak ) )
		end
	end
	
	return 'no entity'
end

return p