Documentation for this module may be created at Module:Sandbox/Gonnym/infoboxFR/removed/doc

local lang = 'fr'

local i18n = {
	['see doc'] = 'Template documentation',
	['edit'] = 'edit',
	['edit code'] = 'edit code',
	['edit item'] = 'edit Wikidata',
	['tracking cat'] = "Page using data from Wikidata",
	['invalid block type'] = "Invalid data block in infobox module",
	['default cat'] = "Infobox maintenance",
}

function p.build()
	--TODO: Is rank even used somewhere?
	-- assign rank to the infobox, "secondary" means special formatting like no displaytitle for coordinates
	local infoboxRank = 'main' -- main infobox of the page, with coordinates displayed in title etc.
	if (page.namespace ~= 0) then
		infoboxRank = 'secondary'
	end
	
	-- if infobox is linked to another item: rank = secondary
	if (localData.item) then
		local itemLink = mw.wikibase.sitelink(localData.item.id)
		local pageTitle = mw.title.getCurrentTitle().text
		if ((itemLink or '') ~= pageTitle) then
			infoboxRank = 'secondary'
		end
	end

	localData.infoboxRank = infoboxRank
end

function p.buildFooter(params)
	if (not params) then
		params = {}
	end
	
	local class = 'navbar noprint bordered ' .. (params.class or '')
	local style = params.style or {}
	style['border-top'] = style['border-top'] or '1px solid ' .. mainColor
	
	local backLinkString = '[' .. tostring(mw.uri.fullUrl(page.name, 'veaction=edit&section=0')) .. ' ' .. i18n['edit'] .. ']'
		.. ' - [' .. tostring( mw.uri.fullUrl( page.name, 'action=edit&section=0' ) ) .. ' ' .. i18n['edit code'] .. ']'

	local itemLinkString
	if (localData.item) then
		itemLinkString = '[[d:' .. localData.item.id .. '|' .. i18n['edit item'] .. ']]'
	end
	
	local editString = backLinkString
	if (itemLinkString) then
		editString = editString .. ' - ' .. itemLinkString
	end
	
	local editLinkSpan =  mw.html.create('span')
		:css({['text-align'] = "left"})
		:addClass('plainlinks')
		:wikitext(editString)
		:done()
		
	local docLinkString = '[[Image:Info Simple.svg|12px|link=' .. localData.templateName .. '|' .. i18n['see doc'] .. ']]'
	-- if this link does not always work, add a variable for the name of the [TODO: ?]
	local docLinkString = mw.html.create('span')
		:css({['text-align'] = "right"})
		:wikitext(doclinkstr)
		:done()
	
	local footer = mw.html.create('p')
		:addClass(class)
		:css(style)
		:node(editLinkSpan)
		:node(docLinkString)
	return footer
end

function p.buildSuccession(params)
	if (color == 'default') then
		style['background-color'] = '#E6E6E6'
		arrowLeft = '[[Fichier:Fleche-defaut-gauche.png|13px|alt=Précédent|link=]]'
		arrowRight = '[[Fichier:Fleche-defaut-droite.png|13px|alt=Précédent|link=]]'
	else
		style['background-color'] = color
		arrowLeft = '[[Fichier:Fleche-defaut-gauche-gris-32.png|13px|alt=Suivant|link=]]'
		arrowRight = '[[Fichier:Fleche-defaut-droite-gris-32.png|13px|alt=Suivant|link=]]'
	end
end