Mòdul:Infobox/Monument

Un article de Wikipèdia, l'enciclopèdia liura.

La documentacion d'utilizacion d'aquel modul se pòt crear a Mòdul:Infobox/Monument/ús

local building = require "Mòdul:Infobox/Foncions/Bastiment"
local general = require "Mòdul:Infobox/Foncions"
local localdata = require "Mòdul:Infobox/Localdata"
local wd = require "Module:Wikidata"

local formats = {
	--{icòna carta, icòna entèsta, color títol, color sota-títol, color tèxte)
	-- botar pas d'autreis icònas de carta que lei registradas sus https://www.mediawiki.org/wiki/Help:Extension:Kartographer/Icons
	Q1144661 = {'circle-stroked', nil, '#B0C4DE', '#E1E1E1', '#000000', 'defaut'}, -- atraccion
	Q18761864 = {'bank', nil, '#E1E1E1', '#E1E1E1', '#000000', 'defaut'}, -- bastiment de banca
	Q655686 = {'shop', nil, '#E1E1E1', '#E1E1E1', '#000000', 'defaut'}, -- bastiment comerciau
	Q856584 = {'library', nil, '#E1E1E1', '#E1E1E1', '#000000', 'defaut'}, -- bibliotèca
	Q622425 = {'music', nil, '#E1E1E1', '#E1E1E1', '#000000', 'defaut'}, -- discoteca
	Q274393 = {'bakery', nil, '#E1E1E1', '#E1E1E1', '#000000', 'defaut'}, -- fornariá
	Q3649129 = {'warehouse', nil, '#E1E1E1', '#E1E1E1', '#000000', 'defaut'}, -- cabana
	Q876852 = {'playground', nil, '#E1E1E1', '#E1E1E1', '#000000', 'defaut'}, -- cèntre de vacanças/leser
	Q751876 = {'building', 'chateau', '#00507f', '#ffffff', '#ffffff', 'defaut'}, -- castèu
	Q23413 = {'circle-stroked', 'chateau', '#00507f', '#ffffff', '#ffffff', 'defaut'}, -- castelàs
	Q105731 = {'dam', nil, '#E1E1E1', '#E1E1E1', '#000000', 'defaut'}, -- resclausa, restanca
	Q3914 = {'library', nil, '#E1E1E1', '#E1E1E1', '#000000', 'defaut'}, -- escòla
	Q16970 = {'religious-christian', nil, '#E1E1E1', '#E1E1E1', '#000000', 'defaut'}, -- glèisa
	Q67166646 = {'circle-stroked', nil, '#E1E1E1', '#E1E1E1', '#000000', 'defaut'}, -- entrada de cròta
	Q1303167 = {'warehouse', nil, '#E1E1E1', '#E1E1E1', '#000000', 'defaut'}, -- granja
	Q1777951 = {'ferry', nil, '#E1E1E1', '#E1E1E1', '#000000', 'defaut'}, -- envan de batèus
	Q1021645 = {'commercial', nil, '#E1E1E1', '#E1E1E1', '#000000', 'defaut'}, -- ostalàs de burèus
	Q3947 = {'building', nil, '#E1E1E1', '#E1E1E1', '#000000', 'defaut'}, -- ostau
	Q37654 = {'shop', nil, '#E1E1E1', '#E1E1E1', '#000000', 'defaut'}, -- mercat
	Q32815 = {'religious-muslim', nil, '#E1E1E1', '#E1E1E1', '#000000', 'defaut'}, -- minaret
	Q4989906 = {'monument', nil, '#E1E1E1', '#E1E1E1', '#000000', 'defaut'}, -- monument
	Q32815 = {'religious-muslim', nil, '#E1E1E1', '#E1E1E1', '#000000', 'defaut'}, -- mosquèa
	Q170980 = {'monument', nil, '#E1E1E1', '#E1E1E1', '#000000', 'defaut'}, -- obelisc
	Q3689421 = {'commercial', nil, '#E1E1E1', '#E1E1E1', '#000000', 'defaut'}, -- ofici de comercializacion toristica
	Q1137809 = {'museum', nil, '#E1E1E1', '#E1E1E1', '#000000', 'defaut'}, -- palais de justícia
	Q509028 = {'circle-stroked', nil, '#E1E1E1', '#E1E1E1', '#000000', 'defaut'}, -- granja americana
	Q41253 = {'cinema', nil, '#E1E1E1', '#E1E1E1', '#000000', 'defaut'}, -- sala de cinèma
	Q839954 = {'circle-stroked', 'map', '#CCCCAA', '#CCCCAA', '#000000', 'defaut'}, -- site arqueologic
	Q96102071 = {'zoo', 'map', '#CCCCAA', '#CCCCAA', '#000000', 'defaut'}, -- site d'observacion deis animaus
	Q36728566 = {'police', nil, '#E1E1E1', '#E1E1E1', '#000000', 'defaut'}, -- estacion de 'rangers'
	Q205495 = {'fuel', nil, '#E1E1E1', '#E1E1E1', '#000000', 'defaut'}, -- estacion-servici
	Q34627 = {'religious-jewish', nil, '#E1E1E1', '#E1E1E1', '#000000', 'defaut'}, -- sinagòga
	Q267596 = {'museum', nil, '#E1E1E1', '#E1E1E1', '#000000', 'defaut'}, -- temple grèc
	Q849706 = {'airport', nil, '#E1E1E1', '#E1E1E1', '#000000', 'defaut'}, -- terminau d'aeropòrt
	Q27108230 = {'campsite', nil, '#E1E1E1', '#E1E1E1', '#000000', 'defaut'}, -- terrenh de campatge
	Q813966 = {'toilets', nil, '#E1E1E1', '#E1E1E1', '#000000', 'defaut'}, -- privats publics
	Q748998 = {'fire-station', nil, '#E1E1E1', '#E1E1E1', '#000000', 'defaut'}, -- torre d'agacha còntra leis incèndis
	Q870 = {'rail', nil, '#E1E1E1', '#E1E1E1', '#000000', 'defaut'}, -- trin
	Q83405 = {'warehouse', nil, '#E1E1E1', '#E1E1E1', '#000000', 'defaut'}, -- fabrica
	Q208502 = {'rail', nil, '#E1E1E1', '#E1E1E1', '#000000', 'defaut'}, -- veïcule ferroviari remoucat
	Q3024331 = {'religious-christian', 'chateau', '#E00000', '#E00000', '#FFFFFF', 'defaut'}, -- comandariá templiera
	Q174981 = {'religious-christian', 'chateau', '#000000', '#000000', '#FFFFFF', 'defaut'}, -- comandariá espitaliera
	default = {'monument', nil, '#E1E1E1', '#E1E1E1', '#000000', 'defaut'}
}

