Modul:Routemap: Perbedaan antara revisi

Konten dihapus Konten ditambahkan
RaFaDa20631 (bicara | kontrib)
Indonesianisasi
RaFaDa20631 (bicara | kontrib)
Membalikkan revisi 26340061 oleh RaFaDa20631 (bicara)
Tag: Pembatalan
 
(11 revisi perantara oleh 2 pengguna tidak ditampilkan)
Baris 1:
local i18n = {
errors = {
["parameter-missing"] = "MissingKehilangan parameter!",
["collapsible-block-not-closed"] = "CollapsibleBagian sectionyang notdapat closeddiciutkan properlytidak ditutup dengan benar!",
["collapsible-block-not-open"] = "MissingTidak ada markah start-Collapsible markup!",
["collapsible-block-empty"] = "CollapsibleBagian sectionyang mustdapat notdiciutkan betidak emptyboleh kosong!",
["collapsible-block-no-first-row"] = "InvalidBaris firstpertama rowbagian ofyang collapsibledapat section!diciutkan tidak valid",
["collapsible-block-no-replacement"] = "InvalidBaris collapsiblepengganti replacementyang rowdapat diciutkan tidak valid!",
["colspan-less-rows-than-set"] = "InvalidSet colspan settidak valid!",
},
["error-categories"] = {
default = '[[Category:PagesHalaman withyang errorsmenggunakan ofRoutemap Moduledengan Routemapgalat]]',
["text-images"] = '[[Category:Halaman yang menggunakan Routemap dengan gambar teks]]',
["separate-navbar"] = '[[Category:Halaman yang menggunakan Routemap dengan templat navbar terpisah]]',
["missing-text-values"] = '[[Kategori:Halaman yang menggunakan BSto atau BSsrws tanpa nilai teks]]',
["br-tags"] = '[[Category:Halaman yang menggunakan BSto, BSsplit, BSsrws, atau BScvt dengan tag br]]',
["srws"] = '[[Category:Halaman yang menggunakan BSsplit alih-alih BSsrws]]',
["rmr-error"] = '[[Category:Halaman dengan nilai buruk untuk templat RoutemapRoute]]'
},
text = {
navbar_mini = false, -- for navbar pos 2 only
navbar_text = 'Diagram ini:', -- for navbar pos 2 only
legend_text = 'Legenda',
legend = {
default = '[[Template:Legenda jalur rel',
track = '[[Template:Legenda tata letak stasiun',
bus = '[[Template:Legenda rute bus',
canal = '[[Template:Legenda transportasi air',
water = '[[Template:Legenda transportasi air',
waterway = '[[Template:Legenda transportasi air',
foot = '[[Template:Trails legend',
footpath = '[[Template:Trails legend',
walkway = '[[Template:Trails legend'
}
},
html = {
["cell-icon-fmt"] = '\<div style="%s">[[File:BSicon_%s.svg|x20px|link=%s|alt=|%s]]%s</div>',
| ["cell-overlapicon-fmt"] = '<div class="RMic" style="padding:0%s"|>[[File:BSicon_%s.svg|x20px|link=%s|alt=|%s]]%s</div>',
["cell-overlapiconicon-fmt-with-overlap"] = '<div style="position:absolute;left:0px;top:0px;padding:0%s"><div class="RMov">%s</div><div%s>[[File:BSicon_%s.svg|x20px|link=%s|alt=|%s]]%s</div></div>',
["cell-text-fmt"] = '<div class="RMtx RM%s" style="%s"><div%s style="%s" title="%s">%s%s%s%s%s%s</div></div>',
["cell-icon-fmt-with-overlap"] = '\
| ["cell-overlaptext-fmt"] = '<div class="RMtx RM%s" style="padding:0%s"|><div%s style="position:relative%s" title=">%s</div"><div%s>[[File:BSicon_%s.svg|x20px|link=|alt=|%s]]%s%s</div></div>',
["cell-text-fmt-with-overlap"] = '<div class="RM%s" style="%s"><div class="RMov">%s</div><div class="RMtx RM%s" style="%s"><div%s style="%s" title="%s">%s%s%s%s%s%s</div></div></div>',
["cell-text-fmt"] = '\
["cell-empty-fmt"] = '<div class="RM%s" style="%s">%s</div>',
|style="padding:0;width:%s;min-width:%s;line-height:20px%s" title="%s"|<%s style="transform:scaleX(.9);line-height:.975;display:inline-block%s">%s%s%s%s</%s>',
["cell-overlaptextempty-fmt-with-overlap"] = '<div style="position:absolute;width:%s;min-width:%s;line-height:20px%s"><div titleclass="RMov">%s"</div><div class="RMsp RM%s" style="transform:scaleX(.9);line-height:.975;display:inline-block%s">%s%s%s</%sdiv></div>',
["cell-text-fmt-with-overlap"] = '\
|style="padding:0%s"|<div style="position:relative">%s</div><div style="width:%s;min-width:%s;line-height:20px%s" title="%s"><%s style="transform:scaleX(.9);line-height:.975;display:inline-block%s">%s%s%s%s</%s></div>',
["cell-empty-fmt"] = '\n|style="padding:0;width:%s;min-width:%s;height:20px;min-height:20px%s"|%s',
["cell-empty-fmt-with-overlap"] = '\n|style="padding:0%s"|<div style="position:relative">%s</div><div style="width:%s;min-width:%s;height:20px;min-height:20px%s">%s</div>',
 
["cell-filler-fmt"] = '\n|style<div class="padding:0; width:8pxRMf_"| ||style="padding:0; width:4px; background-color:%s"|><div class="RMfm" ||style="paddingbackground:0; width:8px%s"|></div></div>',
["cell-filler-empty-fmt"] = '\n|style<div class="padding:0;RMf_ width:20pxRM%s" style="%s"|></div>',
 
["row-linfo4-fmt"] = '\
|class="RMl4" style="width:auto;vertical-align:middle;padding:0 3px 0 0;text-align:left;%s"|<spandiv styleclass="font-size:90%%;RMsi">%s</spandiv>',-- parameters:linfo4-width, linfo4
["row-linfo3-fmt"] = '<spandiv styleclass="font-size:90%%;RMsi">%s</spandiv> ',
["row-rinfo3-fmt"] = ' <spandiv styleclass="font-size:90%%;RMsi">%s</spandiv>',
["row-rinfo4-fmt"] = '\
|class="RMr4" style="width:auto;vertical-align:middle;padding:0 0 0 3px;text-align:right;%s"|<spandiv styleclass="font-size:90%%;RMsi">%s</spandiv>',-- parameters:rinfo4-width, rinfo4
 
["row-general-fmt"] = '\
|- style="line-height:1" %s\
|class="RMl" colspan="%s" style="width:auto;vertical-align:middle;padding:0;text-align:right;%s"|%s\
|%s style="width:auto;vertical-align:middle;text-align:left;padding:0 %s;%s"|<spandiv styleclass="font-size:90%%;RMsi">%s</spandiv>\
|class="RMir" style="width:auto;padding:0%s"|%s\
|%s style="%s"|<div class="RMsi">%s</div>\
{|cellspacing="0" cellpadding="0" style="display: table; width: unset; line-height: 0; padding:0 !important; margin: 0 auto !important"\
|class="RMr" colspan="%s" style="%s"|%s%s',-- parameters: linfo4-fmt, colspan-left, linfo3+2-width, linfo3+2, linfo1-pad, linfo1-width, linfo1, bg, cells, rinfo1-pad, rinfo1-width, rinfo1, colspan-right, rinfo2+3-width, rinfo2+3, rinfo4-fmt
|- style="display:inline-table"%s\
|}\
|style="width:auto;vertical-align:middle;text-align:right;padding:0 %s;%s"|<span style="font-size:90%%;">%s</span>\
|colspan="%s" style="width:auto;vertical-align:middle;padding:0;text-align:left;%s"|%s%s',-- parameters: linfo4-fmt, colspan-left, linfo3+2-width, linfo3+2, linfo1-pad, linfo1-width, linfo1, bg, cells, rinfo1-pad, rinfo1-width, rinfo1, colspan-right, rinfo2+3-width, rinfo2+3, rinfo4-fmt
 
["row-collapsible-begin-fmt"] = '\
|- style="line-height:1"\
|colspan="7" style="padding:0 !important;background-color:%s"|\
{|class="RMcollapse %s%s" cellpadding="0" cellspacing="0" style="%s padding:0 !important;vertical-align:middle;margin:0 !important;white-space:nowrap"',-- parameters: bg, "collapsible "/"mw-collapsible mw-", collapse-state, "float:right" / ""
 
["row-collapsible-end-fmt"] = '\n|}',
Baris 58 ⟶ 73:
["row-collapsible-left-linfo4+3+2-fmt"] = '\
{|cellspacing="0" cellpadding="0" style="line-height:1;width:100%%;padding:0 !important;margin:0 !important"\
|style="width:auto;vertical-align:middle;padding:0 3px 0 1px;text-align:left"| <spandiv styleclass="font-size:90%%;RMsi">%s</spandiv>\
|style="width:auto;vertical-align:middle;text-align:right"| %s\
|}',-- parameters: linfo4, linfo3+2
["row-collapsible-right-button-width"] = '45px',-- 72px is the minimal width for [развернуть] / [свернуть] button at 90%. Use 58px for [expand] / [collapse]
["row-collapsible-right-rinfo2+3+4-fmt"] = '\
{|cellspacing="0" cellpadding="0" style="line-height:1;width:100%%;padding:0 !important;margin:0 !important"\
|style="width:auto;vertical-align:middle;text-align:left"| %s\
|style="width:auto;vertical-align:middle;padding:0 1px 0 3px;text-align:right"| <spandiv styleclass="font-size:90%%;RMsi">%s</spandiv>\
|}',-- parameters: rinfo2+3, linfo4
["row-collapsible-right-button-fmt"] = '\n| style="width:auto;vertical-align:middle;padding-left:3px;font-size:90%%;min-width:%s;%s" |',--parameters: right-button-width, rinfo4-width
 
["row-collapsible-replace-begin-fmt"] = '\
|- style="line-height:1"\
|colspan="7" style="padding:0 %s"|<div style="position:relative">\
{| cellspacingclass="0" cellpadding="0RMreplace" style="position:absolute;margin:0;bottom:0px;%svertical-align:middle;white-space:nowrap;background-colorsbackground:%s"',-- parameters: "right-button-width 0 0" / "0 0 left-button-width", "right:0px" / "", bg
["row-collapsible-replace-end-fmt"] = '\n|}</div>',
 
["colspan-fmt"] = '%s\n|-\n| colspan="7" style="background-color:%s;text-align:%s;%s"|\n%s',
["empty-row-fmt"] = '\n|-\n| style="width:auto;padding:0 3px 0 0;%s" |\n| style="width:auto;padding: 0;%s" |\n|%s style="width:auto;padding:0 %s;%s" |\n| style="width:auto;padding:0" |\n|%s style="width:auto;padding:0 %s;%s" |\n| style="width:auto;padding:0;%s" |\n| style="width:auto;padding:0 0 0 3px;%s" |'
}
}
local p,q={},{}
 
