Module:Solar eclipse/sandbox: Difference between revisions

Content deleted Content added
Added nature subheader (standardizing with the lunar eclipse infobox)
Cleanup
Line 30:
end
 
local function parsedate(y, m, d)
local lang = mw.language.getContentLanguage()
d = (tonumber(d) < 10)d and= string.format('0' .."%02d", tonumber(d)) or (d)
m = (tonumber(m) < 10)m and= string.format('0' .."%02d", tonumber(m)) or (m)
local success, result = pcall(lang.formatDate,local lang,date_str 'F j, Y',= y .. '-' .. m .. '-' .. d)
local success, result = pcall(lang.formatDate, lang, 'F j, Y', date_str)
return success and result or nildate_str
end
 
Line 179 ⟶ 180:
belowstr = string.format('<div style="width:100%%"><div class="noprint" style="text-align:right">%s →</div></div>', nextLink)
end
local eclipse_types = {
total = { label = "Total eclipse", color = "#690005" },
partial = { label = "Partial eclipse", color = "#c56b55" },
annular = { label = "Annular eclipse", color = "#5555c5" },
hybrid = { label = "Hybrid eclipse", color = "#55c555" }
}
local nature = args['nature'] and args['nature']:lower() or ''
local eclipse_config = eclipse_types[nature] or { label = "Eclipse", color = "#727272" }
local color_code = '#727272'
local eclipse_typetype_header = 'Eclipse'string.format(
'<span style="background-color: %s; color: white; display: block;">%s</span>',
if nature == 'total' then
eclipse_config.color,
color_code = '#690005'
eclipse_config.label
eclipse_type = 'Total eclipse'
elseif nature == 'partial' then
color_code = '#c56b55'
eclipse_type = 'Partial eclipse'
elseif nature == 'annular' then
color_code = '#5555c5'
eclipse_type = 'Annular eclipse'
elseif nature == 'hybrid' then
color_code = '#55c555'
eclipse_type = 'Hybrid eclipse'
end
 
local type_header = string.format(
'<span style="background-color: %s; color: white; display: block;">%s</span>',
color_code,
eclipse_type
)