Moduuli:Fr:Infobox/Fromage

Wikimatkoista

local cheese = require "Module:Fr:Infobox/Fonctions"
local wikidata = require "Module:Fr:Interface Wikidata".fromLua
local linguistic = require "Module:Fr:Linguistique"

return {
	maincolor = '#FFFF77',
	parts = {
		cheese.title(),
		cheese.mainimage('Article à illustrer Fromage'),
		{
			type	= 'table',
			rows	= {
				{
					type		= 'row',
					label		= 'Alkuperämaa', -- Pays d’origine
					value		= 'alkuperämaa', -- pays
					property	= 'P495'
				},
				{
					type		= 'row',
					label		= 'Valmistuspaikka', --Région
					value		= 'valmistuspaikka', --lieu
					property	= 'P1071'
				},
				{
					type		= 'row',
					label		= 'Valmistaja', -- Fabricant
					value		= 'valmistaja', -- fabricant 
					property	= 'P176'
				},
				{
					type		= 'row',
					label		= 'Maito', -- Lait
					value		= 'maito', -- lait
					wikidata	= {
						property = 'P186', -- récupère la propriété P186 (matériau) 
						qualifier = 'P518', -- seulement si elle a le qualificatif "s'applique à la partie"
						qualifiervalue = {'Q8495'}, -- et que cette partie est le lait"
						labelformat = function(id) -- enlève "lait" du libellé, un peu lourd
							local label = mw.wikibase.label(id)
							return linguistic.keepcomplement(label, "lait")
							end
						}
				},
				{
					type		= 'row',
					label		= 'Massa', -- pâte
					value		= 'massa', -- pâte
					wikidata    = function()
						-- Pour déterminer le type de pâte du fromage sur Wikidata, récupération des valeurs éventuelles
						-- de la propriété P279 ("sous-classe de") dont le label contiennent "pâte"
						local paste_list = {}
						local claims = wikidata.getClaims({entity = item, property = 'P279'})
						if claims then
							for claim_key, claim_value in pairs(claims) do
								statement = wikidata.formatStatement(claim_value)
								if string.match(statement:lower(), "pâte") then
									statement = mw.ustring.gsub(statement, "\|fromage à pâte ", "\|")
									table.insert(paste_list, statement)
								end
							end
						end
						if #paste_list > 0 then
								return mw.text.listToText(paste_list, "<br />", "<br />")
						end
						return false
					end
				},
				{
					type		= 'row',
					label		= 'Nimitys', -- Appellation
					value		= 'aoc',     -- aoc
					wikidata 	= {property = 'P1389', showdate = true, conjtype = '<br />', textformat = 'minimum'}
						-- P1389 ("certificat de produit")
				},
				{
					type		= 'row',
					label		= 'Nimen alkuperä', -- Nommé en référence à
					value		= 'nimen alkuperä', -- nommé selon
				        property	= 'P138'
				},
				{
					type		= 'row',
					label		= 'Valmistusmäärä', -- Volume commercialisé
					value		= 'valmistusmäärä', -- quantité
					wikidata 	= {property = 'P1092', showdate = true, rank = 'best', conjtype = '<br />', textformat = 'minimum'}
				},
				{
					type		= 'row',
					label		= 'Tuotanto-ala', -- Aire de production
					value		= 'tuotanto-ala', -- superficie
					wikidata 	= {property = 'P2046', showdate = true, conjtype = '<br />', textformat = 'minimum'}
				},
				{
					type		= 'row',
					label		= 'Producteurs de lait',
					value		= 'producteurs', -- remplissage manuel en attendant que Wikidata le gère
				},
				{
					type		= 'row',
					label		= 'Transformateurs',
					value		= 'transformateurs', -- remplissage manuel en attendant que Wikidata le gère
				},
				{
					type		= 'row',
					label		= 'Affineurs',
					value		= 'affineurs', -- remplissage manuel en attendant que Wikidata le gère
				}
			}
		}
	}
}