Module:Map

From Wikipedia

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

local p = {}                                                                                           
                                                                                                       
function p.map(frame)                                                                                  
    local args = frame.args -- the arguments passed TO the template, in the wikitext that transcludes the template
                                                                                                       
    if args.id then
    	entity = mw.wikibase.getEntityObject( args.id )
    else
        entity = mw.wikibase.getEntityObject()                                                   
    end                                                                                                
                                                                                                       
    if entity == nil then                                                                              
        return ''                                                                     
    end                                                                                                
                                                                                                       
    claims = entity.claims or {}                                                                 
    if not claims then                                                                                 
        return ''                                                                             
    end                                                                                                
                                                                                                       
    mapProp = claims.P152                            
    if not mapProp then                                                                                
        return ''                                                                        
    end                                                                                                
                                                                                                       
    return "[[File:" .. mapProp[1].mainsnak.datavalue.value .. "|290px]]"                              
                                                                                                       
end                                                                                                    
                                                                                                       
return p