Module:Infobox/Monument : Différence entre versions
(retrait de l'îcône de titre, qui décentre le texte (?!)) |
(affichage de "partie concernée" pour l'architecte, affichage de la protection du monument avec icône.) |
||
Ligne 2 : | Ligne 2 : | ||
local general = require "Module:Infobox/Fonctions" | local general = require "Module:Infobox/Fonctions" | ||
local wikidata = require "Module:Wikidata" | local wikidata = require "Module:Wikidata" | ||
+ | local logos = require('Module:Logos classement') | ||
+ | |||
+ | local function protectionline(localdata, item) | ||
+ | local claims = wikidata.getClaims({item=item, property = 'P1435', exludespecial = true}) | ||
+ | if not claims then return nil end | ||
+ | for i, j in pairs(claims) do | ||
+ | local val = wikidata.getmainid(j) | ||
+ | local logo = logos[val] | ||
+ | logostr = '' | ||
+ | if logo then | ||
+ | logostr = '[[File:' .. logo .. '|x18px]] ' | ||
+ | end | ||
+ | claims[i] = logostr .. wikidata.formatEntity(val, {}) | ||
+ | end | ||
+ | return table.concat(claims, '<br />') | ||
+ | end | ||
+ | |||
+ | |||
return | return | ||
{ | { | ||
Ligne 17 : | Ligne 35 : | ||
{type = 'mixed', label = 'Période ou style', value = 'style', property = 'P149'}, | {type = 'mixed', label = 'Période ou style', value = 'style', property = 'P149'}, | ||
{type = 'mixed', label = 'Type', value = 'type'}, -- property = 'P31' ? | {type = 'mixed', label = 'Type', value = 'type'}, -- property = 'P31' ? | ||
− | {type = 'mixed', label = function(localdata, item) return localdata['titre architecte'] or 'Architecte' end, value = 'architecte', property = 'P84'}, | + | {type = 'mixed', label = function(localdata, item) return localdata['titre architecte'] or 'Architecte' end, value = 'architecte', |
+ | wikidata = wikidata.formatStatements{item = item, property = 'P84', showqualifiers = 'P518'} | ||
+ | }, | ||
{type = 'mixed', label = 'Date de construction', value = 'date de construction', | {type = 'mixed', label = 'Date de construction', value = 'date de construction', | ||
wikidata = wikidata.getTheDate{property = 'P793', targetvalue = 'Q385378', addcat = true} | wikidata = wikidata.getTheDate{property = 'P793', targetvalue = 'Q385378', addcat = true} | ||
}, | }, | ||
− | {type = 'mixed', label = 'Commanditaire', value = ' | + | {type = 'mixed', label = 'Commanditaire', value = 'commanditaire', property = 'P88'}, |
{type = 'mixed', label = 'Dimensions', value = 'hauteur'}, | {type = 'mixed', label = 'Dimensions', value = 'hauteur'}, | ||
{type = 'mixed', label = 'Destination initiale', value = 'destination initiale'}, | {type = 'mixed', label = 'Destination initiale', value = 'destination initiale'}, | ||
Ligne 28 : | Ligne 48 : | ||
{type = 'mixed', label = 'Date de démolition', value = 'date de démolition', | {type = 'mixed', label = 'Date de démolition', value = 'date de démolition', | ||
wikidata = wikidata.getTheDate{property = 'P793', targetvalue = 'Q331483', addcat = true} | wikidata = wikidata.getTheDate{property = 'P793', targetvalue = 'Q331483', addcat = true} | ||
+ | }, | ||
+ | {type = 'mixed', label = 'Protection', value = 'classement', | ||
+ | wikidata = protectionline(localdata, item) | ||
+ | |||
}, | }, | ||
building.website(), | building.website(), |
Version du 26 décembre 2014 à 19:54
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 wikidata = require "Module:Wikidata" local logos = require('Module:Logos classement') local function protectionline(localdata, item) local claims = wikidata.getClaims({item=item, property = 'P1435', exludespecial = true}) if not claims then return nil end for i, j in pairs(claims) do local val = wikidata.getmainid(j) local logo = logos[val] logostr = '' if logo then logostr = '[[File:' .. logo .. '|x18px]] ' end claims[i] = logostr .. wikidata.formatEntity(val, {}) end return table.concat(claims, '<br />') end return { maincolor = '#E6E3CF', parts = { general.title(), general.logo(), building.mainimage(), {type = 'table', title = 'Présentation', rows = { {type = 'mixed', label = 'Nom local', value = 'nom local'}, {type = 'mixed', label = 'Noms précédents', value = 'noms précédents'}, {type = 'mixed', label = 'Surnom(s)', value = 'surnom'}, {type = 'mixed', label = 'Nom complet', value = 'nom complet'}, {type = 'mixed', label = 'Période ou style', value = 'style', property = 'P149'}, {type = 'mixed', label = 'Type', value = 'type'}, -- property = 'P31' ? {type = 'mixed', label = function(localdata, item) return localdata['titre architecte'] or 'Architecte' end, value = 'architecte', wikidata = wikidata.formatStatements{item = item, property = 'P84', showqualifiers = 'P518'} }, {type = 'mixed', label = 'Date de construction', value = 'date de construction', wikidata = wikidata.getTheDate{property = 'P793', targetvalue = 'Q385378', addcat = true} }, {type = 'mixed', label = 'Commanditaire', value = 'commanditaire', property = 'P88'}, {type = 'mixed', label = 'Dimensions', value = 'hauteur'}, {type = 'mixed', label = 'Destination initiale', value = 'destination initiale'}, {type = 'mixed', label = 'Propriétaire', value = 'propriétaire', property = 'P127'}, {type = 'mixed', label = 'Destination actuelle', value = 'destination actuelle'}, {type = 'mixed', label = 'Date de démolition', value = 'date de démolition', wikidata = wikidata.getTheDate{property = 'P793', targetvalue = 'Q331483', addcat = true} }, {type = 'mixed', label = 'Protection', value = 'classement', wikidata = protectionline(localdata, item) }, building.website(), } }, {type = 'table', title = 'Géographie', rows = { building.country(), {type = 'mixed', label = 'Région', value = 'région'}, {type = 'mixed', label = function(localdata, item) return localdata['intitulé subdivision'] or 'Subdivision administrative' end, value = 'subdivision'}, {type = 'mixed', label = function(localdata, item) return localdata['intitulé subdivision2'] or 'Subdivision administrative' end, value = 'subdivision2'}, {type = 'mixed', label = function(localdata, item) return localdata['intitulé commune'] or 'Commune' end, value = 'commune'}, building.address() } }, {type = 'table', title = 'Accès et transport', rows = { {type = 'mixed', label = 'Stationnement', value = 'stationnement'}, {type = 'mixed', label = 'Gare', value = 'gare'}, {type = 'mixed', label = 'Métro', value = 'métro'}, {type = 'mixed', label = 'Tramway', value = 'bus'}, {type = 'mixed', label = 'Autobus', value = 'gare'}, }, }, {type = 'table', title = 'Localisation', rows = { building.coordinates(), } }, building.geoloc(), } }