Module:Weather box/row/sandbox: Difference between revisions

Content deleted Content added
work with refactored Module:Weather box
restore version at 03:00, 1 June 2023 to remove temporary tests
 
(10 intermediate revisions by 4 users not shown)
Line 125:
local result = {'|- style="text-align: center;"\n! scope="row" style="height: 16px;" | ', label, "\n"}
for i = 1, 13 do
table.insert(result,
local color_str '|style="' .. color_values[i] ..
if i == 13 then
table.insert(result,i table.concat( {'|style="',= 13 color_str,and ' border-left-width:medium"' |or '}"') ))..
' class="notheme"| '
else
)
table.insert(result, table.concat( {'|style="', color_str, '" | '} ))
end
local display = first_values[i]:getDisplay()
if display then
Line 246 ⟶ 245:
if F_values[i]:isValid() then
p = F_values[i]:getPrecision()
C_values[i]:setNumberRounded( (F_values[i].number - 32)*5/9, p )
end
elseif F_values[i].string == '' then
if C_values[i]:isValid() then
p = C_values[i]:getPrecision()
F_values[i]:setNumberRounded( C_values[i].number*9/5 + 32, p )
end
end
Line 299 ⟶ 298:
 
local function _buildRow(definition, args, options)
options = options or {}
local wbc = require('Module:Weather box/colors' .. (options.sandbox or ''))
local mode = (definition.mode or 'basic'):lower()
Line 305:
local color_values
local color_scheme = definition.color_scheme or 't'
local scale_factor = math_mod._cleanNumber( definition.scale_factor ) or 1
local date_mode = checkFlag( definition.date_mode, false )
local label = definition.label or ''
local annual_mode = (definition.annual_mode or 'avg'):lower()
local include_space = checkFlag( definition.include_space, true )
local second_line = checkFlag( definition.second_line, false )
local prefer_cm = checkFlag( definition.prefer_cm, false )
local imperial_first = checkFlag( args['imperial first'] )
local metric_first = checkFlag( args['metric first'] )
local wantSingleLine = options.wantSingleLine or checkFlag( args['single line'] )
local trace = args.trace
if trace and trace ~= '' then