Jump to content

Module:Infobox road

From Simple English Wikipedia, the free encyclopedia
Revision as of 12:05, 25 May 2013 by Happy5214 (talk | changes) (Maybe lowercase)

Documentation for this module may be created at Module:Infobox road/doc

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
    if map and map ~= '' then return map end
    local entity = mw.wikibase.getEntity()
    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