No edit summary |
No edit summary |
||
| Line 1: | Line 1: | ||
local p = {} | local p = {} | ||
function parseCSV(csvString) | |||
local result = {} | |||
for value in string.gmatch(csvString, '([^,]+)') do | |||
table.insert(result, value) | |||
end | |||
return result | |||
end | |||
function p.process(frame) | function p.process(frame) | ||
| Line 7: | Line 15: | ||
-- Example: Simple processing to convert CSV to a bulleted list | -- Example: Simple processing to convert CSV to a bulleted list | ||
for line in csvText:gmatch("[^\r\n]+") do | for line in csvText:gmatch("[^\r\n]+") do | ||
result = | result = parseCSV(line) | ||
end | end | ||
Revision as of 01:08, 4 June 2024
Documentation for this module may be created at Module:ModuleLevelTable/doc
local p = {}
function parseCSV(csvString)
local result = {}
for value in string.gmatch(csvString, '([^,]+)') do
table.insert(result, value)
end
return result
end
function p.process(frame)
local csvText = frame.args[1] or ""
local result = ""
-- Example: Simple processing to convert CSV to a bulleted list
for line in csvText:gmatch("[^\r\n]+") do
result = parseCSV(line)
end
return result
end
return p