Module:Infobox/Fonctions

De Lagny-sur-Marne Wiki
Aller à : navigation, rechercher

La documentation pour ce module peut être créée à Module:Infobox/Fonctions/doc

-- Fonctions communes à diverses infobox
local wikidata = require('Module:Wikidata')
local d = require('Module:Wikidata/Dates')

local p = {}

function p.title()
	return {
			type = 'title',
			value = function(localdata, item) return localdata['nom'] or wikidata._getLabel(item) or mw.title.getCurrentTitle().text end,
			subtitle = 'nom local',
			class = class, 
	}
end

function p.mainimage(cat)
	return {
		type = 'images',
		imageparameters =  {'image'},
		defaultimage = {defaultimage},
		maintenancecat =
			function(localdata, item, params)
			if (cat == '-') or localdata['image'] == 'non' then
				return nil
			elseif cat then
				return cat
			else
				return 'Article à illustrer'
			end
			end,
		captionparameter = 'légende',
		defaultcaption = function() return defaultcaption end,
		property = 'P18',
		numval = 1,
	}
end


-- Liens externes
function p.website() --texte libre [http://example.org example.org] ou url seule
	return { 
            type = 'mixed',
            label = "Site web",
            wikidata = wikidata.formatStatements({property='p856', first = "true"}),
            value = function() return require("Module:Weblink").makelink(localdata['site web']) end
            }
end

return p