Module:Latest Singapore meetup
Appearance
local p = {}
function p.latestMeetup()
local frame = mw.getCurrentFrame()
local prefix = "Wikipedia:Meetup/Singapore "
local highest = 1 -- Start checking from Meetup 1
while true do
local nextTitle = mw.title.new(prefix .. (highest + 1))
if not nextTitle or not nextTitle.exists then
break -- Stop when the next page does not exist
end
highest = highest + 1
end
-- Prepare the template call
local excerptContent = frame:expandTemplate{ title = "Excerpt",
args = {
[1] = prefix .. highest,
template = "-Meetup",
["this"] = "Click on the \"Edit\" link to add yourself to the event. This secion is"
}
}
-- Trim the output using {{trim}}
return frame:expandTemplate{ title = "trim", args = { excerptContent } }
end
return p