Demo writer (talk | contribs) m (1 revision imported) |
m (1 revision imported) |
(One intermediate revision by one other user not shown) | |
(No difference)
|
Latest revision as of 13:37, 10 June 2024
no content
local p = {} -- p stands for package
function p.forDate( frame )
local todayU = frame:callParserFunction( '#time:U' )
local pastU = frame:callParserFunction( '#time:U', '-2 months' )
local timeU = frame:callParserFunction( '#time:U', frame.args[1] )
local closed = frame.args[2]
local color = 'green'
if ( timeU < todayU ) then
color = 'orange'
end
if ( timeU < pastU ) then
color = 'red'
end
if ( closed == 'closed' ) or ( closed == 'geschlossen' ) then
color = 'blue'
end
return p.getIndicator( frame, color )
end
function p.getIndicator( frame, color )
-- adding the color in hidden text makes the indicator sortable in tables
return "<span class='date-indicator' style='color: " .. color .. ";font-size:1em;'>◉<span style='display:none;'>" .. color .. "</span></span>";
end
return p