Модуль:MoscowMetro: различия между версиями

[отпатрулированная версия][отпатрулированная версия]
Содержимое удалено Содержимое добавлено
Калининско-Солнцевская линия
Обсуждение:Московский метрополитен#13 линия: ТПК=Каховская, КожЛ - розовая
Строка 18:
},
html = {
icon_fmt = '<span title="%s">[[File:Moskwa Metro Line %s.svg|%sspx|%s|link=%s]]</span>', -- parameters: alt, linenum, icon size, alt, link
text_fmt = '[[%s|<span style="display:inline-block;line-height:%spx;height:%spx;font-size:%spx;font-weight:bold;background:#%s;color:white;text-align:center" title="%s">&#8239;%s&#8239;</span>]]', --[[
parameters: link, icon size, icon size, icon size - 3, color, alt, linenum ]]
small = '<span style="font-size:85%%">%s</span>',
style = '<span style="%s">%s</span>',
nowrap = '<span style="white-space:nowrap">%s</span>',
sortkey = '<span style="display:none" class="sortkey">%s</span>',
},
Строка 30 ⟶ 31 :
},
default = {
icon_size = '15px15'
}
}
i18n.NAMES['СолЛ'] = i18n.NAMES['8']; i18n.NAMES['КСЛ'] = i18n.NAMES['8'];
i18n.NAMES['13'] = i18n.NAMES['ТПККожЛ']; --по умолчанию пока ТПККожЛ будет считаться тринадцатой линией, если КожЛ станет таковойчто, поменяем.
i18n.NAMES['L1'], i18n.NAMES['Л1'] = i18n.NAMES['12'], i18n.NAMES['12']; --для совместимости с предыдущими версиями шаблонов
 
Строка 70 ⟶ 71 :
['11'] = '79CDCD', -- Каховская
['12'] = 'ACBFE1', -- Бутовская
['13'] = 'F09E36', -- Третий пересадочный контур / Кожуховскаявременно
['КожЛ'] = 'CC0066', -- Кожуховская
['М1'] = '2C87C5', -- Московский монорельс
}
COLORS['ТПК'] = COLORS['1311'] ;-- COLORS['КожЛ']Третий =пересадочный COLORS['13'] ; COLORS['Кожуховская']контур = COLORS['13']Каховская
COLORS['Кожуховская'] = COLORS['КожЛ']
COLORS['СолЛ'] = COLORS['8'] ; COLORS['Солнцевская'] = COLORS['8'] ; COLORS['КСЛ'] = COLORS['8']
COLORS['L1'], COLORS['Л1'] = COLORS['12'], COLORS['12'];
 
function IconByNum(num)
if num == 'ТПК' or num == 'КожЛ' then return '13'nil
elseif num == 'М1' then return 'M1'
elseif num == 'КСЛ' or num == 'СолЛ' then return '8'
Строка 98 ⟶ 101 :
local num, station, station_dabbed, CPIC = frame.args['line'] or '', frame.args['station'] or '', frame.args['station_dabbed'] or '', frame.args['CPIC'] or '' ~= ''
local icon_size, alt, text, small, style = frame.args['size'] or '', frame.args['alt'] or '', frame.args['text'] or '', frame.args['small'] or '', frame.args['style'] or ''
local icon, station_stripped
if not i18n.NAMES[num] then return '[[Категория:Википедия:Статьи с неверно заданными параметрами модуля MoscowMetro]]' end
local iconN = IconByNum(num)
if icon_size == '' then
icon_size = i18n.default.icon_size
elseif tonumbermw.ustring.sub(icon_size), then-2 icon_size) = icon_size ..= 'px' then
icon_size = mw.ustring.sub(icon_size, 1, -3 )
end
if alt == '' then
Строка 117 ⟶ 122 :
end
local link = text == '' and (station_dabbed ~= '' and station_dabbed or (station ~= '' and station .. i18n.text.dab or i18n.link(num))) or i18n.link(num)
if iconN then
local icon = mw.ustring.format(i18n.html.sortkey, mw.ustring.len(iconN) == 2 and iconN or '0' .. iconN) .. mw.ustring.format(i18n.html.icon_fmt, alt, iconN or '', icon_size, alt, link)
else
icon = mw.ustring.format(i18n.html.text_fmt, link, icon_size, icon_size, tonumber(icon_size) - 3, COLORS[num], alt, num)
end
if text == '' then return icon end
local result = ''
Строка 132 ⟶ 141 :
end
if small ~= '' then result = mw.ustring.format(i18n.html.small, result) end
return (not iconN and station == '' and station_dabbed == '' and '' or icon .. ' &nbsp;') .. result
end