local getArgs = require('Module:Arguments').getArgs
 
local function makeInvokeFunction(funcName)
-- makes a function that can be returned from #invoke, using
-- [[Module:Arguments]].
return function (frame)
local args = getArgs(frame, {parentOnly = true})
return p[funcName](args)
end
end
 
local function formaterror(key,param)
local result = string.format(i18n.html['colspan-fmt'], '', '', '', '', '<span class="error">' .. string.format(i18n.errors[key] or (tostring(key) .. ' %s'),
tostring(param or '')) .. '</span>')
if mw.site.namespaces[mw.title.getCurrentTitle().namespace].isContent then result = result .. (i18n['errorserror-categories'][key] or i18n['errorserror-categories'].default or '') end
return result
end
Baris 98 ⟶ 124:
blue = '0078BE', ex_blue = '64ACD6',
brown = '8D5B2D', ex_brown = 'B89A7F',
carrot = 'ED9121', ex_carrot = 'F1BA76', excarrot = 'F1BA76', ex_excarrot = 'F3D2A9',
cerulean = '1A8BB9', ex_cerulean = '73B7D3',
cyan = '40E0D0', ex_cyan = '8AEAE1',
deepsky = '00BFFF', ex_deepsky = '7FDFFF',
denim = '00619F', ex_denim = '649EC3',
fuchsia = 'B5198D', ex_fuchsia = 'D173B8',
Baris 110 ⟶ 138:
maroon = '800000', ex_maroon = 'B16464',
ochre = 'CC6600', ex_ochre = 'DEA164',
olive = '837902', ex_olive = 'B2AC64',
orange = 'FF6600', ex_orange = 'FF9955',
pink = 'F0668D', ex_pink = 'F4A1B8',
purple = '8171AC', ex_purple = 'B1A8CB',
red = 'EF161E', ex_red = 'F37176',
ruby = 'CC0066', ex_ruby = 'DE64A1', exruby = 'DE64A1', ex_exruby = 'E89FC4',
saffron = 'FFAB2E', ex_saffron = 'FFC969',
sky = '069DD3', ex_sky = '67C2E3',
steel = 'A1B3D4', ex_steel = 'C4CFE3',
teal = '339999', ex_teal = '82C0C0', exteal = '82C0C0', ex_exteal = 'B1D6D6',
violet = '800080', ex_violet = 'B164B1',
yellow = 'FFD702', ex_yellow = 'FFEB81',
}
return colors[code] or colors.bahn
end
 
p.RGBbyCode = makeInvokeFunction('_RGBbyCode')
 
function p._RGBbyCode(args)
return RGBbyCode(args[1])
end
 
Baris 189 ⟶ 224:
end
return {y, z}
end
 
local function widths(p)
local values = {['w'] = 160, ['bs'] = 120, ['s'] = 80, ['b'] = 40, [''] = 20, ['cd'] = 15, ['d'] = 10, ['c'] = 5,} -- in px
return values[p]
end
 
