Content deleted Content added
only call Module:Navbar if a navbar is needed |
Test max snow depth Tag: Reverted |
||
Line 20:
end
local function makeLabel(args
local first
if isAny(args, ' ' .. what .. ' cm') then
Line 39:
end
if is_first then
if
first = first .. ' (' .. second .. ')'
end
Line 65:
end
local function
end▼
-- Return a list of tables or strings that define each row.
local function _if(parm, a, b)
return stripToNil(args[parm]) and a or b or ''
Line 84 ⟶ 76:
local function _ifany(suffix)
return isAny(args, suffix)
▲ local navbar = require('Module:Navbar')._navbar
navbarText = navbar({'Climate data for ' .. ___location, args.name, collapsible=1})▼
end
return {
Line 104 ⟶ 85:
_ifset('margin', 'auto') .. ';"' ..
_if('open',
-- Following intentionally shows "{{{___location}}}" if parameter is blank to alert editor.
'\n|+Climate data for ' .. _if('___location', args.___location, '{{{___location}}}'),
'\n|-' ..
'\n!colspan="14" | ' ..
_if('name',
▲
'Climate data for ' .. _if('___location', args.___location, '{{{___location}}}')
) ..
[=[
Line 128 ⟶ 114:
{---------- FIRST LINE MAXIMUM HUMIDEX ----------
WANTROW = _ifany(' maximum humidex') and (_ifset('metric first') or
mode = 'basic',
group_name = 'maximum humidex',
Line 142 ⟶ 128:
color_scheme = _ifset('temperature colour', 't'),
scale_factor = '1',
label = 'Record high °' .. _if('metric first', 'C', 'F') ..
annual_mode = 'max',
},
Line 151 ⟶ 137:
color_scheme = _ifset('temperature colour', 't'),
scale_factor = '1',
label = 'Mean maximum °' .. _if('metric first', 'C', 'F') ..
annual_mode = 'max',
},
Line 160 ⟶ 146:
color_scheme = _ifset('temperature colour', 't'),
scale_factor = '1',
label = 'Average high °' .. _if('metric first', 'C', 'F') ..
annual_mode = 'avg',
},
Line 169 ⟶ 155:
color_scheme = _ifset('temperature colour', 't'),
scale_factor = '1',
label = 'Daily mean °' .. _if('metric first', 'C', 'F') ..
annual_mode = 'avg',
},
Line 178 ⟶ 164:
color_scheme = _ifset('temperature colour', 't'),
scale_factor = '1',
label = 'Average low °' .. _if('metric first', 'C', 'F') ..
annual_mode = 'avg',
},
Line 187 ⟶ 173:
color_scheme = _ifset('temperature colour', 't'),
scale_factor = '1',
label = 'Mean minimum °' .. _if('metric first', 'C', 'F') ..
annual_mode = 'min',
},
Line 196 ⟶ 182:
color_scheme = _ifset('temperature colour', 't'),
scale_factor = '1',
label = 'Record low °' .. _if('metric first', 'C', 'F') ..
annual_mode = 'min',
},
{---------- FIRST LINE MINIMUM WIND CHILL ----------
WANTROW = _ifany(' chill') and (_ifset('metric first') or
mode = 'basic',
group_name = 'chill',
Line 216 ⟶ 202:
scale_factor = '1',
prefer_cm = precision(_ifset('Jan precipitation inch', '0')) < 1,
label = makeLabel(args
annual_mode = 'sum',
},
Line 227 ⟶ 213:
scale_factor = '1',
prefer_cm = precision(_ifset('Jan rain inch', '0')) < 1,
label = makeLabel(args
annual_mode = 'sum',
},
Line 238 ⟶ 224:
date_mode = true,
scale_factor = '1',
label = makeLabel(args
annual_mode = 'sum',
},
{---------- FIRST LINE MAX SNOW DEPTH ----------
WANTROW = _ifany(' snow depth cm') or _ifany(' snow depth mm') or _ifany(' snow depth inch'),
mode = 'precipitation',
group_name = 'snow depth',
prefer_cm = true,
color_scheme = _ifset('snow colour', 'p'),
date_mode = true,
scale_factor = '1',
label = makeLabel(args, true, 'Extreme snow depth', 'snow'),
annual_mode = 'max',
},
{---------- SECOND LINE MAXIMUM HUMIDEX ----------
WANTROW = not
mode = 'basic',
group_name = 'maximum humidex',
Line 252 ⟶ 249:
},
{---------- SECOND LINE RECORD HIGH TEMPERATURES ----------
WANTROW = not
mode = 'temperature',
group_name = 'record high',
Line 262 ⟶ 259:
},
{---------- SECOND LINE AVERAGE HIGH TEMPERATURES ----------
WANTROW = not
mode = 'temperature',
group_name = 'high',
Line 272 ⟶ 269:
},
{---------- SECOND LINE DAILY MEAN TEMPERATURES ----------
WANTROW = not
mode = 'temperature',
group_name = 'mean',
Line 283 ⟶ 280:
},
{---------- SECOND LINE AVERAGE LOW TEMPERATURES ----------
WANTROW = not
mode = 'temperature',
group_name = 'low',
Line 294 ⟶ 291:
},
{---------- SECOND LINE RECORD LOW TEMPERATURES ----------
WANTROW = not
mode = 'temperature',
group_name = 'record low',
Line 305 ⟶ 302:
},
{---------- SECOND LINE MINIMUM WIND CHILL ----------
WANTROW = not
mode = 'basic',
group_name = 'chill',
Line 314 ⟶ 311:
},
{---------- SECOND LINE TOTAL PRECIPITATION ----------
WANTROW = not
mode = 'precipitation',
group_name = 'precipitation',
Line 322 ⟶ 319:
scale_factor = '1',
prefer_cm = precision(_ifset('Jan precipitation inch', '0')) < 1,
label = makeLabel(args
annual_mode = 'sum',
},
{---------- SECOND LINE RAINFALL ----------
WANTROW = not
mode = 'precipitation',
group_name = 'rain',
Line 334 ⟶ 331:
scale_factor = '1',
prefer_cm = precision(_ifset('Jan rain inch', '0')) < 1,
label = makeLabel(args
annual_mode = 'sum',
},
{---------- SECOND LINE SNOWFALL ----------
WANTROW = not
mode = 'precipitation',
group_name = 'snow',
Line 346 ⟶ 343:
date_mode = true,
scale_factor = '1',
label = makeLabel(args
annual_mode = 'sum',
},
{---------- SECOND LINE MAX SNOW DEPTH ----------
WANTROW = not _ifset('single line') and (_ifany(' snow depth cm') or _ifany(' snow depth mm') or _ifany(' snow depth inch')),
mode = 'precipitation',
group_name = 'snow depth',
second_line = true,
prefer_cm = true,
color_scheme = _ifset('snow colour', 'p'),
date_mode = true,
scale_factor = '1',
label = makeLabel(args, false, 'Exrtreme snow depth', 'snow'),
annual_mode = 'max',
},
{---------- PRECIPITATION DAYS ----------
Line 407 ⟶ 416:
color_scheme = _ifset('temperature colour', 't'),
scale_factor = '1',
label = 'Average [[dew point]] °' .. _if('metric first', 'C', 'F') ..
annual_mode = 'avg',
},
{---------- SECOND LINE AVERAGE DEW POINT----------
WANTROW = not
mode = 'temperature',
group_name = 'dew point',
Line 472 ⟶ 481:
makeSources(frame, args),
}
▲end
local function makeFrame(self_args, parent_args)
-- Kludge to pass arguments for a single row to buildRow.
-- Later: Refactor buildRow so this is not needed.
return {
args = self_args,
getParent = function (self) return makeFrame(parent_args, nil) end,
}
end
local function main(frame)
▲ local buildRow = require('Module:Weather box/row' .. sandbox)._buildRow
local args = frame:getParent().args
▲ }
local results = {}
for i,
local row
if type(
row =
elseif
row = buildRow(
else
row = ''
|