Jump to content

Module:Infobox road

Permanently protected module
From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Happy5214 (talk | contribs) at 08:03, 28 May 2013 (Adding map). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.
(diff) ← Previous revision | Latest revision (diff) | Newer revision → (diff)

local p = {}

function p.map(frame)
    local pframe = frame:getParent()
    local config = frame.args -- the arguments passed BY the template, in the wikitext of the template itself
    local args = pframe.args -- the arguments passed TO the template, in the wikitext that transcludes the template
    
    local map = args.map or ''
    if map ~= '' then return map end
    local entity = mw.wikibase.getEntity() or {}
    local claims = entity.claims or {}
    local mapProp = claims.p15
    if not mapProp then -- no claim of that property
        return ""
    end
    local propValue = mapProp[0].mainsnak.datavalue.value -- This should eventually iterate over all possible values?
    return propValue
end

return p