Module:EventNewsProcessor
Jump to navigation
Jump to search
Documentation for this module may be created at Module:EventNewsProcessor/doc
local p = {}
function p.processEvents(frame)
local content = frame:getParent().args.content or ''
local mode = frame:getParent().args.mode or 'event'
local processedRows = {}
for event in mw.text.gsplit(content, '\n', true) do
local date, title, description = event:match('|%s*(%d+%-%d+%-%d+)%s*||%s*(.-)%s*||%s*(.-)%s*|%-')
if date and title and description then
if mode == 'news' then
table.insert(processedRows, string.format('|-\n| %s || %s: %s', date, title, description))
else
table.insert(processedRows, string.format('|-\n| %s || %s || %s', date, title, description))
end
end
end
return table.concat(processedRows, '\n')
end
return p