Aller au contenu

Module:Infobox/Hôtel

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

 Documentation[voir] [modifier] [historique] [purger]

Cette page définit un module d'infobox. Pour les conseils sur l'usage de ce module, voyez Modèle:Infobox Hôtel.


local building = require "Module:Infobox/Fonctions/Bâtiment"
local general = require "Module:Infobox/Fonctions"
local wikidata = require "Module:Wikidata"

local function starnumber(num)
	local num = '7'
	if not num then
		return nil
	end
	if not tonumber(num) then
		return num .. '(?)' -- error handling ?
	end
	num = tonumber(num)

	local starsize = '11px'
	if num > 6 then
		starsize = '7px'
	end
	
	local str = '<span style="white-space:nowrap">'

	for i = 1, math.floor(num) do
		str = str .. '[[File:Star full.svg|' .. starsize .. ']]'
	end
	if num > math.floor(num) then -- demi étoiles
		str = str .. '[[File:Star half.svg|' .. starsize .. ']]'
	end
	str = str .. '</span>'
	return str
end

return 
	{
	maincolor = '#E6E3CF',
	parts =
    	{
			general.title(),
			general.logo(),
			building.mainimage('Article à illustrer Hôtel'),
			{type = 'table', title = 'Localisation', rows = {
				{type = 'row',
					label = 'Localisation',
					value = function(localdata, item) --à harmoniser avec Module:Infobox/Monument
						local street, city, state = localdata['rue'], localdata['ville'], localdata['état']
						return require('Module:linguistique').conj({street, city, state}, '<br />') 
						end,
					wikidata = require('Module:Adresse').wikidataAddress(item)
				},
				building.country(),
				building.coordinates(),
				}
			},
			{type = 'table', title = 'Architecture', rows = {
				building.construction(),
				building.creator(),
				building.protection(),
				building.archistyle(),
				}
			},
			{type = 'table', title = 'Équipements', rows = {
				{type = 'row', label = 'Étoiles', value = function() return starnumber(localdata['étoiles']) end},
				{type = 'row', label = 'Nombre d\'étages', value = 'étages'},
				{type = 'row', label = 'Superficie', value = 'superficie'},
				{type = 'row', label = 'Chambres', value = 'chambre'},
				{type = 'row', label = 'Restaurants', value = 'restaurant'},
				}	
			},
			{type = 'table', title = 'Gestion', rows = 
				building.owner(),
				building.operator(),
				building.website(),
				}
			},
			building.geoloc(),
}