Aller au contenu

Module:Sandbox/test

Une page de Wikipédia, l'encyclopédie libre.
Ceci est une version archivée de cette page, en date du 20 juin 2025 à 12:56 et modifiée en dernier par Pohoua (discuter | contributions). Elle peut contenir des erreurs, des inexactitudes ou des contenus vandalisés non présents dans la version actuelle.

 Documentation[créer] [purger]
local cheese = require "Module:Infobox/Fonctions"
local wikidata = require "Module:Wikidata"
local linguistic = require "Module:Linguistique"
local mapframe = require "Module:Mapframe"

return {
	maincolor = '#DB408D',
	parts = {
		cheese.title(),
		cheese.mainimage('Article à illustrer Fromage'),
		{
			type = 'table',
			rows = {
				{ type = 'row', label = 'Pays d’origine', value = 'pays', property = 'P495' },
				{ type = 'row', label = 'Croute', value = 'croute' },
				{ type = 'row', label = 'Région', value = 'lieu', property = 'P1071' },
				{ type = 'row', label = 'Fabricant', value = 'fabricant', property = 'P176' },
				{ 
					type = 'row', label = 'Lait', value = 'lait',
					wikidata = {
						property = 'P186',
						qualifier = 'P518',
						qualifiervalue = {'Q8495'},
						labelformat = function(id)
							local label = mw.wikibase.label(id)
							return linguistic.keepcomplement(label, "lait")
						end
					}
				},
				{ 
					type = 'row', label = 'Pâte', value = 'pâte',
					wikidata = {
						property = 'P279',
						condition = function(claim)
							local str = wikidata.formatStatement(claim)
							if string.match(str:lower(), "pâte") then
								return true
							end
						end,
						labelformat2 = function(label)
							return mw.ustring.gsub(linguistic.lcfirst(label), "fromage à pâte ", "")
						end,
						ucfirst = '-'
					}
				},
				{ type = 'row', label = 'Appellation', value = 'aoc',
				  wikidata = {property = 'P1389', showdate = true, conjtype = '<br />', textformat = 'minimum'} },
				{ type = 'row', label = 'Nommé en référence à', value = 'nommé selon', property = 'P138' },
				{ type = 'row', label = 'Volume commercialisé', value = 'quantité',
				  wikidata = {property = 'P1092', showdate = true, rank = 'best', conjtype = '<br />', textformat = 'minimum'} },
				{ type = 'row', label = 'Aire de production', value = 'superficie',
				  wikidata = {property = 'P2046', showdate = true, conjtype = '<br />', textformat = 'minimum'} },
				{ type = 'row', label = 'Producteurs de lait', value = 'producteurs' },
				{ type = 'row', label = 'Transformateurs', value = 'transformateurs' },
				{ type = 'row', label = 'Affineurs', value = 'affineurs' }
			}
		},
		-- Partie carte interactive
		{
			type = 'row',
			label = 'Carte',
			value = function(args)
				local lat = args.latitude or '46.6'
				local lon = args.longitude or '6.5'
				return frame:preprocess(string.format('<mapframe latitude=55 longitude=10 zoom="9" width="250" height="250"></mapframe>', lat, lon))
			end
		}
	}
}