Moduuli:Fr:Infobox/Valtiolaatikko-esimerkki


local building = require "Module:Fr:Infobox/Fonctions/Bâtiment"
local general = require "Module:Fr:Infobox/Fonctions"
local population =require "Module:Fr:Infobox/Fonctions/asukasluku"
local localdata = require 'Module:Fr:Infobox/Localdata'
local wikidata = require "Module:Fr:Wikidata"

-- 'P2884,P2853'
local function electricity()
	local paste_list = {}
	local claims = wikidata.getClaims({entity = localdata.item, property = 'P2884'})
	if claims then
		for claim_key, claim_value in pairs(claims) do
			local statement = wikidata.formatStatement(claim_value, {showqualifiers='P2144', defaultlink='-'})
			table.insert(paste_list, statement)
		end
	end
	local claims = wikidata.getClaims({entity = localdata.item, property = 'P2853'})
	if claims then
		for claim_key, claim_value in pairs(claims) do
			local statement = wikidata.formatStatement(claim_value, {defaultlink='-'})
			table.insert(paste_list, statement)
		end
	end	
	if #paste_list > 0 then
			return mw.text.listToText(paste_list, ", ", ", ")
	end
	return false
end

return 
	{
	maincolor = '#A8D2FF',
	parts =
    	{
			general.title( "entete map"),
			general.mainimage{ 
				cat = "Subdivision administrative illustrée par defaut.svg", 
				defaultimage = "Defaut 2.svg", 
				wikidata = {property = {"P2716", "P18"}, numval = 1} 
			},
			{
				type = 'images',
				imageparameters =  {'flag'},
				wikidata = {property = {'P41'}},
				numval = 1,
				defaultupright = '0.3'
			},	
			{type = "table", title="Yleistiedot", rows = {
				{type = "row", label = "Pääkaupunki", value = "capital", wikidata = { property = "P36", defaultlink='red' } },
				{type = 'row', label = 'Valtiomuoto', value = "government", wikidata = { property = 'P122', defaultlink='-' } },
				{type = 'row', label = 'Valuutta', plurallabel = 'Valuutat', value = "currency", wikidata = { property = 'P38', defaultlink='-'} },
				{type = "row", label = "Pinta-ala", value = "area", wikidata = {property = "P2046", targetunit = "km2", rank="best", numval=1, defaultlink='-'} },
				{type = 'row', label = 'Väkiluku', value = "population",wikidata = {property = 'P1082', rank="best", numval=1, showdate=true, precision='year', linktopic='-'} },
				{type = 'row', label = 'Kieli', plurallabel = 'Kielet', value = "language", wikidata = { property = 'P37', defaultlink='-', ucfirst='-'} },
				{type = 'row', label = 'Uskonto', plurallabel = 'Uskonnot', value = "religion", wikidata = { property = 'P3075', defaultlink='-'} },
				{type = 'row', label = 'Sähkö', value = "electricity", wikidata = function () return electricity() end },
				{type = 'row', label = 'Suuntanumero', plurallabel = 'Suuntanumerot', value = "callingcode",  property = 'P474', defaultlink='-'},
				{type = 'row', label = 'Hätänumero', plurallabel = 'Hätänumerot', value = 'emergencies', wikidata = { property = 'P2852', showqualifiers = 'P366', link='-'} },
				{type = 'row', label = 'Verkkotunnus', value = "tld", wikidata = { property = 'P78', link='-'} },
				{type = 'row', label = 'Aikavyöhyke ', value = "timezone", wikidata = { property = 'P421', showqualifiers ='P1264', qualifier='P1264', conjtype='new line', link='-', defaultlink='-'}},
				{type = 'row', label = 'Liikenne', value = "driving side", wikidata = { property = 'P1622', defaultlink='-', ucfirst='-'} },
				{type = 'row', label = 'WWW-sivut ', value = "www",  property = 'P856', ucfirst='-' },
				}
			},
			building.geoloc({marker = 'village', geomasktype="geomask"}),
			{
				type = 'images',
				imageparameters =  {'locationmap'},
				wikidata = {property = 'P242',  qualifier='P195' },
				numval = 1,
				defaultupright = '1.25'
			},			
		}
}