Jump to content

This is a test of release of MediaWiki 1.44.0-wmf.6 (d77bde6). Please report issues you encounter.

Module:Map

Unchecked
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