Modul:Formatering

Från Wikipedia

Dokumentationen för denna modul kan skapas på Modul:Formatering/dok

local p = {}

function p.br_separated_entries(frame)
	local res = {}
	for _, v in ipairs(frame:getParent().args) do	
	  if string.gsub(v,' ','') ~= '' then  table.insert(res, v) end
	end
    return table.concat(res, '<br />')
end

function p.komma_separated_entries(frame)
	local res = {}
	for _, v in ipairs(frame:getParent().args) do	
	  if string.gsub(v,' ','') ~= '' then  table.insert(res, v) end
	end
    return table.concat(res, ', ')
end

function p.unbulleted_list(frame)
	local args = frame:getParent().args
	local class = args['class'] or 'plainlinks'
	local style = args['style'] or ''
	local list_style = args['list_style'] or 'margin-left:0; list-style:none none;'
	local item_style = args['item_style'] or ''
	local res = '<div class="' .. class .. '" style="' .. style .. '"><ul style="' .. list_style .. '">'
	for i, v in ipairs(args) do
		itemi_style = args['item' .. i .. '_style'] or ''
		if string.gsub(v,' ','') ~= '' then res = res .. '<li style="' .. item_style .. itemi_style .. '">' .. v .. '</li>' end
	end
    return res..'</ul></div>'
end
    
return p