وحدة:Weather box
الاستخدام
This module is used by {{بيانات منطقة مناخية}}.
{{#invoke:Weather box|main}}
البيانات المناخية لـEdmonton City Centre (Blatchford Field) Airport (1981−2010) | |||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
الشهر | يناير | فبراير | مارس | أبريل | مايو | يونيو | يوليو | أغسطس | سبتمبر | أكتوبر | نوفمبر | ديسمبر | المعدل السنوي |
الدرجة القصوى °م (°ف) | 11.7 (53.1) |
14.0 (57.2) |
23.9 (75.0) |
31.1 (88.0) |
32.3 (90.1) |
34.9 (94.8) |
34.6 (94.3) |
34.5 (94.1) |
33.9 (93.0) |
28.6 (83.5) |
21.7 (71.1) |
16.7 (62.1) |
34.9 (94.8) |
متوسط درجة الحرارة الكبرى °م (°ف) | −6.0 (21.2) |
−2.7 (27.1) |
2.2 (36.0) |
11.2 (52.2) |
17.5 (63.5) |
21.0 (69.8) |
23.1 (73.6) |
22.6 (72.7) |
17.1 (62.8) |
10.4 (50.7) |
0.0 (32.0) |
−4.5 (23.9) |
9.3 (48.7) |
المتوسط اليومي °م (°ف) | −10.4 (13.3) |
−7.6 (18.3) |
−2.5 (27.5) |
5.4 (41.7) |
11.5 (52.7) |
15.5 (59.9) |
17.7 (63.9) |
16.9 (62.4) |
11.4 (52.5) |
5.1 (41.2) |
−4.1 (24.6) |
−8.8 (16.2) |
4.2 (39.6) |
متوسط درجة الحرارة الصغرى °م (°ف) | −14.8 (5.4) |
−12.5 (9.5) |
−7.2 (19.0) |
−0.5 (31.1) |
5.4 (41.7) |
9.9 (49.8) |
12.3 (54.1) |
11.3 (52.3) |
5.8 (42.4) |
−0.2 (31.6) |
−8.2 (17.2) |
−13.1 (8.4) |
−1.0 (30.2) |
أدنى درجة حرارة °م (°ف) | −44.4 (−47.9) |
−46.1 (−51.0) |
−36.1 (−33.0) |
−25.6 (−14.1) |
−12.2 (10.0) |
−1.1 (30.0) |
0.6 (33.1) |
−1.2 (29.8) |
−11.7 (10.9) |
−25.0 (−13.0) |
−34.1 (−29.4) |
−48.3 (−54.9) |
−48.3 (−54.9) |
أدنى درجة حرارة تبريد الرياح | −52.8 | −50.7 | −44.6 | −37.5 | −14.5 | 0.0 | 0.0 | −3.7 | −13.3 | −34.3 | −50.2 | −55.5 | −55.5 |
الهطول مم (إنش) | 21.7 (0.85) |
12.0 (0.47) |
15.8 (0.62) |
28.8 (1.13) |
46.1 (1.81) |
77.5 (3.05) |
93.8 (3.69) |
61.9 (2.44) |
43.5 (1.71) |
21.7 (0.85) |
18.0 (0.71) |
15.0 (0.59) |
455.7 (17.94) |
معدل هطول الأمطار مم (إنش) | 1.3 (0.05) |
0.76 (0.03) |
1.7 (0.07) |
14.5 (0.57) |
40.7 (1.60) |
77.5 (3.05) |
93.8 (3.69) |
61.8 (2.43) |
42.4 (1.67) |
10.9 (0.43) |
1.6 (0.06) |
0.73 (0.03) |
347.8 (13.69) |
متوسط تساقط الثلوج سم (إنش) | 24.5 (9.6) |
13.4 (5.3) |
17.4 (6.9) |
15.3 (6.0) |
4.9 (1.9) |
0.0 (0.0) |
0.0 (0.0) |
0.0 (0.0) |
1.0 (0.4) |
11.6 (4.6) |
19.1 (7.5) |
16.4 (6.5) |
123.5 (48.6) |
متوسط أيام هطول الأمطار (≥ 0.2 مم) | 11.0 | 7.9 | 8.3 | 8.8 | 11.0 | 14.2 | 14.6 | 11.1 | 9.8 | 8.0 | 8.8 | 9.4 | 122.9 |
متوسط الأيام الممطرة (≥ 0.2 مم) | 1.1 | 0.83 | 1.4 | 5.9 | 10.5 | 14.2 | 14.6 | 11.1 | 9.6 | 5.6 | 1.5 | 0.75 | 77.3 |
متوسط الأيام المثلجة (≥ 0.2 سم) | 10.7 | 7.7 | 7.7 | 4.2 | 1.2 | 0.0 | 0.0 | 0.0 | 0.50 | 3.2 | 7.9 | 9.3 | 52.4 |
متوسط الرطوبة النسبية (%) | 65.2 | 61.2 | 56.5 | 42.9 | 40.4 | 48.2 | 52.6 | 51.4 | 50.1 | 50.5 | 64.7 | 65.4 | 54.1 |
ساعات سطوع الشمس الشهرية | 100.8 | 121.7 | 176.3 | 244.2 | 279.9 | 285.9 | 307.5 | 282.3 | 192.7 | 170.8 | 98.4 | 84.5 | 2٬344٫8 |
نسبة وصول أشعة الشمس | 40.2 | 44.1 | 48.1 | 58.2 | 56.8 | 56.2 | 60.2 | 61.5 | 50.4 | 52.0 | 37.8 | 36.0 | 50.1 |
متوسط مؤشر الأشعة فوق البنفسجية | 0 | 1 | 3 | 5 | 7 | 9 | 11 | 9 | 7 | 5 | 3 | 1 | 5 |
المصدر: Environment Canada,[1] Weather Atlas[2] |
مراجع
هذه المراجع ستظهر في المقالة؛ لكن هذه القائمة ستظهر فقط في هذه الصفحة.
- ^ "Edmonton City Centre Airport". Canadian Climate Normals 1981−2010. Environment Canada. 19 أغسطس 2013. اطلع عليه بتاريخ 2013-09-10.
- ^ "Monthly weather forecast and Climate: Edmonton, Canada". Weather Atlas. اطلع عليه بتاريخ 2019-03-12.
-- Implement [[قالب:Weather box]].
local precision = require('Module:Math')._precision
local function stripToNil(text)
-- If text is a non-empty string, return its trimmed content.
-- Otherwise, return nothing (text is an empty string or is not a string).
if type(text) == 'string' then
return text:match('(%S.-)%s*$')
end
end
local function isAny(args, suffix)
-- local months = { 'يناير', 'فبراير', 'مارس', 'أبريل', 'مايو', 'يونيو', 'يوليو', 'أغسطس', 'سبتمبر', 'أكتوبر', 'نوفمبر', 'ديسمبر' }
local months = { 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec' }
for _, month in ipairs(months) do
--na2 = month .. suffix
--na2 = mw.ustring.gsub(na2 , " ", "_")
--mw.log(na2)
if stripToNil(args[month .. suffix]) then
return true
--elseif stripToNil(args[ na2 ]) then
-- return true
end
end
end
local function makeLabel(args, is_first, base, what)
local first
if isAny(args, ' ' .. what .. ' cm') then
first = 'سم'
else
if isAny(args, ' ' .. what .. ' mm') then
first = 'مم'
else
first = (what == 'snow' or
precision(args['Jan ' .. what .. ' inch'] or '0') < 1)
and 'سم'
or 'مم'
end
end
local second = 'إنش'
if not stripToNil(args['metric first']) then
first, second = second, first
end
if is_first then
if stripToNil(args['single line']) then
first = first .. ' (' .. second .. ')'
end
else
first = second
end
return base .. ' ' .. first
end
local function makeSources(frame, args)
local source1 = stripToNil(args.source) or stripToNil(args['source 1'])
local source2 = stripToNil(args['source 2']) or stripToNil(args['source2'])
local result = '|-\n|colspan="14" style="text-align:center;font-size:95%;"|'
local text
if source1 or source2 then
if source1 and source2 then
text = 'المصدر #1: ' .. source1 .. '\n' .. result .. 'المصدر #2: ' .. source2
else
text = 'المصدر: ' .. (source1 and source1 or source2)
end
else
text = frame:expandTemplate({ title = 'citation needed', args = {date = stripToNil(args.date)} })
end
return result .. text .. '\n|}'
end
local function getDefinitions(frame, args)
-- Return a list of tables or strings that define each row.
local navbar = require('Module:Navbar')._navbar
local function _if(parm, a, b)
return stripToNil(args[parm]) and a or b or ''
end
local function _ifset(parm, a)
return stripToNil(args[parm]) and args[parm] or a
end
local function _ifany(suffix)
return isAny(args, suffix)
end
return {
----------- HEADER ----------
'{| class="wikitable ' .. _if('open', '', 'collapsible' .. _if('collapsed', ' collapsed')) ..
'" style="width:' .. _ifset('width', '100%') ..
'; text-align:center; line-height: 1.2em; margin:' ..
_ifset('margin', 'auto') .. ';"' ..
_if('open',
'\n|+البيانات المناخية لـ' .. _if('location', args.location, '{{{location}}}'),
'\n|-' ..
'\n!colspan="14" | ' ..
_if('name',
navbar({'البيانات المناخية لـ' .. _if('location', args.location, '{{{location}}}'), args.name, collapsible=1}),
'البيانات المناخية لـ' .. _if('location', args.location, '{{{location}}}')
)
) ..
[=[
|-
!scope="row" |الشهر
!scope="col" |يناير
!scope="col" |فبراير
!scope="col" |مارس
!scope="col" |أبريل
!scope="col" |مايو
!scope="col" |يونيو
!scope="col" |يوليو
!scope="col" |أغسطس
!scope="col" |سبتمبر
!scope="col" |أكتوبر
!scope="col" |نوفمبر
!scope="col" |ديسمبر
!scope="col" style="border-left-width:medium" |المعدل السنوي
]=],
{---------- FIRST LINE MAXIMUM HUMIDEX ----------
WANTROW = _ifany(' maximum humidex') and (_ifset('metric first') or _ifset('single line')),
mode = 'basic',
group_name = 'maximum humidex',
color_scheme = _ifset('temperature colour', 't'),
scale_factor = '1',
label = 'الدرجة القصوى [[قرينة الرطوبة]]',
annual_mode = 'max',
},
{---------- FIRST LINE RECORD HIGH TEMPERATURES ----------
WANTROW = _ifany(' record high C') or _ifany(' record high F'),
mode = 'temperature',
group_name = 'record high',
color_scheme = _ifset('temperature colour', 't'),
scale_factor = '1',
label = 'الدرجة القصوى °' .. _if('metric first', 'م', 'ف') .. _if('single line', ' (°' .. _if('metric first', 'ف', 'م') .. ')'),
annual_mode = 'max',
},
{---------- FIRST-SECOND LINE AVG MONTHLY MAXIMUM TEMPERATURES ----------
WANTROW = _ifany(' avg record high C') or _ifany(' avg record high F'),
mode = 'temperature',
group_name = 'avg record high',
color_scheme = _ifset('temperature colour', 't'),
scale_factor = '1',
label = 'Mean maximum °' .. _if('metric first', 'م', 'ف') .. _if('single line', ' (°' .. _if('metric first', 'ف', 'م') .. ')'),
annual_mode = 'max',
},
{---------- FIRST LINE AVERAGE HIGH TEMPERATURES ----------
WANTROW = _ifany(' high C') or _ifany(' Hi C') or _ifany(' high F') or _ifany(' Hi F'),
mode = 'temperature',
group_name = 'high',
color_scheme = _ifset('temperature colour', 't'),
scale_factor = '1',
label = 'متوسط درجة الحرارة الكبرى °' .. _if('metric first', 'م', 'ف') .. _if('single line', ' (°' .. _if('metric first', 'ف', 'م') .. ')'),
annual_mode = 'avg',
},
{---------- FIRST LINE DAILY MEAN TEMPERATURES ----------
WANTROW = _ifany(' mean C') or _ifany(' mean F'),
mode = 'temperature',
group_name = 'mean',
color_scheme = _ifset('temperature colour', 't'),
scale_factor = '1',
label = 'المتوسط اليومي °' .. _if('metric first', 'م', 'ف') .. _if('single line', ' (°' .. _if('metric first', 'ف', 'م') .. ')'),
annual_mode = 'avg',
},
{---------- FIRST LINE AVERAGE LOW TEMPERATURES ----------
WANTROW = _ifany(' low C') or _ifany(' low F'),
mode = 'temperature',
group_name = 'low',
color_scheme = _ifset('temperature colour', 't'),
scale_factor = '1',
label = 'متوسط درجة الحرارة الصغرى °' .. _if('metric first', 'م', 'ف') .. _if('single line', ' (°' .. _if('metric first', 'ف', 'م') .. ')'),
annual_mode = 'avg',
},
{---------- FIRST-SECOND LINE AVG MONTHLY MINIMUM TEMPERATURES ----------
WANTROW = _ifany(' avg record low C') or _ifany(' avg record low F'),
mode = 'temperature',
group_name = 'avg record low',
color_scheme = _ifset('temperature colour', 't'),
scale_factor = '1',
label = 'Mean minimum °' .. _if('metric first', 'م', 'ف') .. _if('single line', ' (°' .. _if('metric first', 'ف', 'م') .. ')'),
annual_mode = 'min',
},
{---------- FIRST LINE RECORD LOW TEMPERATURES ----------
WANTROW = _ifany(' record low C') or _ifany(' record low F'),
mode = 'temperature',
group_name = 'record low',
color_scheme = _ifset('temperature colour', 't'),
scale_factor = '1',
label = 'أدنى درجة حرارة °' .. _if('metric first', 'م', 'ف') .. _if('single line', ' (°' .. _if('metric first', 'ف', 'م') .. ')'),
annual_mode = 'min',
},
{---------- FIRST LINE MINIMUM WIND CHILL ----------
WANTROW = _ifany(' chill') and (_ifset('metric first') or _ifset('single line')),
mode = 'basic',
group_name = 'chill',
color_scheme = _ifset('temperature colour', 't'),
scale_factor = '1',
label = 'أدنى درجة حرارة [[تبريد الرياح]]',
annual_mode = 'min',
},
{---------- FIRST LINE TOTAL PRECIPITATION ----------
WANTROW = _ifany(' precipitation cm') or _ifany(' precipitation mm') or _ifany(' precipitation inch') ,
mode = 'precipitation',
group_name = 'precipitation',
color_scheme = _ifset('precipitation colour', 'p'),
date_mode = true,
scale_factor = '1',
prefer_cm = precision(_ifset('Jan precipitation inch', '0')) < 1,
label = makeLabel(args, true, '[[هطول|الهطول]]', 'precipitation'),
annual_mode = 'sum',
},
{---------- FIRST LINE RAINFALL ----------
WANTROW = _ifany(' rain cm') or _ifany(' rain mm') or _ifany(' rain inch'),
mode = 'precipitation',
group_name = 'rain',
color_scheme = _ifset('rain colour', 'p'),
date_mode = true,
scale_factor = '1',
prefer_cm = precision(_ifset('Jan rain inch', '0')) < 1,
label = makeLabel(args, true, 'معدل هطول الأمطار', 'rain'),
annual_mode = 'sum',
},
{---------- FIRST LINE SNOWFALL ----------
WANTROW = _ifany(' snow cm') or _ifany(' snow mm') or _ifany(' snow inch'),
mode = 'precipitation',
group_name = 'snow',
prefer_cm = true,
color_scheme = _ifset('snow colour', 'p'),
date_mode = true,
scale_factor = '1',
label = makeLabel(args, true, 'متوسط تساقط الثلوج', 'snow'),
annual_mode = 'sum',
},
{---------- SECOND LINE MAXIMUM HUMIDEX ----------
WANTROW = not _ifset('single line') and _ifany(' maximum humidex'),
mode = 'basic',
group_name = 'maximum humidex',
color_scheme = _ifset('temperature colour', 't'),
scale_factor = '1',
label = '[[قرينة الرطوبة]]',
annual_mode = 'max',
second_line = true,
},
{---------- SECOND LINE RECORD HIGH TEMPERATURES ----------
WANTROW = not _ifset('single line') and (_ifany(' record high C') or _ifany(' record high F')),
mode = 'temperature',
group_name = 'record high',
second_line = true,
color_scheme = _ifset('temperature colour', 't'),
scale_factor = '1',
label = 'الدرجة القصوى °' .. _if('metric first', 'ف', 'م'),
annual_mode = 'max',
},
{---------- SECOND LINE AVERAGE HIGH TEMPERATURES ----------
WANTROW = not _ifset('single line') and (_ifany(' high C') or _ifany(' high F')),
mode = 'temperature',
group_name = 'high',
second_line = true,
color_scheme = _ifset('temperature colour', 't'),
scale_factor = '1',
label = 'متوسط درجة الحرارة الكبرى °' .. _if('metric first', 'ف', 'م'),
annual_mode = 'avg',
},
{---------- SECOND LINE DAILY MEAN TEMPERATURES ----------
WANTROW = not _ifset('single line') and (_ifany(' mean C') or _ifany(' mean F')),
mode = 'temperature',
group_name = 'mean',
second_line = true,
color_scheme = _ifset('temperature colour', 't'),
scale_factor = '1',
label = 'المتوسط اليومي °' .. _if('metric first', 'ف', 'م'),
show = _if('metric first', '2', '1'),
annual_mode = 'avg',
},
{---------- SECOND LINE AVERAGE LOW TEMPERATURES ----------
WANTROW = not _ifset('single line') and (_ifany(' low C') or _ifany(' low F')),
mode = 'temperature',
group_name = 'low',
second_line = true,
color_scheme = _ifset('temperature colour', 't'),
scale_factor = '1',
label = 'متوسط درجة الحرارة الصغرى °' .. _if('metric first', 'ف', 'م'),
show = _if('metric first', '2', '1'),
annual_mode = 'avg',
},
{---------- SECOND LINE RECORD LOW TEMPERATURES ----------
WANTROW = not _ifset('single line') and (_ifany(' record low C') or _ifany(' record low F')),
mode = 'temperature',
group_name = 'record low',
second_line = true,
color_scheme = _ifset('temperature colour', 't'),
scale_factor = '1',
label = 'أدنى درجة حرارة °' .. _if('metric first', 'ف', 'م'),
show = _if('metric first', '2', '1'),
annual_mode = 'min',
},
{---------- SECOND LINE MINIMUM WIND CHILL ----------
WANTROW = not _ifset('single line') and (_ifany(' chill') and _if('metric first')),
mode = 'basic',
group_name = 'chill',
color_scheme = _ifset('temperature colour', 't'),
scale_factor = '1',
label = '[[تبريد الرياح]]',
annual_mode = 'min',
},
{---------- SECOND LINE TOTAL PRECIPITATION ----------
WANTROW = not _ifset('single line') and (_ifany(' precipitation cm') or _ifany(' precipitation mm') or _ifany(' precipitation inch')),
mode = 'precipitation',
group_name = 'precipitation',
second_line = true,
color_scheme = _ifset('precipitation colour', 'p'),
date_mode = true,
scale_factor = '1',
prefer_cm = precision(_ifset('Jan precipitation inch', '0')) < 1,
label = makeLabel(args, false, '[[هطول|الهطول]]', 'precipitation'),
annual_mode = 'sum',
},
{---------- SECOND LINE RAINFALL ----------
WANTROW = not _ifset('single line') and (_ifany(' rain cm') or _ifany(' rain mm') or _ifany(' rain inch')),
mode = 'precipitation',
group_name = 'rain',
second_line = true,
color_scheme = _ifset('rain colour', 'p'),
date_mode = true,
scale_factor = '1',
prefer_cm = precision(_ifset('Jan rain inch', '0')) < 1,
label = makeLabel(args, false, 'معدل هطول الأمطار', 'rain'),
annual_mode = 'sum',
},
{---------- SECOND LINE SNOWFALL ----------
WANTROW = not _ifset('single line') and (_ifany(' snow cm') or _ifany(' snow mm') or _ifany(' snow inch')),
mode = 'precipitation',
group_name = 'snow',
second_line = true,
prefer_cm = true,
color_scheme = _ifset('snow colour', 'p'),
date_mode = true,
scale_factor = '1',
label = makeLabel(args, false, 'متوسط تساقط الثلوج', 'snow'),
annual_mode = 'sum',
},
{---------- PRECIPITATION DAYS ----------
WANTROW = _ifany(' precipitation days'),
mode = 'basic',
group_name = 'precipitation days',
color_scheme = _ifset('precip days colour', 'd'),
date_mode = true,
scale_factor = '1',
label = 'متوسط أيام هطول الأمطار' .. _if('unit precipitation days',
' <span style="font-size:90%;" class="nowrap">(≥ ' .. _ifset('unit precipitation days', '') .. ')</span>'),
annual_mode = 'sum',
},
{---------- RAINY DAYS ----------
WANTROW = _ifany(' rain days'),
mode = 'basic',
group_name = 'rain days',
color_scheme = _ifset('precip days colour', 'd'),
date_mode = true,
scale_factor = '1',
label = 'متوسط الأيام الممطرة' .. _if('unit rain days',
' <span style="font-size:90%;" class="nowrap">(≥ ' .. _ifset('unit rain days', '') .. ')</span>'),
annual_mode = 'sum',
},
{---------- SNOWY DAYS ----------
WANTROW = _ifany(' snow days'),
mode = 'basic',
group_name = 'snow days',
color_scheme = _ifset('precip days colour', 'd'),
date_mode = true,
scale_factor = '1',
label = 'متوسط الأيام المثلجة' .. _if('unit snow days',
' <span style="font-size:90%;" class="nowrap">(≥ ' .. _ifset('unit snow days', '') .. ')</span>'),
annual_mode = 'sum',
},
{---------- PERCENT RELATIVE HUMIDITY ----------
WANTROW = _ifany(' humidity'),
mode = 'basic',
group_name = 'humidity',
color_scheme = _ifset('humidity colour', 'h'),
scale_factor = '1',
label = 'متوسط [[رطوبة نسبية|الرطوبة النسبية]] (%)' ..
_if('time day', ' <span style="font-size:90%;" class="nowrap">(at {{{time day}}})</span>') ..
_if('daily', ' <span style="font-size:90%;" class="nowrap">(daily average)</span>'),
annual_mode = 'avg',
},
{---------- AFTERNOON PERCENT RELATIVE HUMIDITY ----------
WANTROW = _ifany(' afthumidity'),
mode = 'basic',
group_name = 'afthumidity',
color_scheme = _ifset('humidity colour', 'h'),
scale_factor = '1',
label = 'Average afternoon [[رطوبة نسبية]] (%)' ..
_if('time day', ' <span style="font-size:90%;" class="nowrap">(at {{{time day}}})</span>') ..
_if('daily', ' <span style="font-size:90%;" class="nowrap">(daily average)</span>'),
annual_mode = 'avg',
},
{---------- MONTHLY SUNSHINE HOURS ----------
WANTROW = _ifany(' sun'),
mode = 'basic',
group_name = 'sun',
color_scheme = _ifset('sun colour', 's'),
date_mode = true,
scale_factor = '1',
label = 'ساعات سطوع الشمس الشهرية',
annual_mode = 'sum',
},
{---------- DAILY SUNSHINE HOURS ----------
WANTROW = _ifany('d sun'),
mode = 'basic',
group_name = 'd sun',
color_scheme = _ifset('sun colour', 's'),
include_space = false,
scale_factor = '30.44',
label = 'ساعات سطوع الشمس اليومية',
annual_mode = 'avg',
},
{---------- DAILY DAYLIGHT HOURS ----------
WANTROW = _ifany(' light'),
mode = 'basic',
group_name = ' light',
color_scheme = _ifset('sun colour', 's'),
include_space = false,
scale_factor = '30.44',
label = 'متوسط [[طول النهار]] اليومي',
annual_mode = 'avg',
},
{---------- PERCENT SUNSHINE ----------
WANTROW = _ifany(' percentsun'),
mode = 'basic',
group_name = 'percentsun',
color_scheme = _ifset('sun colour', 's'),
scale_factor = '7.2',
label = 'نسبة وصول أشعة الشمس',
annual_mode = 'avg',
},
{---------- ULTRAVIOLET INDEX ----------
WANTROW = _ifany(' uv'),
mode = 'basic',
group_name = 'uv',
color_scheme = _ifset('uv colour', 'u'),
scale_factor = '1',
label = 'متوسط [[مؤشر الأشعة فوق البنفسجية]]',
annual_mode = 'avg',
},
----------- SOURCES ----------
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').buildRow
--local args = frame:getParent().args or frame.args
--if not args then args = frame.args end
local args = frame:getParent().args
--if frame == mw.getCurrentFrame() then args = frame:getParent().args else args = frame.args end
for k, v in pairs( frame.args ) do
args[k] = v
end
local results = {}
local options = {}
for param, value in pairs(args) do
if value and mw.text.trim(value) ~= '' then
param2 = mw.ustring.gsub(param , "_", " ")
param2 = mw.ustring.gsub(param2 , "°", "")
param2 = mw.ustring.gsub(param2 , " Hi ", " high ")
param2 = mw.ustring.gsub(param2 , " Lo ", " low ")
param2 = mw.ustring.gsub(param2 , " Precip ", " precipitation ")
param2 = mw.ustring.gsub(param2 , " REC ", " record ")
param2 = mw.ustring.gsub(param2 , " MEAN ", " mean ")
param2 = mw.ustring.gsub(param2 , " Sun$", " sun")
param2 = mw.ustring.gsub(param2 , " Hum$", " humidity")
param2 = mw.ustring.gsub(param2 , " Rain ", " rain ")
param2 = mw.ustring.gsub(param2 , " Snow ", " snow ")
mw.log( param2 )
--options.param = value
--options.param2 = value
args[param2] = value
end
end
for i, def in ipairs(getDefinitions(frame, args)) do
local row
if type(def) == 'string' then
row = def
elseif def.WANTROW then
row = buildRow(makeFrame(def, args))
else
row = ''
end
results[i] = row
end
return '<div>\n'..table.concat(results)..'\n</div>' -- prevent Scribunto from inserting a blank line before the table
end
return {
main = main,
}