Content deleted Content added
No edit summary |
sync |
||
Line 136:
local gsub = mw.ustring.gsub
local function getLine(data,
if
if data['aliases'] then
end
local default = data['lines']['_default'] or {}
local line = data['lines'][
for k, v in pairs(default) do
if v then line[k] = line[k] or v end
end
line['title'] = line['title'] and gsub(line['title'], '%%1',
return line,
end
end
Line 172:
local match = mw.ustring.match
local concat = table.concat
local
local function getStation(station, _Format)
if type(_Format) == 'table' then
_Format = _Format[
if type(_Format) == 'table' then
_Format = _Format[
end
end
if
if
return (match(_Format, '%[%[.+%]%]')) and (gsub(_Format, '%%1', station)) or concat({'[[', gsub(_Format, '%%1', station), '|', station, ']]'})
end
Line 318:
end
if data[v]['aliases'] then
if
end
-- get the line table
local line = data[v]['lines'] and (mw.clone(data[v]['lines'][
local default = data[v]['lines']['_default'] or {}
line['title'] = line['title'] or default['title']
line['title'] = gsub(line['title'], '%%1',
-- cell across row for non-stop service
Line 336:
concat({'\n|-\n|colspan="5" ',
style['body cell'],
((args[v]['nonstop'] == 'former') and i18n[lang]['nonstop_past'] or i18n[lang]['nonstop_present'])(p._box({data = data[v], line =
})
)
Line 346:
local color, background_color
local Type = line['types'] and line['types'][
if Type then
Line 377:
or i18n[lang]['terminus']) .. "''"
else
local
local
-- If the terminus table has more than one numbered key or has the via key then the table shows only the default termini, since
if type(
if args[v]['to-' .. b] then
local _or = match(
if _or then
end
local _via = (match(
if _via then
elseif _or then
end
else
end
elseif type(
end
Line 407:
local subText = (args[v]['oneway-' .. b] or line['oneway-' .. b]) and i18n[lang]['oneway']
or args[v][b] ==
or line['circular'] and
or i18n[lang]['towards'](station(
subText = small(subText, true)
Line 422:
-- Type; table key 'types' in subpages (datatype table, with strings as keys). If table does not exist then the input is displayed as the text
(
-- Note-mid; table key 'note-mid' in subpages. Overridden by user input
Line 491:
function p._box(args, frame)
local system = args[1] or args.system
local
if not (system or
local line, Type, line_data
local inline = args[3] or args.inline
local
local data = args.data
if system or data then
Line 502:
if data then
local default = data['lines']['_default'] or {}
line,
if
Type = line['types'] and line['types'][
end
color = getColor(data, nil,
if inline ~= 'box' then
line_data = line or error(i18n[lang]['error_unknown'](
line = line_data['title'] or default['title'] or error(i18n[lang]['error_missing']('title'))
line = gsub(line, '%%1',
end
else
color = getColor(nil, system,
if inline ~= 'box' then
line = frame:expandTemplate{ title = system .. ' lines', args = {
if mw.text.trim(line) == '' then return error(i18n[lang]['error_unknown'](
end
Type =
end
Line 572:
local border_color, text_color
if line_data then
if line_data['types'] and line_data['types'][
local Type_data = line_data['types'][
border_color = Type_data['border color'] or line_data['border color'] or color
text_color = Type_data['text color'] or line_data['text color']
else
border_color = line_data['border color'] or color
text_color = line_data['text color']
end
else
Line 590:
if inline == 'route' then -- [[Template:RouteBox]]
if link then
result = '<span style="background-color:#' .. color .. ';border:.075em solid #' .. border_color .. ';padding:0 .3em">[[' .. link .. '|<span style="color:' .. text_color .. bold .. ';font-size:inherit;white-space:nowrap">' ..
else
result = '<span style="background-color:#' .. color .. ';border:.075em solid #' .. border_color .. ';padding:0 .3em;color:' .. text_color .. bold .. ';font-size:inherit;white-space:nowrap">' ..
end
elseif inline == 'croute' then -- [[Template:Bahnlinie]]
if link then
result = '<span style="background-color:#' .. color .. ';border:.075em solid #' .. border_color .. ';border-radius:.5em;padding:0 .3em">[[' .. link .. '|<span style="color:' .. text_color .. bold .. ';font-size:inherit;white-space:nowrap">' ..
else
result = '<span style="background-color:#' .. color .. ';border:.075em solid #' .. border_color .. ';border-radius:.5em;padding:0 .3em;color:' .. text_color .. bold .. ';font-size:inherit;white-space:nowrap">' ..
end
elseif inline == 'xroute' then -- [[Template:Bahnlinie]]
if link then
result = '<span style="border:.075em solid #' .. border_color .. ';border-radius:.5em;padding:0 .3em">[[' .. link .. '|<span style="color:#' .. color .. bold .. ';font-size:inherit;white-space:nowrap">' ..
else
result = '<span style="border:.075em solid #' .. border_color .. ';border-radius:.5em;padding:0 .3em;color:#' .. color .. bold .. ';font-size:inherit;white-space:nowrap">' ..
end
else -- [[Template:Legend]] (fallback; duplication to simplify logic)
Line 715:
else
line = frame:expandTemplate{ title = system .. ' lines', args = {line, ['branch'] = Type} }
if mw.text.trim(line) == '' then return error(i18n[lang]['error_unknown'](
end
Line 735:
local station = args[2] or args.station
if not station then return '' end
local
local
local data = args.data
if system or data then
Line 744:
if _Format then
if data['aliases'] then
if
end
if
end
end
Line 756:
end
else
station = frame:expandTemplate{ title = system .. ' stations', args = {['station'] = station, ['line'] =
end
|