Module:Infobox/Monument
Aller à la navigation
Aller à la recherche
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['fermeture'] or localdata['date de fermeture'] then return building.closure() end end local function fondation() if not (localdata['date de construction'] or localdata['construction']) then return {type = 'row', label = 'Fondation', value = 'fondation', 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('Article à illustrer Monument'), {type = 'table', title = 'Présentation', rows = { {type = 'row', label = 'Type', value = 'type', blockers = {'destination initiale', 'destination finale'}, wikidata = {property = 'P31', defaultlinkquery = 'P279', showqualifiers = "P580", excludevalues = {'Q41176', 'Q811979', 'Q13226383','Q3395377','Q19860854','Q570116'} } --non affichés : "bâtiment", "structure architecturale", "équipement", "monument ancien", "bâtiment ou structure détruit", "attraction touristique" }, {type = 'row', label = 'Partie de', value = 'partie de', wikidata = {property = 'P361', defaultlinkquery = 'P279', showqualifiers = "P580"} }, {type = 'row', label = 'Noms précédents', value = 'noms précédents'}, {type = 'row', label = 'Surnom(s)', value = 'surnom'}, {type = 'row', label = 'Nom complet', value = 'nom complet'}, {type = 'row', label = 'Culte', value = 'culte'}, {type = 'row', label = 'Civilisation', plurallabel = 'Civilisations', value = 'civilisation', wikidata = {property = 'P2596'}}, {type = 'row', label = 'Destination initiale', value = 'destination initiale'}, {type = 'row', label = 'Destination actuelle', value = 'destination actuelle'}, {type = 'row', label = 'Rattachement', value = 'rattachement'}, fondation(), {type = 'row', label = 'Diocèse', value = 'diocèse', wikidata = {property = 'P708'}}, {type = 'row', label = 'Paroisse', value = 'paroisse', wikidata = {property = 'P5607'}}, {type = 'row', label = 'Dédicataire', plurallabel = 'Dédicataires', value = 'dédicataire', wikidata = {property = 'P825'}}, {type = 'row', label = 'Commémore', value = 'commémore', wikidata = {property = 'P547'}}, {type = 'row', label = 'Promeut', value = 'promeut', wikidata = {property = 'P6291'}}, building.orientation(), {type = 'row', label = 'Période', value = 'période', 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 = 'Commanditaire', value = 'commanditaire', wikidata = {property = 'P88'}}, building.dimensions(), building.recordheld(), building.religion(), {type = 'row', label = 'Ordre religieux', plurallabel = 'Ordres religieux', value = 'ordre religieux', wikidata = {property = 'P611'}}, {type = 'row', label = 'Occupant', plurallabel = 'Occupants', value = 'occupant', wikidata = {property = 'P466', showdate = true}}, building.owner(), building.usage(), {type = 'row', label = 'Franchit', 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 = {ms = 'Directeur des fouilles', fs = 'Directrice des fouilles', mp = 'Directeurs des fouilles', fp = 'Directrices des fouilles', default = 'Direction des fouilles' }, value = "fouilles", wikidata = {property = "P4345", showdate = true, stilltrue = false} }, building.protection(), {type = 'row', label = '[[Trinomial Smithsonian|Smithsonian]]', value = 'Smithsonian', wikidata = {property = 'P3518'}}, {type = 'row', label = "[[Office de tourisme|Informations]]", value = "informations", wikidata = {property = 'P2872', numval = '3'}}, building.visitors(), {type = 'row', label = 'État de conservation', value = 'état de conservation', wikidata = {property = 'P5816', ucfirst = '-'}}, {type = 'row', label = 'Remplace', value = 'remplace', wikidata = {property = {'P1398','P1365'}}}, {type = 'row', label = 'Remplacé par', value = 'remplacé par', wikidata = {property = {'P167','P1366'}, showdate = true}}, building.website('site'), } }, building.unesco(), {type = 'table', title = 'Localisation', rows = { building.adminlocation(), {type = 'row', label = 'Région historique', value = 'région historique', wikidata = {property = 'P6885', numval = '1'}}, {type = 'row', label = 'Altitude', value = 'altitude', wikidata = {property = 'P2044', targetunit = 'metre', conjtype = ' ou ', rounding = '0'} }, {type = 'row', label = 'Emplacement', value = 'emplacement', 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}), } }