Module:Sandbox/BrandonXLF/3: Difference between revisions

Content deleted Content added
Add seen
Theme navbox-image
 
(47 intermediate revisions by the same user not shown)
Line 1:
-- Sandbox, do not delete
 
return {
local p = {}
aria_label = 'Navbox',
local parser = require('Module:Road data/parser').parser
nowrap_item = '%s<span class="nowrap">%s</span>',
 
templatestyles = mw.getCurrentFrame():extensionTag{
function p.subpages()
name = 'templatestyles', args = { src = 'User:BrandonXLF/styles2.css' }
local subpages = {
},
'AFR',
hlist_templatestyles = 'Hlist/styles.css',
'ALB',
plainlist_templatestyles = 'Plainlist/styles.css',
'AND',
-- do not localize marker table
'ARE',
marker = {
'ARG',
oddeven = '\127_ODDEVEN_\127',
'ARM',
restart = '\127_ODDEVEN0_\127',
'ASIA',
regex = '\127_ODDEVEN(%d?)_\127'
'AUS',
},
'AUT',
category = {
'AZE',
orphan = '[[Category:Navbox orphans]]',
'BEL',
horizontal_lists = 'Navigational boxes without horizontal lists',
'BEN',
background_colors = 'Navboxes using background colours',
'BGD',
illegible = 'Potentially illegible navboxes',
'BGR',
borders = 'Navboxes using borders',
'BIH',
},
'BLR',
keyword = {
'BLZ',
border_subgroup = 'subgroup',
'BOL',
border_child = 'child',
'BRA',
border_none = 'CANnone',
evenodd_swap = 'swap',
'CAN/AB',
navbar_off = 'CAN/BCoff',
navbar_plain = 'plain',
'CAN/MB',
nocat_false = 'false',
'CAN/NB',
nowrapitems_yes = 'yes',
'CAN/NL',
orphan_yes = 'CAN/NSyes',
state_collapsed = 'collapsed',
'CAN/NT',
state_off = 'CAN/ONoff',
state_plain = 'plain',
'CAN/PE',
subgroups = {'subgroup', 'child', ''},
'CAN/QC',
subpage_doc = 'doc',
'CAN/SK',
subpage_sandbox = 'sandbox',
'CAN/YT',
subpage_testcases = 'testcases',
'CHE',
tracking_no = 'no'
'CHL',
},
'CHN',
class = {
'COL',
autocollapse = 'autocollapse',
'CRI',
collapsible = 'mw-collapsible',
'CYP',
collapsed = 'mw-collapsed',
'CZE',
-- Warning
'DEU',
navbox = 'navbox', -- WMF currently hides 'navbox' from mobile,
'DJI',
-- so you probably shouldn't change the navbox class.
'DNK',
navbox_abovebelow = 'navbox-abovebelow notheme',
'DZA',
navbox_group = 'navbox-group notheme',
'ECU',
navbox_image = 'navbox-image',
'ESP',
navbox_inner = 'navbox-inner notheme',
'EST',
navbox_list = 'navbox-list notheme',
'EUR',
navbox_list_with_group = 'navbox-list-with-group',
'FIN',
navbox_part = 'navbox-', -- do not l10n
'FRA',
navbox_styles = 'navbox-styles',
'GBR',
navbox_subgroup = 'navbox-subgroup',
'GEO',
navbox_title = 'navbox-title notheme', -- l10n only if you change pattern.navbox_title below
'GHA',
navbox_odd_part = 'odd', -- do not l10n
'GIB',
navbox_even_part = 'even', -- do not l10n
'GRC',
nomobile = 'HKGnomobile',
nowraplinks = 'nowraplinks',
'HRV',
noviewer = 'noviewer' -- used to remove images from MediaViewer
'HUN',
},
'IDN',
pattern = {
'IMN',
listnum = '^list(%d+)$',
'IND',
class = 'IRLclass',
sandbox = 'IRN/sandbox$',
navbox = 'Template:Navbox',
'IRQ',
nowrap = '^<span class="nowrap">',
'ISL',
style = 'ISRstyle$',
navbox_title = '<th[^>]*"navbox%-title"',
'ITA',
hlist = 'JAMhlist',
plainlist = 'plainlist',
'JOR',
},
'JPN',
arg = {
'KAM',
above = 'KAZabove',
aboveclass = 'aboveclass',
'KGZ',
abovestyle = 'abovestyle',
'KOR',
basestyle = 'basestyle',
'KOS',
bodyclass = 'bodyclass',
'LAO',
bodystyle = 'bodystyle',
'LKA',
border = 'LSOborder',
below = 'LTUbelow',
belowclass = 'belowclass',
'LUX',
belowstyle = 'belowstyle',
'LVA',
evenodd = 'MDAevenodd',
evenstyle = 'evenstyle',
'MEX',
group1 = 'MKDgroup1',
group2 = 'MMRgroup2',
group_and_num = 'group%d',
'MNE',
groupstyle_and_num = 'group%dstyle',
'MTQ',
groupclass = 'groupclass',
'MYS',
groupstyle = 'groupstyle',
'NAM',
groupwidth = 'groupwidth',
'NIC',
innerstyle = 'innerstyle',
'NIR',
image = 'NLDimage',
imageclass = 'imageclass',
'NOR',
imageleft = 'imageleft',
'NPL',
imageleftstyle = 'imageleftstyle',
'NZL',
imagesetyle = 'imagestyle',
'OMN',
list_and_num = 'list%d',
'PAK',
listclass_and_num = 'list%dclass',
'PER',
liststyle_and_num = 'list%dstyle',
'PHL',
list1padding = 'list1padding',
'PK',
listclass = 'listclass',
'POL',
listpadding = 'listpadding',
'PRT',
liststyle = 'liststyle',
'ROU',
name = 'RUSname',
navbar = 'SADnavbar',
navboxclass = 'navboxclass',
'SRB',
nocat = 'SVKnocat',
nowrapitems = 'nowrapitems',
'SVN',
oddstyle = 'SWEoddstyle',
orphan = 'THAorphan',
state = 'TURstate',
style = 'TWNstyle',
templatestyles = 'templatestyles',
'UKR',
child_templatestyles = 'child templatestyles',
'URY',
title = 'USAtitle',
titleclass = 'titleclass',
'USA/AK',
titlestyle = 'titlestyle',
'USA/AL',
tracking = 'tracking'
'USA/AR',
},
'USA/AS',
-- names of navbar arguments
'USA/AZ',
navbar = {
'USA/CA',
'USA/CO'name = 1,
fontstyle = 'fontstyle',
'USA/CT',
mini = 'USA/DCmini',
'USA/DE',
'USA/FL',
'USA/GA',
'USA/GU',
'USA/HI',
'USA/IA',
'USA/ID',
'USA/IL',
-- 'USA/IN',
'USA/KS',
'USA/KY',
'USA/LA',
'USA/MA',
'USA/MD',
'USA/ME',
'USA/MI',
'USA/MN',
'USA/MO',
'USA/MP',
'USA/MS',
'USA/MT',
'USA/NC',
'USA/ND',
'USA/NE',
'USA/NH',
'USA/NJ',
'USA/NM',
'USA/NV',
'USA/NY',
'USA/OH',
'USA/OK',
'USA/OR',
'USA/PA',
'USA/PR',
'USA/RI',
'USA/SC',
'USA/SD',
'USA/TN',
'USA/TX',
'USA/UT',
'USA/VA',
'USA/VI',
'USA/VT',
'USA/WA',
'USA/WI',
'USA/WV',
'USA/WY',
'UZB',
'VEN',
'VNM',
'ZAF'
}
}
local out = ''
local seen = {}
for _, subpage in ipairs(subpages) do
local data = require('Module:Road data/strings/' .. subpage)
if type(data) == 'table' then
for roadType, info in pairs(data) do
local localOut = ''
local shield = parser({
['route'] = '1',
['state'] = subpage:gsub('.+/', '')
}, 'shield', roadType, 'Module:Road data/strings/' .. subpage)
if type(shield) == 'table' then
shield = shield[0]
end
if shield then
localOut = localOut .. ('[[File:%s|x25px|alt=|link=]]'):format(shield)
end
local shieldmain = parser({
['route'] = '1',
['state'] = subpage:gsub('.+/', '')
}, 'shieldmain', roadType, 'Module:Road data/strings/' .. subpage)
if type(shieldmain) == 'table' then
shieldmain = shieldmain[0]
end
 
if shieldmain then
localOut = localOut .. ('[[File:%s|x25px|alt=|link=]]'):format(shieldmain)
end
if not seen[localOut] and localOut ~= '' then
out = out .. '<br>' .. localOut .. ' ' .. subpage .. ' ' .. roadType
seen[localOut] = true
end
end
end
end
return out
end
 
return p