Documentation icon Τεκμηρίωση module[δημιουργία]
local building = require "Module:Infobox/Fonctions/Bâtiment"
local general = require "Module:Infobox/Fonctions"
local localdata = require "Module:Infobox/Localdata"
local wd = require "Module:Interface Wikidata".fromLua

local formats = {
	--{valeur wikidata, icône, couleur titre, couleur sous-titre, couleur texte)
        {'Q751876', 'entete chateau','#00507f', '#ffffff', '#000000', 'defaut'}, --château
}

local function wdformat() --retourne une table contenant la couleur principale de l'infobox et l'icône de titre
	local wtypes = wd.stringTable{ -- récupère les Qid des professions
		entity = localdata.item,
		property = 'P31',
		displayformat = 'raw',
		excludespecial = true
	}
	local defaultformat = {'Q', '', '#E1E1E1', '#E1E1E1', '#000000', 'defaut'}
	if not wtypes or (#wtypes > 1) then -- si plusieurs occupations, on ne sait pas laquelle choisir
		return defaultformat 
	end
	wtypes = wd.addVals(wtypes, {property = 'P279'}, 2) -- nombre d'étages de sous-classes à remonter
	for i, j in pairs(wtypes) do
		for k, l in pairs(formats) do
			if l[1] == j then
				return l
			end
		end
	end
	return defaultformat
end
local function setcharte()
	if localdata['charte'] then
		charte = localdata['charte']
		for i, j in pairs(formats) do
			if j[2] == charte then
				return j
			end
		end
	end
	return wdformat()
end

local displayfrmat = setcharte()

return 
	{
	maincolor = displayfrmat[3],
	secondcolor = displayfrmat[4],
	thirdcolor = displayfrmat[5],
	parts =
    	{
			general.title(displayfrmat[2], nil, 'native name', nil),
			general.logo(),
			building.mainimage(),
			{type = 'table', title = 'Πληροφορίες', rows = {
				{type = 'row', label = 'Προηγούμενες ονομασίες', value = 'προηγούμενες ονομασίες'},
				{type = 'row', label = 'Ψευδώνυμο', value = 'ψευδώνυμο'},
				{type = 'row', label = 'Πλήρης Ονομασία', value = 'πλήρης ονομασία'},
				{type = 'row', label = 'Θρήσκευμα', value = 'θρήσκευμα'},
				{type = 'row', label = 'Τύπος', value = 'τύπος', property = 'P31'},
				{type = 'row', label = 'Υπαγωγή', value = 'υπαγωγή'},
				building.archistyle(),
				building.creator(),
				building.material(),
				building.construction(),
				building.opening(),
				building.renovation(),
				building.demolition(),
				{type = 'row', label = 'Εντολέας', value = 'εντολέας', property = 'P88'},
				{type = 'row', label = 'Ύψος', value = 'ύψος', wikidata = {property = 'P2048', targetunit = 'μ.'}},
				{type = 'row', label = 'Πλάτος', value = 'πλάτος', wikidata = {property = 'P2049', targetunit = 'μ.'}},
				{type = 'row', label = 'Μήκος', value = 'μήκος', wikidata = {property = 'P2043', targetunit = 'μ.'}},
				{type = 'row', label = 'Εκτόπισμα', value = 'εκτόπισμα', wikidata = {property = 'P2050', targetunit = 'μ.'}},
				{type = 'row', label = 'Αρχική χρήση', value = 'αρχική χρήση'},
				{type = 'row', label = 'Σημερινή χρήση', value = 'σημερινή χρήση'},
				building.owner(),
				building.operator(),
				building.protection(),
				building.website(),
				}
			},
			{type = 'table', title = 'Γεωγραφία', rows = {	
				building.country(),
				building.historicalregion(),
				building.adminlocation(),
				}
			},
			{type = 'table', title = 'Πρόσβαση και συγκοινωνίες', rows = {
				building.transport(),
				},
			},
			{type = 'table', title = 'Τοποθεσία', rows = {
				building.coordinates(),
				}
			},
			general.geoloc({marker='monument', default_zoom=16}),
	}
}