local function wdformat() -- retòrna una taula amb la color maja de l'infobòx e l'icòna de títol
	local wtypes = wd.stringTable{ -- recobra lei Qid dei professions
		entity = localdata.item,
		property = 'P31',
		displayformat = 'raw',
		excludespecial = true
	}
	local default = formats.default
	wtypes = wd.addVals(wtypes or {}, {property = 'P279'}, 1) -- se servèm en mai d'aquò dei sota-classas
	for i, item in pairs(wtypes or {}) do
		if formats[item] then
			return formats[item]
		end
	end
	return default
end
local function setcharte()
	local charte = localdata['charte']
	if charte then
		for i, j in pairs(formats) do
			if j[2] == charte then
				return j
			end
		end
	end
	return wdformat()
end
local function closure() -- evita lei doblons, building.demolition() e building.closure() prènon en còmpte la proprietat P576
	if not wd.formatStatements{property = 'P576'} or localdata['barradura'] or localdata['data de barradura'] then
		return building.closure()
	end
end

local function fondation()
	if not (localdata['date de construccion'] or localdata['construccion']) then
		return {type = 'row', label = 'Fondacion', value = 'fondacion', wikidata = {property = 'P571'}}
	else
		return building.fondation()
	end
end

local displayformat = setcharte()

return 
	{
	maincolor = displayformat[3],
	secondcolor = displayformat[4],
	thirdcolor = displayformat[5],
	parts =
    	{
			general.title(displayformat[2], nil, 'nom locau', nil),
			general.logo(),
			building.mainimage('Article d’illustrar Monument'),
			{type = 'table', title = 'Presentacion', rows = {
				{type = 'row', label = 'Tipe', value = 'type', blockers = {'destinacion iniciala', 'destinacion finala'},
					wikidata = {property = 'P31', defaultlinkquery = 'P279', showqualifiers = "P580",
						excludevalues = {'Q41176', 'Q811979', 'Q13226383','Q3395377','Q19860854'}
					} --non mostrats : "bastiment", "estructura architecturala", "equipament", "monument ancian", "bastiment o estructura desmolida"
				},
			{type = 'row', label = 'Partida de', value = 'partida de',
					wikidata = {property = 'P361', defaultlinkquery = 'P279', showqualifiers = "P580"}
				},
				{type = 'row', label = 'Noms d’avans', value = 'noms d’avans'},
				{type = 'row', label = 'Escais-nom(s)', value = 'escais-nom'},
				{type = 'row', label = 'Nom complèt', value = 'nom complèt'},
				{type = 'row', label = 'Culte', value = 'culte'},
				{type = 'row', label = 'Civilizacion', plurallabel = 'Civilizacions', value = 'civilization', wikidata = {property = 'P2596'}},
				{type = 'row', label = 'Destinacion d’origina', value = 'destinacion d’origina'},
				{type = 'row', label = 'Destination d’ara', value = 'destination d’ara'},
				{type = 'row', label = 'Restacament', value = 'restacament'},
				fondation(),
				{type = 'row', label = 'Diocèsi', value = 'diocèsi', wikidata = {property = 'P708'}},
				{type = 'row', label = 'Parròquia', value = 'parròquia', wikidata = {property = 'P5607'}},
				{type = 'row', label = 'Dedicatari', plurallabel = 'Dedicataris', value = 'dedicatari', wikidata = {property = 'P825'}},
				{type = 'row', label = 'Commemòra', value = 'commemòra', wikidata = {property = 'P547'}},
				{type = 'row', label = 'Promòu', value = 'promòu', wikidata = {property = 'P6291'}},
				building.orientation(),
				{type = 'row', label = 'Periòde', value = 'periòde', wikidata = {property = 'P2348'}},
				building.archistyle(),
				building.creator(),
				building.material(),
				building.cornerstonelaying(),
				building.construction(),
				building.opening(),
				building.reconstruction(),
				building.relocation(),
				building.renovation(),
				closure(),
				building.demolition(),
				{type = 'row', label = 'Comanditari', value = 'comanditari', wikidata = {property = 'P88'}},
				building.dimensions(),
				building.recordheld(),
				building.religion(),
				{type = 'row', label = 'Òrdre religiós', plurallabel = 'Òrdres religiós', value = 'òrdre religiós', wikidata = {property = 'P611'}},
				{type = 'row', label = 'Ocupant', plurallabel = 'Ocupants', value = 'ocupant', wikidata = {property = 'P466', showdate = true}},
				building.owner(),
				building.usage(),
				{type = 'row', label = 'Passa', wikidata = {property = 'P177'}},
				{type = 'row', label = 'Trespassament amont', wikidata = {property = 'P2673'}},
				{type = 'row', label = 'Trespassament avau', wikidata = {property = 'P2674'}},
				{type = 'row', label = 'Permèt de faire passar', wikidata = {property = 'P2505'}},
				building.operator(),
				{type = "row",
					label = {ms = 'Baile dei cavaments', fs = 'Bailessa dei cavaments',
						mp = 'Bailes dei cavaments', fp = 'Bailessas dei cavaments',
						default = 'Bailitge dei cavaments'
					},
					value = "cavaments",
					wikidata = {property = "P4345", showdate = true, stilltrue = false}
				},
				building.protection(),
				{type = 'row', label = '[[Trinomiau Smithsonian|Smithsonian]]', value = 'Smithsonian', wikidata = {property = 'P3518'}},
				{type = 'row', label = "[[Ofici de torisme|Informacions]]", value = "informacions", wikidata = {property = 'P2872', numval = '3'}},
				building.visitors(),
				{type = 'row', label = 'Estat de conservacion', value = 'estat de conservacion', wikidata = {property = 'P5816', ucfirst = '-'}},
				{type = 'row', label = 'Remplaça', value = 'remplaça', wikidata = {property = {'P1398','P1365'}}},
				{type = 'row', label = 'Remplaçat per', value = 'remplaçat per', wikidata = {property = {'P167','P1366'}, showdate = true}},
				building.website('site'),
				}
			},
				building.unesco(),
			{type = 'table', title = 'Localizacion', rows = {
				building.adminlocation(),
				{type = 'row', label = 'Region istorica', value = 'region istorica', wikidata = {property = 'P6885', numval = '1'}},
				{type = 'row', label = 'Altitud', value = 'altitud',
					wikidata = {property = 'P2044', targetunit = 'mètre', conjtype = ' o ', rounding = '0'}
				},
				{type = 'row', label = 'Posicion', value = 'posicion', wikidata = {property = 'P706', numval = '1'}},
				building.mountainrange(),
				building.onshoreof(),
				building.watershed(),
				building.protectedarea(),
				}
			},
			{type = 'table', title = 'Accès e transpòrt', rows = {
				building.transport(),
				},
			},
			{type = 'table', rows = {
				building.coordinates(),
				}
			},
			general.geoloc({marker=displayformat[1], default_zoom=13}),
	}
}