Module:Sandbox/Aude/NRHP

From English Wikipedia @ Freddythechick

This is the current revision of this page, as edited by imported>Aude at 11:23, 22 June 2016 (test). The present address (URL) is a permanent link to this version.

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
local p = {}

local function makeNRHPReferenceLink( number )
	return '[http://focus.nps.gov/AssetDetail/NRIS/' .. number .. ' ' .. 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