Module:Infobox/Monument
La documentation pour ce module peut être créée à Module:Infobox/Monument/doc
local building = require "Module:Infobox/Fonctions/Bâtiment"
local general = require "Module:Infobox/Fonctions"
local localdata = require "Module:Infobox/Localdata"
local wd = require "Module:Wikidata"
local formats = {
--{icône carte, icône entete, couleur titre, couleur sous-titre, couleur texte)
-- ne mettre que des icônes de carte répertoriés sur https://www.mediawiki.org/wiki/Help:Extension:Kartographer/Icons
Q1144661 = {'circle-stroked', nil, '#B0C4DE', '#E1E1E1', '#000000', 'defaut'}, -- attraction
Q18761864 = {'bank', nil, '#E1E1E1', '#E1E1E1', '#000000', 'defaut'}, -- bâtiment bancaire
Q655686 = {'shop', nil, '#E1E1E1', '#E1E1E1', '#000000', 'defaut'}, -- bâtiment commercial
Q856584 = {'library', nil, '#E1E1E1', '#E1E1E1', '#000000', 'defaut'}, -- bibliothèque
Q622425 = {'music', nil, '#E1E1E1', '#E1E1E1', '#000000', 'defaut'}, -- boîte de nuit
Q274393 = {'bakery', nil, '#E1E1E1', '#E1E1E1', '#000000', 'defaut'}, -- boulangerie
Q3649129 = {'warehouse', nil, '#E1E1E1', '#E1E1E1', '#000000', 'defaut'}, -- cabane
Q876852 = {'playground', nil, '#E1E1E1', '#E1E1E1', '#000000', 'defaut'}, -- centre de vacances ou de loisirs
Q751876 = {'building', 'chateau', '#00507f', '#ffffff', '#ffffff', 'defaut'}, --château
Q23413 = {'circle-stroked', 'chateau', '#00507f', '#ffffff', '#ffffff', 'defaut'}, --château-fort
Q105731 = {'dam', nil, '#E1E1E1', '#E1E1E1', '#000000', 'defaut'}, -- écluse
Q3914 = {'library', nil, '#E1E1E1', '#E1E1E1', '#000000', 'defaut'}, -- école
Q16970 = {'religious-christian', nil, '#E1E1E1', '#E1E1E1', '#000000', 'defaut'}, -- église
Q67166646 = {'circle-stroked', nil, '#E1E1E1', '#E1E1E1', '#000000', 'defaut'}, -- entrée de grotte
Q1303167 = {'warehouse', nil, '#E1E1E1', '#E1E1E1', '#000000', 'defaut'}, -- grange
Q1777951 = {'ferry', nil, '#E1E1E1', '#E1E1E1', '#000000', 'defaut'}, -- hangar à bateaux
Q1021645 = {'commercial', nil, '#E1E1E1', '#E1E1E1', '#000000', 'defaut'}, -- immeuble de bureaux
Q3947 = {'building', nil, '#E1E1E1', '#E1E1E1', '#000000', 'defaut'}, -- maison
Q37654 = {'shop', nil, '#E1E1E1', '#E1E1E1', '#000000', 'defaut'}, -- marché
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ée
Q170980 = {'monument', nil, '#E1E1E1', '#E1E1E1', '#000000', 'defaut'}, -- obélisque
Q3689421 = {'commercial', nil, '#E1E1E1', '#E1E1E1', '#000000', 'defaut'}, -- office de commercialisation touristique
Q1137809 = {'museum', nil, '#E1E1E1', '#E1E1E1', '#000000', 'defaut'}, -- palais de justice
Q509028 = {'circle-stroked', nil, '#E1E1E1', '#E1E1E1', '#000000', 'defaut'}, -- ranch
Q41253 = {'cinema', nil, '#E1E1E1', '#E1E1E1', '#000000', 'defaut'}, -- salle de cinéma
Q839954 = {'circle-stroked', 'map', '#CCCCAA', '#CCCCAA', '#000000', 'defaut'}, -- site archéologique
Q96102071 = {'zoo', 'map', '#CCCCAA', '#CCCCAA', '#000000', 'defaut'}, -- site d'observation des animaux
Q36728566 = {'police', nil, '#E1E1E1', '#E1E1E1', '#000000', 'defaut'}, -- station de rangers
Q205495 = {'fuel', nil, '#E1E1E1', '#E1E1E1', '#000000', 'defaut'}, -- station-service
Q34627 = {'religious-jewish', nil, '#E1E1E1', '#E1E1E1', '#000000', 'defaut'}, -- synagogue
Q267596 = {'museum', nil, '#E1E1E1', '#E1E1E1', '#000000', 'defaut'}, -- temple grec
Q849706 = {'airport', nil, '#E1E1E1', '#E1E1E1', '#000000', 'defaut'}, -- terminal aéroportuaire
Q27108230 = {'campsite', nil, '#E1E1E1', '#E1E1E1', '#000000', 'defaut'}, -- terrain de camping
Q813966 = {'toilets', nil, '#E1E1E1', '#E1E1E1', '#000000', 'defaut'}, -- toilettes publiques
Q748998 = {'fire-station', nil, '#E1E1E1', '#E1E1E1', '#000000', 'defaut'}, -- tour de guet contre les incendies
Q870 = {'rail', nil, '#E1E1E1', '#E1E1E1', '#000000', 'defaut'}, -- train
Q83405 = {'warehouse', nil, '#E1E1E1', '#E1E1E1', '#000000', 'defaut'}, -- usine
Q208502 = {'rail', nil, '#E1E1E1', '#E1E1E1', '#000000', 'defaut'}, -- véhicule ferroviaire remorqué
Q3024331 = {'religious-christian', 'chateau', '#E00000', '#E00000', '#FFFFFF', 'defaut'}, -- commanderie templière
Q174981 = {'religious-christian', 'chateau', '#000000', '#000000', '#FFFFFF', 'defaut'}, -- commanderie hospitalière
default = {'monument', nil, '#E1E1E1', '#E1E1E1', '#000000', 'defaut'}
}
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 default = formats.default
wtypes = wd.addVals(wtypes or {}, {property = 'P279'}, 1) -- on utilise en plus les sous-classe
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() -- évite les doublons, building.demolition() et building.closure() prennent en compte la propriété P576
if not wd.formatStatements{property = 'P576'} or localdata['fèmti'] or localdata['dat fèmti'] then
return building.closure()
end
end
local function fondation()
if not (localdata['dat konstriksyon'] or localdata['konstriksyon']) then
return {type = 'row', label = 'Fondasyon', value = 'fondasyon', 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 local', nil),
general.logo(),
building.mainimage('Atik pou ilistre Moniman'),
{type = 'table', title = 'Prezantasyon', rows = {
{type = 'row', label = 'Tip', value = 'tip', blockers = {'destinasyon inisyal', 'destinasyon final'}, wikidata = {property = 'P31', defaultlinkquery = 'P279', excludevalues = {'Q41176', 'Q811979' }, showqualifiers = "P580"}},
{type = 'row', label = 'Pati nan', value = 'pati nan', wikidata = {property = 'P361', defaultlinkquery = 'P279', excludevalues = {}, showqualifiers = "P580"}},
{type = 'row', label = 'Ansyen non', value = 'ansyen non'},
{type = 'row', label = 'Ti non', value = 'tinon', 'ti non'},
{type = 'row', label = 'Non konplè', value = 'non konplè'},
{type = 'row', label = 'Kilt', value = 'Kilt'},
{type = 'row', label = 'Sivilizasyon', plurallabel = 'Sivilizasyon yo', value = 'sivilizasyon', wikidata = {property = 'P2596'}},
{type = 'row', label = 'Destinasyon inisyal', value = 'destinasyon inisyal'},
{type = 'row', label = 'Destinasyonon aktyèl', value = 'destinasyon aktyèl'},
{type = 'row', label = 'Ratachman', value = 'ratachman'},
fondation(),
{type = 'row', label = 'Dyosèz', value = 'dyosèz', wikidata = {property = 'P708'}},
{type = 'row', label = 'Pawas', value = 'pawas', wikidata = {property = 'P5607'}},
{type = 'row', label = 'Dedikatè', plurallabel = 'Dedikatè yo', value = 'dedikatè', wikidata = {property = 'P825'}},
{type = 'row', label = 'Komemore', value = 'komemore', wikidata = {property = 'P547'}},
building.orientation(),
{type = 'row', label = 'Peryòd', value = 'peryòd', 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 = 'Kòmanditè', value = 'kòmanditè', wikidata = {property = 'P88'}},
building.dimensions(),
building.recordheld(),
building.religion(),
{type = 'row', label = 'Òd relijye', plurallabel = 'Òd relijye yo', value = 'òd relijye', wikidata = {property = 'P611'}},
{type = 'row', label = 'Okipan', plurallabel = 'Okipan yo', value = 'okipan', wikidata = {property = 'P466', showdate = true}},
building.owner(),
building.usage(),
{type = 'row', label = 'Franchi', wikidata = {property = 'P177'}},
{type = 'row', label = 'Précédent franchissement en amont', wikidata = {property = 'P2673'}},
{type = 'row', label = 'Prochain franchissement en aval', wikidata = {property = 'P2674'}},
{type = 'row', label = 'Permet de faire passer', wikidata = {property = 'P2505'}},
building.operator(),
{type = "row", label = "Direction des fouilles", value = "fouilles", wikidata = {property = "P4345"}},
building.protection(),
{type = 'row', label = '[[Trinomial Smithsonian|Smithsonian]]', value = 'Smithsonian', wikidata = {property = 'P3518'}},
{type = 'row', label = "[[Ofis touris|Enfòmasyon]]", value = "enfòmasyon", wikidata = {property = 'P2872', numval = '3'}},
building.visitors(),
{type = 'row', label = 'Eta konsèvasyon', value = 'eta konsèvasyon', wikidata = {property = 'P5816'}},
building.website('site'),
}
},
building.unesco(),
{type = 'table', title = 'Lokalizasyon', rows = {
building.adminlocation(),
{type = 'row', label = 'Rejyon istorik', value = 'rejyon istorik', wikidata = {property = 'P6885', numval = '1'}},
{type = 'row', label = 'Altitid', value = 'altitid', wikidata = {property = 'P2044', targetunit = 'metre', conjtype = ' ou ', rounding = '0'} },
{type = 'row', label = 'Anplasman', value = 'anplasman', wikidata = {property = 'P706', numval = '1'}},
building.mountainrange(),
building.onshoreof(),
building.watershed(),
building.protectedarea(),
}
},
{type = 'table', title = 'Accès et transport', rows = {
building.transport(),
},
},
{type = 'table', rows = {
building.coordinates(),
}
},
general.geoloc({marker=displayformat[1], default_zoom=13}),
}
}