Baris 207 ⟶ 237:
 
]]
local tmp, tmp2, cellProps, iconProps, overlapProps, tmp_sep, link, tracking, icontext, iconpre, width = {}, {}, {}, {}, {}, '', '', ''
if #overlapIcons > 0 then
tmp = mw.text.split(overlapIcons[#overlapIcons], '!_')
Baris 213 ⟶ 243:
tmp = mw.text.split(overlapIcons[#overlapIcons], '!@')
overlapIcons[#overlapIcons] = tmp[1]
if #tmp > 1 then link = tmp[2] end
tmp = mw.text.split(icon, '__')
icon = tmp[1]
Baris 223 ⟶ 253:
end
else
tmp = mw.text.split(icon, '[!_]_')
if #tmp > 1 then icon, cellProps = tmp[1], properties(tmp[2]) end
tmp = mw.text.split(icon, '!@')
Baris 236 ⟶ 266:
if textspl ~= 1 then iconpre = mw.text.trim(mw.ustring.sub(icon, 1, textspl - 1)) end
end
cellProps.class = ''
if cellProps.style then cellProps.style = ';'..cellProps.style else cellProps.style = '' end
cellProps.bg = cellProps.bg or cellProps.background or cellProps.bgcolor
Baris 247 ⟶ 278:
if not cellProps.fontsize or rowProps.fontsize or cellProps.fontsize == 'info' then
elseif cellProps.fontsize == 'cmt' or cellProps.fontsize == 'comment' then
cellProps._before, cellProps._after = '<spandiv styleclass="font-size:90%;RMsi">', '</spandiv>'
else
cellProps.style = cellProps.style..';font-size:'..cellProps.fontsize
Baris 254 ⟶ 285:
rowProps.align = rowProps.align or {'middle', 'center'}
cellProps.align = alignment(cellProps.align, rowProps.align[1], rowProps.align[2]) or rowProps.align
cellProps.style, cellProps.textfmt = cellProps.style..';vertical-align:'..cellProps.align[1]..';text-align:'..cellProps.align[2], ';vertical-align:'..cellProps.align[1]
else
cellProps.textfmt = ''
cellProps.style, cellProps.textfmt = cellProps.style..';vertical-align:middle;text-align:center', ';vertical-align:middle;text-align:center'
end
end
Baris 262 ⟶ 293:
tmp = {}
for i, v in ipairs(overlapIcons) do
iflocal ithislink ~= #overlapIcons then link = '' end
if link and linki ~= ''#overlapIcons then icontipthislink = link'' end
if thislink and thislink ~= '' then icontip = thislink end
if overlapProps[i].style then overlapProps.style = ';'..overlapProps[i].style else overlapProps.style = '' end
overlapProps[i].bg = overlapProps[i].bg or overlapProps[i].background or overlapProps[i].bgcolor
Baris 269 ⟶ 301:
local tmp_textspl = string.find(v, '%*')
if tmp_textspl then
overlapProps.class = ''
local tmp_icontext, tmp_iconpre = mw.text.trim(mw.ustring.sub(v, tmp_textspl + 1)), ''
if tmp_textspl ~= 1 then tmp_iconpre = mw.text.trim(mw.ustring.sub(v, 1, tmp_textspl - 1)) end
Baris 278 ⟶ 311:
if rowProps.fontsize or cellProps.fontsize or overlapProps[i].fontsize == 'info' then
elseif not overlapProps[i].fontsize then
overlapProps.styleclass = overlapProps.style..';font-size:10px class="RMts"'
elseif overlapProps[i].fontsize == 'cmt' or overlapProps[i].fontsize == 'comment' then
overlapProps._before, overlapProps._after = '<spandiv styleclass="font-size:90%;RMsi">', '</spandiv>'
else
overlapProps.style = overlapProps.style..';font-size:'..overlapProps[i].fontsize
Baris 287 ⟶ 320:
cellProps.align = cellProps.align or {'middle', 'center'}
overlapProps.align = alignment(overlapProps[i].align, cellProps.align[1], cellProps.align[2]) or cellProps.align
overlapProps.style, overlapProps.textfmt = overlapProps.style..';vertical-align:'..overlapProps.align[1]..';text-align:'..overlapProps.align[2], ';vertical-align:'..overlapProps.align[1]
else
overlapProps.style, overlapProps.textfmt = overlapProps.style..';vertical-align:middle;text-align:center', ';vertical-align:middle;text-align:center'
end
if overlapProps[i].abbr then
overlapProps.tag = {'<abbr title="'..string.gsub(overlapProps[i].abbr, '"', '&quot;')..'">', '</abbr>'}
else
overlapProps.tag = {'span', 'span'}
end
table.insert(tmp, string.format(i18n.html['cell-overlaptext-fmt'], (tmp_iconpre and tmp_iconpre ~= '' and tmp_iconpre or '_'), overlapProps.style, overlapProps.class, overlapProps.textfmt, icontip, overlapProps.tag[1], overlapProps._before, tmp_icontext, overlapProps._after, overlapProps.tag[2]))
width = (widths(tmp_iconpre) or 20)..'px'
table.insert(tmp, string.format(i18n.html['cell-overlaptext-fmt'], width, width, overlapProps.style, icontip, overlapProps.tag[1], overlapProps.textfmt, overlapProps._before, tmp_icontext, overlapProps._after, overlapProps.tag[2]))
else
v = mw.text.trim(v)
if string.find(v, 'num') then
if not string.find(v, 'numN%d+') then tracking = tracking..(i18n['error-categories'][[Category:Pages using Routemap with 'text -images']] or i18n['error-categories'].default) end
end
table.insert(tmp, string.format(i18n.html['cell-overlapicon-fmt'], overlapProps.style, v, linkthislink, icontip))
end
end
Baris 309 ⟶ 341:
iconProps.bg = iconProps.bg or iconProps.background or iconProps.bgcolor
if iconProps.bg then iconProps.style = iconProps.style..';background:'..iconProps.bg end
if string.match(icon, '^[%+_]?o?c?d?b?s?w?$') then
width = widths(icon)
if width then
if tmp2[1] then iconProps.style = ';'..iconProps.style end
return string.format(i18n.html['cell-empty-fmt-with-overlap'], cellProps.style, mw.text.trim(table.concat(tmp)), width(string..'px'match(icon, width.'^.+$') or 'px_'), iconProps.style, tracking)
elseif icontext then
iconProps.class = ''
iconProps._before, iconProps._after = cellProps._before, cellProps._after
iconProps.color = iconProps.color or iconProps.colour ; iconProps.bold = iconProps.bold or iconProps.b ; iconProps.italic = iconProps.italic or iconProps.i or iconProps.it
Baris 321 ⟶ 353:
if rowProps.fontsize or cellProps.fontsize or iconProps.fontsize == 'info' then
elseif not iconProps.fontsize then
iconProps.styleclass = iconProps.style..';font-size:10px class="RMts"'
elseif iconProps.fontsize == 'cmt' or iconProps.fontsize == 'comment' then
iconProps._before, iconProps._after = '<spandiv styleclass="font-size:90%;RMsi">', '</spandiv>'
else
iconProps.style = iconProps.style..';font-size:'..iconProps.fontsize
Baris 330 ⟶ 362:
cellProps.align = cellProps.align or {'middle', 'center'}
iconProps.align = alignment(iconProps.align, cellProps.align[1], cellProps.align[2]) or cellProps.align
iconProps.style, iconProps.textfmt = iconProps.style..';vertical-align:'..iconProps.align[1]..';text-align:'..iconProps.align[2], ';vertical-align:'..iconProps.align[1]
else
iconProps.style, iconProps.textfmt = iconProps.style..';vertical-align:middle;text-align:center', ';vertical-align:middle;text-align:center'
end
if iconProps.abbr then
iconProps.tag = {'<abbr title="'..string.gsub(iconProps.abbr, '"', '&quot;')..'">', '</abbr>'}
else
iconProps.tag = {'span', 'span'}
end
if tmp2[1] then iconProps.style = ';'..iconProps.style end
return string.format(i18n.html['cell-text-fmt-with-overlap'], (iconpre and iconpre ~= '' and iconpre or '_'), cellProps.style, mw.text.trim(table.concat(tmp)), (iconpre and iconpre ~= '' and iconpre or '_'), iconProps.style, iconProps.class, iconProps.textfmt, icontip, iconProps.tag[1], iconProps._before, icontext, iconProps._after, tracking, iconProps.tag[2])
width = (widths(iconpre) or 20)..'px'
return string.format(i18n.html['cell-text-fmt-with-overlap'], cellProps.style, mw.text.trim(table.concat(tmp)), width, width, iconProps.style, icontip, iconProps.tag[1], iconProps.textfmt, iconProps._before, icontext, iconProps._after, tracking, iconProps.tag[2])
else
if iconProps.style ~= '' then iconProps.style = string.gsub(' style="'..iconProps.style..'"', '";', '"', 1) end
if string.find(icon, 'num') then
if not string.find(icon, 'numN%d+') then tracking = tracking..(i18n['error-categories'][[Category:Pages using Routemap with 'text -images']] or i18n['error-categories'].default) end
end
return string.format(i18n.html['cell-icon-fmt-with-overlap'], cellProps.style, mw.text.trim(table.concat(tmp)), iconProps.style, icon, icontip, tracking)
end
end
if string.match(icon, '^[%+_]?o?c?d?b?s?w?$') then
width = widths(icon)
return string.format(i18n.html['cell-empty-fmt'], (string.match(icon, '^.+$') or '_'), cellProps.style, tracking)
if width then
return string.format(i18n.html['cell-empty-fmt'], width..'px', width..'px', cellProps.style, tracking)
else
if link and link ~= '' then icontip = link end
if icontext then
if not cellProps.fontsize and not rowProps.fontsize then cellProps.styleclass = cellProps.style..';font-size:10px class="RMts"' end
if cellProps.abbr then
cellProps.tag = {'<abbr title="'..string.gsub(cellProps.abbr, '"', '&quot;>')..'">', '</abbr>'}
else
cellProps.tag = {'span', 'span'}
end
return string.format(i18n.html['cell-text-fmt'], (iconpre and iconpre ~= '' and iconpre or '_'), cellProps.style, cellProps.class, cellProps.textfmt, icontip, cellProps.tag[1], cellProps._before, icontext, cellProps._after, tracking, cellProps.tag[2])
width = (widths(iconpre) or 20)..'px'
return string.format(i18n.html['cell-text-fmt'], width, width, cellProps.style, icontip, cellProps.tag[1], cellProps.textfmt, cellProps._before, icontext, cellProps._after, tracking, cellProps.tag[2])
else
if string.find(icon, 'num') then
if not string.find(icon, 'numN%d+') then tracking = tracking..(i18n['error-categories'][[Category:Pages using Routemap with 'text -images']] or i18n['error-categories'].default) end
end
return string.format(i18n.html['cell-icon-fmt'], cellProps.style, icon, link, icontip, tracking)
Baris 373 ⟶ 402:
end
 
local function fillercell(code, height)
--Creates a 5px-high row.
--Values in icon pattern can only be [blank], d, [BSicon color] or #[hex triplet].
height = mw.text.trim(height)
if code == '' then
if height ~= '' then
return string.format(i18n.html['cell-filler-empty-fmt'], '20px', '20px')
if tonumber(height) then height = height..'px' end
elseif code == 'd' then
height = 'height:'..height..';min-height:'..height
return string.format(i18n.html['cell-filler-empty-fmt'], '10px', '10px')
end
if string.match(code, '^[%+_]?o?c?d?b?s?w?$') then
return string.format(i18n.html['cell-filler-empty-fmt'], (string.match(code, '^.+$') or '_'), height)
elseif mw.ustring.sub(code,1,1) == '#' then
return string.format(i18n.html['cell-filler-fmt'], height, code)
else
return string.format(i18n.html['cell-filler-fmt'], height, '#'..RGBbyCode(code))
end
end
Baris 393 ⟶ 425:
 
]]
local result = {['linfo4'] = '', ['linfo3+2'] = '', ['linfo1'] = '', rowstyle = '', ['cells'] = {}, ['rinfo1'] = '', ['rinfo2+3'] = '', ['rinfo4'] = '', ['rowProp'] = {}}
local lcolspan, rcolspan, linfo4_fmt, rinfo4_fmt = '2', '2', '', ''
local left, right, icons, overlapIcons, tmp = {}, {}, {}, {}, mw.text.split(pattern, '! !')
Baris 448 ⟶ 480:
-- The below parameter functions are passed through to the cells.
if result.rowProp.fontsize == 'cmt' or result.rowProp.fontsize == 'comment' then
result.rowProp._before, result.rowProp._after = '<spandiv styleclass="font-size:90%;RMsi">', '</spandiv>'
end
if result.rowProp.align then
Baris 456 ⟶ 488:
icons = mw.text.split(tmp[1], '\\')--splitting the string of icons first by "\"
if type(filler) == 'string' then
result.style = ';font-size:0px'
result['cells'][1] = 'style="height:' .. filler .. '"'--row parameter before any cells
for i, v in ipairs(icons) do table.insert(result['cells'], fillercell(v, filler)) end--no !@ or !~ for filler row
else
result.style = ''
for i, v in ipairs(icons) do
tmp = mw.text.split(v, '!~')
Baris 468 ⟶ 501:
end
result['cells'] = table.concat(result['cells'])
if result.rowProp.style then result.style = result.style..';'..result.rowProp.style else result.style = '' end
result.rowProp.bg = result.rowProp.bg or result.rowProp.background or result.rowProp.bgcolor ; result.rowProp.color = result.rowProp.color or result.rowProp.colour ; result.rowProp.bold = result.rowProp.bold or result.rowProp.b ; result.rowProp.italic = result.rowProp.italic or result.rowProp.i or result.rowProp.it
if result.rowProp.bg then result.style = result.style..';background:'..result.rowProp.bg end
Baris 474 ⟶ 507:
if positive(result.rowProp.italic) then result.style = result.style..';font-style:italic' end
if positive(result.rowProp.bold) then result.style = result.style..';font-weight:bold' end
if result.rowProp.align then
result.style = result.style..';vertical-align:'..result.rowProp.align[1]..';text-align:'..result.rowProp.align[2]
else
result.style = result.style..';vertical-align:middle;text-align:center'
end
if result.rowProp.fontsize and result.rowProp._after == '' and result.rowProp.fontsize ~= 'info' then
result.style = result.style..';font-size:'..result.rowProp.fontsize
Baris 491 ⟶ 519:
 
--↓ This table handles diagram rows beginning with a hyphen ("-").
q = {collapsibles = -1, text_width = {'', '', '', '', '', ''}, linfo1_pad = '3pxclass="RMl1"', rinfo1_pad = '3pxclass="RMr1"', bg = '#F9F9F9'}
q.isKeyword = function(pattern, i, rows, justTest)
if mw.ustring.sub(pattern, 1, 1) ~= '-' then if justTest then return false else return nil end end--not a valid keyword
Baris 506 ⟶ 534:
if tmp then
if tmp == 'endCollapsible' then return formaterror('collapsible-block-empty')
else return formaterror('collapsible-block-no-first-row') .. q.isKeyword(rows[i], i, rows) --no valid keywords that can follow "startCollapsible"
end
end
Baris 578 ⟶ 606:
end
q['filler'] = function(params, i, rows)
local tmp, height = table.concat(params, '-', 3), (params[2] or '5px')
if #params < 3 or tmp == '' then return formaterror('parameter-missing') end--TODO: specify the name of the parameter
if params[2] ~= '' then height = params[2] end
Baris 588 ⟶ 616:
end
 
local function localroute(pattern,ptw,pbg,process)
local tmp = {}
if mw.text.trim(pbg) ~= '' then q.bg = pbg end
Baris 634 ⟶ 662:
end
tmp = {}
 
local index = 0
local rows = {}
if not process or process == '' or negative(process) then
pattern = mw.ustring.gsub(pattern, '\n(#[0-9a-fA-F][0-9a-fA-F][0-9a-fA-F])', '%1')
end
for item in pattern:gmatch('([^\n]*)\n?') do
item = mw.text.trim(item)
Baris 659 ⟶ 690:
q.text_width[1] = q.text_width[1] .. 'min-width:' .. i18n.html['row-collapsible-left-button-width'] .. ';'
else
q.text_width[6] = q.text_width[6] .. 'min-width:' .. i18n.html['row-collapsible-right-button-width'] .. ';'
end
end
-- ↓ empty row to set column widths; ↑ if q.collapsibles ≠ -1 and there are collapsible sections, leftmost or rightmost column should be wide enough to accomodate the button
table.insert(tmp, string.format(i18n.html['empty-row-fmt'], q.text_width[1], q.text_width[2], q.linfo1_pad, q.text_width[3], q.rinfo1_pad, q.text_width[4], q.text_width[5], q.text_width[6]))
return mw.ustring.gsub(mw.ustring.gsub(mw.ustring.gsub(mw.ustring.gsub(mw.ustring.gsub(mw.ustring.gsub(mw.ustring.gsub(table.concat(tmp), 'style=";* *', 'style="'), '\n| *style="" *|', '\n|'), ' ?style=""', ''), ' ?colspan="1"', ''), '<div class="RMsi"></div>', ''), 'class="RM%+', 'class="RM_'), '(class="[^"]* RM)%+', '%1_')
return table.concat(tmp)
end
 
local function getArgNums(prefix, args)
local getArgs = require('Module:Arguments').getArgs
-- Copied from Module:Infobox on enwiki.
 
-- Returns a table containing the numbers of the arguments that exist
local function makeInvokeFunction(funcName)
-- for the specified prefix. For example, if the prefix were 'data', and
-- makes a function that can be returned from #invoke, using
-- 'data1', 'data2', and 'data5' existed, this would return {1, 2, 5}.
-- [[Module:Arguments]].
local nums = {}
return function (frame)
for k, v in pairs(args) do
local args = getArgs(frame, {parentOnly = true})
local num = tostring(k):match('^' .. prefix .. '([1-9]%d*)$')
return p[funcName](args)
if num then table.insert(nums, tonumber(num)) end
end
table.sort(nums)
end
return nums
 
local function getArgNums(prefix, args)
-- Copied from Module:Infobox on enwiki.
-- Returns a table containing the numbers of the arguments that exist
-- for the specified prefix. For example, if the prefix were 'data', and
-- 'data1', 'data2', and 'data5' existed, this would return {1, 2, 5}.
local nums = {}
for k, v in pairs(args) do
local num = tostring(k):match('^' .. prefix .. '([1-9]%d*)$')
if num then table.insert(nums, tonumber(num)) end
end
table.sort(nums)
return nums
end
 
Baris 698 ⟶ 718:
 
function p._infobox(args) -- Creates a pretty box.
args.map1, args.tw, args['map1-title'], args['map1-collapsible'], args['map1-collapsedcollapse'] = args.map1 or args.map, args.tw or args['text-width'] or args['text width'], args['map1-title'] or args['map-title'], args['map1-collapsible'] or args['map-collapsible'], args['map1-collapse'] or args['map1-collapsed'] or args['map-collapse'] or args['map-collapsed']
local function map_prefix(x) return 'map'..x end
local mapnums, prefix = {}
Baris 711 ⟶ 731:
table.sort(mapnums)
end
local classes = {}
args['title bg color'] = args['title bg color'] or args['title-bg'] or '#27404E'
args['title bg color'] = args['title bg color'] or args['title bg'] or args['title-bg'] or '#27404E'
args['title color'] = args['title color'] or args['title-color'] or greatercontrast{args['title bg color'], '#FFF', rgb_black}
args.legend = args.legend or ''
local navbar = require('Module:Navbar').navbar
local navtable = {}
args.navbar = args.navbar or args.tnavbar
if args.navbar then
navtable = {args.navbar, textmini = 'Thisi18n.text.navbar_mini, diagram:'text = i18n.text.navbar_text}
args.navbar = navbar(navtable)
else
Baris 730 ⟶ 750:
args.collapsible = '0'
else
result = result .table.insert(classes, 'class="collapsible ')
if args.collapse then result = result .table.insert(classes, 'collapsed') end
result = result .. '" '
end
args.float = args.float or 'right'
Baris 744 ⟶ 763:
args.fontsize2 = 10000/88
if args.inline then
table.insert(classes, 'RMinline')
args.inline2 = 'float:none;width:100%;margin:0;border:none;'
args.fontsize = 100
else
table.insert(classes, 'RMbox')
args.inline2 = 'box-shadow: 0 2px 2px 0 rgba(0, 0, 0, 0.14), 0 1px 5px 0 rgba(0, 0, 0, 0.12), 0 3px 1px -2px rgba(0, 0, 0, 0.2); -moz-box-shadow: 0 2px 2px 0 rgba(0, 0, 0, 0.14), 0 1px 5px 0 rgba(0, 0, 0, 0.12), 0 3px 1px -2px rgba(0, 0, 0, 0.2); -webkit-box-shadow: 0 2px 2px 0 rgba(0, 0, 0, 0.14), 0 1px 5px 0 rgba(0, 0, 0, 0.12), 0 3px 1px -2px rgba(0, 0, 0, 0.2);'
args.fontsize = 88 -- as above: CSS rule for .infobox in %
end
args.bg = args.bg or '#F9F9F9'
args.style = args.style or ''
result = result .. 'class="' .. table.concat(classes, ' ') .. '" cellspacing="0" cellpadding="0" style="float:' .. args.float .. ';clear:' .. args.float .. ';margin-top:0;margin-bottom:1em;' .. args.margin .. 'empty-cells:show;border-collapse:collapse;font-size:' .. args.fontsize .. '%;background:' .. args.bg .. ';' .. args.inline2 .. args.style .. '"'
args.title = args.title or ''
if args.inline or args.title == 'no' or args.title == '0' then
Baris 779 ⟶ 798:
end
end
result = result .. 'font-size:'..args.fontsize2..'%;">' .. args.title .. '</div></div>'
end
args.top = args.top or args['on top']
Baris 790 ⟶ 809:
result = result .. '<div style="float:left;padding-right:5px">' .. args.navbar .. '</div>'
end
args.legend2 = argsmw.ustring.legend:lower(args.legend)
if args.legend2 ~= 'no' and args.legend2 ~= '0' then
args.legend = i18n.text.legend[args.legend2] or ((args.legend2 ~= '') and ('[['..args.legend) or i18n.text.legend.default)
local legtable = {['water']={'canal','water','waterway'},['foot']={'foot','footpath','walkway'}}
args.legend = args.legend .. '|' .. (args['legend alt'] or i18n.text.legend_text) .. ']]'
for k, v in pairs(legtable) do
result = result .. '<div class="selfreference noprint" style="text-align:right;font-size:97%">' .. args.legend .. '</div>'
for _, name in ipairs(v) do
if args.legend2 == name then args.legend2 = k end
end
end
if args.legend2 == 'water' then args.legend = '[[Template:Waterways legend'
elseif args.legend2 == 'foot' then args.legend = '[[Template:Trails legend'
elseif args.legend2 == 'bus' then args.legend = '[[Template:Bus route legend'
elseif args.legend2 == 'track' then args.legend = '[[Template:Legenda jalur rel'
elseif args.legend ~= '' then args.legend = '[[' .. args.legend
else args.legend = '[[Template:Legenda jalur rel'
end
if args['legend alt'] then
args.legend = args.legend .. '|' .. args['legend alt'] .. ']]'
else
args.legend = args.legend .. '|Legenda]]'
end
result = result .. '<div class="selfreference noprint" style="text-align:right;font-size:90%;">' .. args.legend .. '</div>'
end
if args.inline then args.padding2 = '0px' else args.padding2 = '0px 6px' end
Baris 820 ⟶ 823:
if args['map'..v..'-title'] then
args.header_margin = '0'
if k == 1 then args.border_header = 'border-bottom: 5px solid '..args.bg..';' else args.border_header = 'border-top: 5px solid '..args.bg..'; border-bottom: 5px solid '..args.bg..';' end
if positive(args['map'..v..'-collapsible']) then
args.header_margin = '0 55px'
args.ending = '\n|}'
if positive(args['map'..v..'-collapse']) or positive(args['map'..v..'-collapsed']) then args.map_collapsed = ' mw-collapsed autocollapse' else args.map_collapsed = '' end
result = result..'\n|-\n|\n{|class="mw-collapsible'..args.map_collapsed..'" cellpadding="0" cellspacing="0" style="display: table; min-width:100%; margin:0 auto;"'
end
if args.inline then args.header_style2 = ' style="line-height:normal;"' else args.header_style2 = '' end
result = result..'\n|-'..args.header_style2..'\n!style="'..args.border_header..'padding:3px 5px; text-align:center; vertical-align:middle; color:'..rgb_black..'; background-color: #EEEEEE" | <div style="margin:'..args.header_margin..';font-size:'..10000/args.fontsize..'%;">'..args['map'..v..'-title']..'</div>'
args.border_top = ''
else
if k == 1 then args.border_top = '' else args.border_top = 'border-top: 5px solid '..args.bg..';' end
end
result = result .. '\n|-\n|style="'..args.border_top..'padding:' .. args.padding2 .. '"|\n{|cellpadding="0" cellspacing="0" class="nogrid routemap" style="padding:0px;border:0px;background:transparent;white-space:nowrap;line-height:1.2;font-size:'..(args.fontsize2 * 0.95)..'%;margin:auto"\n'..localroute(args[prefix(v)], (args['tw'..v] or args['text-width'..v] or args['text width'..v] or args.tw or ''), args.bg, args.process)..'\n|}'..args.ending
end
args.bottom = args.bottom or args.footnote
Baris 839 ⟶ 842:
if args.inline then args.padding2 = '6px' else args.padding2 = '0px' end
result = result .. '\n|-\n|style="line-height:normal;text-align:right;padding:' .. args.padding2 .. ' 5px 5px;'..(args.bottomstyle or args.footnotestyle or '')..'"|' .. args.bottom
if string.find(args.bottom, '&action=edit') then result = result .. (i18n['error-categories'][[Category:Pages using Routemap with a 'separate -navbar template]'] or i18n['error-categories'].default) end
end
if args.navbar ~= '' and args['navbar pos'] == '2' then
if negative(args['navbar long']) or positive(args['navbar mini']) then navtable.mini = true; args.navbar = navbar(navtable) end
if args.inline and not args.bottom then args.padding2 = '6px' else args.padding2 = '0px' end
result = result .. '\n|-\n|style="line-height:normal;padding:' .. args.padding2 .. ' 5px 3px;text-align:center"|' .. args.navbar .. '</div>'
end
return result .. '\n|}'
Baris 860 ⟶ 863:
end
style = style or ''
local result = '&#32;<table cellspacing="0" cellpadding="0" class="RMsplit" style="font-size:80%; font-weight:inherit; color:inherit; background-color:transparent; margin-top:-2px; margin-bottom:-2px; display:inline-table; vertical-align:middle; text-align:'..align
if italic or it == 'all' then result = result..';font-style:italic' end
if bold then result = result..';font-weight:bold' end
Baris 866 ⟶ 869:
result = result..';'..style..'">'..rowstart..lh
if line then result = result..';border-bottom:1px solid gray' end
local bgpad = ';padding-left:0.5em;padding-right:0.5em'
local function bgtext(v)
return ';color:'..greatercontrast{v, '#FFF', rgb_black}
end
if bg1 then
result = result..bgpad..bgtext(bg1)..';background-color:'..bg1
elseif bg2 then
result = result..bgpad
Baris 887 ⟶ 890:
if bs == 'srws' then
if stn then
link = t1stn..' '..t2t1..' '..stnt2
else
link = t1..'Stasiun '..t2t1..' railway station'..t2
end
elseif bs == 'cvt' then
Baris 900 ⟶ 903:
['ch'] = 20.1168,
['mi;ch'] = 80,
['m'] = 1 / 0.9144,
['yd'] = 0.9144,
['ft'] = 0.3048,
}
local sf = { -- 10 ^ floor(log10(cvt[inp]) + 0.5); or 10 ^ floor(log10(cvt[inps[1]] * cvt[inp]) + 0.5) for dual-unit inputs. this corrects the accuracy of result so that it usually has same significant figures
['mi'] = 1,
['ch'] = 10,
['mi;ch'] = 1/100.01,
['m'] = 1,
['yd'] = 1,
['ft'] = .1/10,
}
if not inp then inp = 'mi' end
Baris 934 ⟶ 937:
t1 = v1..'&nbsp;'..outp
v1 = tonumber(v1)
t2 = floor(v1 / cvt[inps[1]])..'&nbsp;'..inps[1]..'&nbsp;'..floor(v1 % cvt[inps[1]] / cvt[inps[1]] * cvt[inp] * mult * sf[inp] + 0.5) / mult / sf[inp]..'&nbsp;'..inps[2]
else
v1 = split(trim(v1), ';')
t1 = v1[1]..'&nbsp;'..inps[1]..'&nbsp;'..v1[2]..'&nbsp;'..inps[2]
t2 = floor((tonumber(v1[1]) * cvt[inps[1]] + tonumber(v1[2]) * cvt[inps[1]] / cvt[inp]) * mult / sf[inp] + 0.5) / mult * sf[inp]..'&nbsp;'..outp
end
else
if swap then
v2 = floor(tonumber(v1) / cvt[inp] * mult * sf[inp] + 0.5) / mult / sf[inp]
inp, outp = outp, inp
else
v2 = floor(tonumber(v1) * cvt[inp] * mult / sf[inp] + 0.5) / mult * sf[inp]
end
t1 = v1..'&nbsp;'..inp
Baris 961 ⟶ 964:
result = result..rowend..rowstart..lh
if bg2 then
result = result..bgpad..bgtext(bg2)..';background-color:'..bg2
elseif bg1 then
result = result..bgpad
Baris 981 ⟶ 984:
result = result..rowend..'</table>&#32;'
if bs == 'to' or bs == 'srws' then
if t1 == '&nbsp;' or t2 == '&nbsp;' then result = result..'(i18n['error-categories'][Category:Pages using BSto or BSsrws with 'missing -text -values']] or i18n['error-categories'].default) end
end
if string.find(t1, '<br ?/?>') ~= nil or string.find(t2, '<br ?/?>') ~= nil then result = result..(i18n['error-categories'][[Category:Pages using BSto, BSsplit, BSsrws'br-tags'] or BScvt with br tagsi18n['error-categories']]'.default) end
if bs == 'split' then
if link and t1 and t2 then
if string.find(link, '^'..t1..' '..t2..' ') then result = result..(i18n['error-categories'][[Category:Pages'srws'] usingor BSsplit instead of BSsrws]]i18n['error-categories'].default) end
end
end
Baris 998 ⟶ 1.001:
args[4] = args[4] or args.it or args.i
args[5] = args[5] or args.b
return base(args[1],args[2],args[3],nil,nil,args[4],nil,args[5],args.align,args.style,args.bg1,args.bg2,args.line,'105%','92%inherit','0.9',nil,nil,nil,'to')
end
 
Baris 1.007 ⟶ 1.010:
args[4] = args[4] or args.it or args.i
args[5] = args[5] or args.b
return base(args[1],args[2],args[3],nil,args[4],nil,nil,args[5],args.align,args.style,args.bg1,args.bg2,args.line,'inherit','inherit','0.9',nil,nil,nil,'split')
end
 
Baris 1.016 ⟶ 1.019:
args[4] = args[4] or args.it or args.i
args[5] = args[5] or args.b
return base(args[1],args[2],nil,args[3],args[4],nil,nil,args[5],args.align,args.style,args.bg1,args.bg2,args.line,'inherit','inherit','0.9',nil,nil,nil,'srws')
end
 
Baris 1.022 ⟶ 1.025:
 
function p._BScvt(args)
return base(nil,nil,nil,nil,nil,nil,args.alt,nil,args.align,args.style,args.bg1,args.bg2,args.line,'inherit','inherit','0.9',args[1],args[2],args['in'],'cvt')
end
 
Baris 1.061 ⟶ 1.064:
end
if not result then
return '<span style="color:#f00">Invalid [[Template:RoutemapRoute]] arrow value "<span style="font-style:italic">'..d..'</span>".[[Category:Pages with bad value for RoutemapRoute template]]</span>'..(i18n['error-categories']['rmr-error'] or i18n['error-categories'].default)
else
return result
Baris 1.114 ⟶ 1.117:
end
local count, icons, overlaps, overlapCalc = tonumber(args['$count']) or 1, {}, {}, math.log10(args.n)
local text = (args.text and '*') or ''
if overlapCalc == math.floor(overlapCalc) then overlapCalc = 10^(overlapCalc) else overlapCalc = 10^(math.floor(overlapCalc) + 1) end
while count <= args.n do
local cellparams, overlapn = {}, (string.match(count/overlapCalc, '%.(0+)') or '')..count
table.insert(icons, (text..(args[count] or '')))
if args['O'..overlapn] then
local iconparams, overlapparams, overlapt = {}, {}, {}
Baris 1.137 ⟶ 1.141:
end
if overlapparams[1] then args['O'..overlapn..v] = args['O'..overlapn..v]..'__'..table.concat(overlapparams, ',') end
table.insert(overlapt, text..args['O'..overlapn..v])
end
overlaps = '!~'..text..args['O'..overlapn]..'!~'..table.concat(overlapt, '!~')
else
overlaps = '!~'..text..args['O'..overlapn]
end
icons[count] = icons[count]..overlaps
Baris 1.197 ⟶ 1.201:
 
Creates Routemap syntax for a diagram row based on parameters.
Simplified version; an in-app upgrade to the full version costs US$0.99.
Intended to be used to substitute legacy templates.
Note that for compatibility the link and sidebar parameter names are different.
Baris 1.209 ⟶ 1.212:
end
local count, icons, overlaps, overlapCalc = tonumber(args['$count']) or 1, {}, {}, math.log10(args.n)
local text = (args.text and '*') or ''
if overlapCalc == math.floor(overlapCalc) then overlapCalc = 10^(overlapCalc) else overlapCalc = 10^(math.floor(overlapCalc) + 1) end
while count <= args.n do
local cellparams, overlapn = {}, (string.match(count/overlapCalc, '%.(0+)') or '')..count
table.insert(icons, (text..(args[count] or '')))
if args['O'..overlapn] then
local overlapt = {}
Baris 1.218 ⟶ 1.222:
table.sort(overlaps)
if overlaps[1] then
for i, v in ipairs(overlaps) do table.insert(overlapt, text..args['O'..overlapn..v]) end
overlaps = '!~'..text..args['O'..overlapn]..'!~'..table.concat(overlapt, '!~')
else
overlaps = '!~'..text..args['O'..overlapn]
end
icons[count] = icons[count]..overlaps
Baris 1.279 ⟶ 1.283:
 
]]
local org = mw.text.unstripNoWiki(frame.args[1]) or 'Paste legacy RDT markupsmarkup between the nowiki tags')
local res = org
res = string.gsub(res, '{{[Bb][Ss]%-?map', '{{Routemap') -- "%-" is an escape for hyphen which is used as "between" in pattern.
res = string.gsub(res, '{|%s?{{[Rr]ailway line header}}', '{{Routemap')
res = string.gsub(res, '{{[Bb][Ss]%-header%d?|', '{{safesubst:BS-header/safesubst|') -- "%d?" means optional digit in case use of variant template like BS-header3.
res = string.gsub(res, '{{[Bb][Ss]%-table%d?}}', '|map =')
res = string.gsub(res, '{{[Bb][Ss](%d?)(%d?)|', '{{safesubst:BS%1%2/safesubst|')
res = string.gsub(res, '{{[Bb][Ss](%d?)(%d?)%-replace|', '!replace{{safesubst:BS%1%2/safesubst|')
res = string.gsub(res, '{{[Bb][Ss](%d?)(%d?)%-startCollapsible|', '-startCollapsible-collapsed\n{{safesubst:BS%1%2/safesubst|')
res = string.gsub(res, '{{[Bb][Ss](%d?)(%d?)%-sc|', '-startCollapsible-collapsed\n{{safesubst:BS%1%2/safesubst|')
res = string.gsub(res, '{{[Bb][Ss](%d?)(%d?)%-2text|', '{{safesubst:BS%1%2-2/safesubst2text|')
res = string.gsub(res, '{{[Bb][Ss](%d?)(%d?)%-2|', '{{safesubst:BS%1%2-2|')
res = string.gsub(res, '{{[Bb][Ss](%d?)(%d?)%-2replace|', '!replace{{safesubst:BS%1%2-2|')
res = string.gsub(res, '{{[Bb][Ss](%d?)(%d?)%-2sc|', '-startCollapsible-collapsed\n{{safesubst:BS%1%2-2|')
res = string.gsub(res, '{{!}}}', '-endCollapsible-')
res = string.gsub(res, '{{[Ee]nd}}', '-endCollapsible-')
res = string.gsub(res, '|}\n?|}', '}}') -- Replace ending of Railway line header map setup.
res = string.gsub(res, '{{[Bb][Ss]%-colspan}}\n{{safesubst', '{{safesubst') -- BS-colspan is unnecessary and would cause error in Routemap.
res = string.gsub(res, '{{[Bb][Ss]%-colspan}}\n%-%-%-%-', '-colspan-2\n----')
res = string.gsub(res, '&lt;', '<')
res = string.gsub(res, '&gt;', '>')
if string.find(res, '!replace') or string.find(res, '{{[Bb][Ss]|%ds*bg%-?2?texts*=') then
local restable = mw.text.split(res, '\n')
for i, v in ipairs(restable) do
Baris 1.306 ⟶ 1.311:
restable[i-2] = string.gsub(restable[i-2], 'collapsed', 'collapsed-replace')
end
if (string.find(v, '|%s*bg%s*=%s*#?[a-zA-Z0-9]+') or string.find(v, '|%s*bg%s*=%s*#?{{[^{}]+}}%s*|') or string.find(v, '|%s*bg%s*=%s*#?{{[^{}]+}}%s*}}')) and string.find(restable[i-1], '^-startCollapsible') then
if string.find(v, '{{[Bb][Ss]%d*text') then
local bg = string.match(v, '|%s*bg%s*=%s*(#?[a-zA-Z0-9]+)') or string.find(v, '|%s*bg%s*=%s*(#?{{[^{}]+}})%s*|') or string.find(v, '|%s*bg%s*=%s*(#?{{[^{}]+}})%s*}}')
local tmp = {}
restable[i] = mw.text.split(string.gsub(string.gsub(restable[i], '^{{[Bb][Ss](|%d?)(s*bg%d?)text', '%1s*=%2s*')..bg, '}}$', ''), '|')
restable[i][-1] = tonumber(string.matchgsub(restable[i][-1], '%d+-?$', '--bg=')) or 1..bg
forif q, r in ipairsstring.find(restable[i+1], '!replace') dothen
restable[i+1] = string.gsub(restable[i+1], '!replace', '')
if q > 1 then
if qrestable[i-1] <= string.gsub(restable[i][-1], 'collapsed%-', then'collapsed-replace')
if (string.find(restable[i+1], '|%s*bg%s*=%s*#?[a-zA-Z0-9]+') or string.find(restable[i+1], '|%s*bg%s*=%s*#?{{[^{}]+}}%s*|') or string.find(restable[i+1], '|%s*bg%s*=%s*#?{{[^{}]+}}%s*}}')) then
if r ~= '' then table.insert(tmp, '*'..r..'\\') else table.insert(tmp, '\\') end
local bg2 = string.match(restable[i+1], '|%s*bg%s*=%s*(#?[a-zA-Z0-9]+)') or string.find(restable[i+1], '|%s*bg%s*=%s*(#?{{[^{}]+}})%s*|') or string.find(restable[i+1], '|%s*bg%s*=%s*(#?{{[^{}]+}})%s*}}')
elseif q == (restable[i][1] + 1) then
if rbg2 ~== ''bg then tablerestable[i+1] = string.insertgsub(tmprestable[i], '|%s*bg%s*=%s*'..rbg2, '') end
elseif q == (restable[i][1] + 2) then
if #restable[i] == q then table.insert(tmp, '~~'..r) else table.insert(tmp, '~~ ~~'..(r or ' ')) end
elseif q > (restable[i][1] + 2) then
table.insert(tmp, '~~'..(r or ' '))
end
end
end
restable[i] = table.concat(tmp)
end
if string.find(v, '{{[Bb][Ss]%d*%-2text') then
local tmp = {}
restable[i] = mw.text.split(string.gsub(string.gsub(restable[i], '^{{[Bb][Ss](%d?)(%d?)%-2text', '%1%2'), '}}$', ''), '|')
restable[i][1] = tonumber(string.match(restable[i][1], '%d+')) or 1
for q, r in ipairs(restable[i]) do
if q > 1 then
if q <= restable[i][1] then
if r ~= '' then table.insert(tmp, '*'..r..'\\') else table.insert(tmp, '\\') end
elseif q == (restable[i][1] + 1) then
if r ~= '' then table.insert(tmp, '*'..r) end
elseif q == (restable[i][1] + 2) then
if not restable[i][restable[i][1] + 4] or restable[i][restable[i][1] + 4] == '' then
if r ~= '' then table.insert(tmp, 1, r..'! !') end
elseif r ~= '' then
table.insert(tmp, 1, r..'~~! !')
end
elseif q == (restable[i][1] + 3) then
if #restable[i] == q or #restable[i] == q+1 then
if r ~= '' then table.insert(tmp, '~~'..r) end
else
table.insert(tmp, '~~ ~~'..(r or ' '))
end
elseif q == (restable[i][1] + 4) then
if r ~= '' then table.insert(tmp, 1, r..'~~') end
elseif q > (restable[i][1] + 4) then
table.insert(tmp, '~~'..(r or ' '))
end
end
end
restable[i] = table.concat(tmp)
end
end