Module:ExplodeAndList
Appearance
Documentation for this module may be created at Module:ExplodeAndList/doc
-- Module:ExplodeAndList
local p = {}
function p.explodeAndList(frame)
local titulonan = frame.args[1] or ""
local nombernan = frame.args[2] or ""
-- Split the inputs by the <br /> tag
local titulonan_list = mw.text.split(titulonan, '<br />')
local nombernan_list = mw.text.split(nombernan, '<br />')
-- Initialize the result table
local result = {}
-- Ensure the lists are of equal length
local max_length = math.max(#titulonan_list, #nombernan_list)
for i = 1, max_length do
local title = titulonan_list[i] or ""
local name = nombernan_list[i] or ""
-- Append the formatted title and name to the result
table.insert(result, '- ' .. title .. ' ' .. name)
end
-- Concatenate the result into a single string separated by newlines
return table.concat(result, '\n')
end
return p