Module:CountdownBanner: Difference between revisions
From 20R1
No edit summary |
No edit summary |
||
| Line 48: | Line 48: | ||
local lb = ' [[' | local lb = ' [[' | ||
local rb = ']] ' | local rb = ']] ' | ||
local | local filter = lb..'Club Name::+'..rb..' '..lb..'Start Date::> '..os.date("!%Y-%m-%d", currentTime)..rb | ||
local query = '{{#ask: ' | |||
.. '|?Start Date' | .. '|?Start Date' | ||
.. '|?Event Name=Name' | .. '|?Event Name=Name' | ||
| Line 58: | Line 59: | ||
.. '|}}' | .. '|}}' | ||
return frame:preprocess( query ) | return frame:preprocess( '{{CountdownBannerDisplay|' .. query .. '|'..filter..'|}}' ) | ||
end | end | ||
return p | return p | ||
Revision as of 01:14, 20 November 2025
Documentation for this module may be created at Module:CountdownBanner/doc
local p = {}
function p.show( frame )
local currentTime = os.time()
local lb = ' [['
local rb = ']] '
local query = '{{#ask: '..lb..'Club Name::+'..rb..lb..'Start Date::> '..os.date("!%Y-%m-%d", currentTime)..rb
.. '|?Start Date'
.. '|?Event Name=Name'
.. '|?Event Location=Location'
.. '|?Event Flyer=Flyer'
.. '|sort=Start Date'
.. '|order=asc'
.. '|limit=1'
.. '|}}'
local result = frame:preprocess( query )
if result == '' or result:match'^%s*$' then
local banner = '<div style="background:#b22234;color:white;padding:20px;text-align:center;font-size:18px;">No upcoming events scheduled</div>'
banner = 'QUERY:'..query..'<br><pre>RESULT:'..result..'<hr>'..banner
return query
end
return frame:preprocess( '{{CountdownBannerDisplay|' .. query .. '}}' )
end
function p.query( frame )
local currentTime = os.time()
local lb = ' [['
local rb = ']] '
local query = '{{#ask: '..lb..'Club Name::+'..rb..' '..lb..'Start Date::> '..os.date("!%Y-%m-%d", currentTime)..rb
.. '|?Start Date'
.. '|?Event Name=Name'
.. '|?Event Location=Location'
.. '|?Event Flyer=Flyer'
.. '|sort=Start Date'
.. '|order=asc'
.. '|limit=1'
.. '|}}'
return '<pre>'..query..'</pre>'
--return frame:preprocess( '{{CountdownBannerDisplay|' .. query .. '}}' )
end
function p.result( frame )
local currentTime = os.time()
local lb = ' [['
local rb = ']] '
local filter = lb..'Club Name::+'..rb..' '..lb..'Start Date::> '..os.date("!%Y-%m-%d", currentTime)..rb
local query = '{{#ask: '
.. '|?Start Date'
.. '|?Event Name=Name'
.. '|?Event Location=Location'
.. '|?Event Flyer=Flyer'
.. '|sort=Start Date'
.. '|order=asc'
.. '|limit=1'
.. '|}}'
return frame:preprocess( '{{CountdownBannerDisplay|' .. query .. '|'..filter..'|}}' )
end
return p
