https://en.wikipedia.org/w/index.php?action=history&feed=atom&title=Module%3ARoad_data%2Flocations
Module:Road data/locations - Revision history
2025-05-25T13:13:55Z
Revision history for this page on the wiki
MediaWiki 1.45.0-wmf.2
https://en.wikipedia.org/w/index.php?title=Module:Road_data/locations&diff=1242046971&oldid=prev
MusikBot II: Protected "Module:Road data/locations": High-risk template or module: 5429 transclusions (more info) ([Edit=Require template editor access] (indefinite) [Move=Require template editor access] (indefinite))
2024-08-24T18:00:12Z
<p>Protected "<a href="/wiki/Module:Road_data/locations" title="Module:Road data/locations">Module:Road data/locations</a>": <a href="/wiki/Wikipedia:High-risk_templates" title="Wikipedia:High-risk templates">High-risk template or module</a>: 5429 transclusions (<a href="/wiki/User:MusikBot_II/TemplateProtector" title="User:MusikBot II/TemplateProtector">more info</a>) ([Edit=Require template editor access] (indefinite) [Move=Require template editor access] (indefinite))</p>
<table style="background-color: #fff; color: #202122;" data-mw="interface">
<tr class="diff-title" lang="en">
<td colspan="1" style="background-color: #fff; color: #202122; text-align: center;">← Previous revision</td>
<td colspan="1" style="background-color: #fff; color: #202122; text-align: center;">Revision as of 18:00, 24 August 2024</td>
</tr><tr><td colspan="2" class="diff-notice" lang="en"><div class="mw-diff-empty">(No difference)</div>
</td></tr></table>
MusikBot II
https://en.wikipedia.org/w/index.php?title=Module:Road_data/locations&diff=1241903659&oldid=prev
BrandonXLF: BrandonXLF moved page Module:Road data/routelist to Module:Road data/locations: Renaming to reflect functionality
2024-08-23T20:11:00Z
<p>BrandonXLF moved page <a href="/w/index.php?title=Module:Road_data/routelist&action=edit&redlink=1" class="new" title="Module:Road data/routelist (page does not exist)">Module:Road data/routelist</a> to <a href="/wiki/Module:Road_data/locations" title="Module:Road data/locations">Module:Road data/locations</a>: Renaming to reflect functionality </p>
<table style="background-color: #fff; color: #202122;" data-mw="interface">
<tr class="diff-title" lang="en">
<td colspan="1" style="background-color: #fff; color: #202122; text-align: center;">← Previous revision</td>
<td colspan="1" style="background-color: #fff; color: #202122; text-align: center;">Revision as of 20:11, 23 August 2024</td>
</tr><tr><td colspan="2" class="diff-notice" lang="en"><div class="mw-diff-empty">(No difference)</div>
</td></tr></table>
BrandonXLF
https://en.wikipedia.org/w/index.php?title=Module:Road_data/locations&diff=1241903604&oldid=prev
BrandonXLF: Keep shield and link functions at Module:Road data
2024-08-23T20:10:36Z
<p>Keep shield and link functions at <a href="/wiki/Module:Road_data" title="Module:Road data">Module:Road data</a></p>
<a href="//en.wikipedia.org/w/index.php?title=Module:Road_data/locations&diff=1241903604&oldid=1042986876">Show changes</a>
BrandonXLF
https://en.wikipedia.org/w/index.php?title=Module:Road_data/locations&diff=1042986876&oldid=prev
Fredddie: adj
2021-09-07T19:40:31Z
<p>adj</p>
<table style="background-color: #fff; color: #202122;" data-mw="interface">
<col class="diff-marker" />
<col class="diff-content" />
<col class="diff-marker" />
<col class="diff-content" />
<tr class="diff-title" lang="en">
<td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">← Previous revision</td>
<td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">Revision as of 19:40, 7 September 2021</td>
</tr><tr>
<td colspan="2" class="diff-lineno">Line 18:</td>
<td colspan="2" class="diff-lineno">Line 18:</td>
</tr>
<tr>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br /></td>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br /></td>
</tr>
<tr>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>-- Shields</div></td>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>-- Shields</div></td>
</tr>
<tr>
<td class="diff-marker" data-marker="−"></td>
<td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div>local defaultShieldSize = <del style="font-weight: bold; text-decoration: none;">24</del></div></td>
<td class="diff-marker" data-marker="+"></td>
<td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div>local defaultShieldSize = <ins style="font-weight: bold; text-decoration: none;">30</ins></div></td>
</tr>
<tr>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br /></td>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br /></td>
</tr>
<tr>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>local function addContextBanner(route, name, suffix, bannerSpec)</div></td>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>local function addContextBanner(route, name, suffix, bannerSpec)</div></td>
</tr>
</table>
Fredddie
https://en.wikipedia.org/w/index.php?title=Module:Road_data/locations&diff=1042986701&oldid=prev
Fredddie: Restored revision 1038824744 by Fredddie (talk): Rv
2021-09-07T19:39:21Z
<p>Restored revision 1038824744 by <a href="/wiki/Special:Contributions/Fredddie" title="Special:Contributions/Fredddie">Fredddie</a> (<a href="/wiki/User_talk:Fredddie" title="User talk:Fredddie">talk</a>): Rv</p>
<table style="background-color: #fff; color: #202122;" data-mw="interface">
<col class="diff-marker" />
<col class="diff-content" />
<col class="diff-marker" />
<col class="diff-content" />
<tr class="diff-title" lang="en">
<td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">← Previous revision</td>
<td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">Revision as of 19:39, 7 September 2021</td>
</tr><tr>
<td colspan="2" class="diff-lineno">Line 196:</td>
<td colspan="2" class="diff-lineno">Line 196:</td>
</tr>
<tr>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br /></td>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br /></td>
</tr>
<tr>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>function p.link(route)</div></td>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>function p.link(route)</div></td>
</tr>
<tr>
<td class="diff-marker" data-marker="−"></td>
<td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div> local abbr, errMsg =<del style="font-weight: bold; text-decoration: none;"> parser(route, 'name') or</del> parser(route, 'abbr')</div></td>
<td class="diff-marker" data-marker="+"></td>
<td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div> local abbr, errMsg = parser(route, 'abbr')</div></td>
</tr>
<tr>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> if not abbr then</div></td>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> if not abbr then</div></td>
</tr>
<tr>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> route.typeerror = true</div></td>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> route.typeerror = true</div></td>
</tr>
</table>
Fredddie
https://en.wikipedia.org/w/index.php?title=Module:Road_data/locations&diff=1042985955&oldid=prev
Fredddie: name or abbr
2021-09-07T19:34:27Z
<p>name or abbr</p>
<table style="background-color: #fff; color: #202122;" data-mw="interface">
<col class="diff-marker" />
<col class="diff-content" />
<col class="diff-marker" />
<col class="diff-content" />
<tr class="diff-title" lang="en">
<td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">← Previous revision</td>
<td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">Revision as of 19:34, 7 September 2021</td>
</tr><tr>
<td colspan="2" class="diff-lineno">Line 196:</td>
<td colspan="2" class="diff-lineno">Line 196:</td>
</tr>
<tr>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br /></td>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br /></td>
</tr>
<tr>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>function p.link(route)</div></td>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>function p.link(route)</div></td>
</tr>
<tr>
<td class="diff-marker" data-marker="−"></td>
<td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div> local abbr, errMsg = parser(route, 'abbr')</div></td>
<td class="diff-marker" data-marker="+"></td>
<td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div> local abbr, errMsg =<ins style="font-weight: bold; text-decoration: none;"> parser(route, 'name') or</ins> parser(route, 'abbr')</div></td>
</tr>
<tr>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> if not abbr then</div></td>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> if not abbr then</div></td>
</tr>
<tr>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> route.typeerror = true</div></td>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> route.typeerror = true</div></td>
</tr>
</table>
Fredddie
https://en.wikipedia.org/w/index.php?title=Module:Road_data/locations&diff=1038824744&oldid=prev
Fredddie: forked from https://en.wikipedia.org/w/index.php?title=Module:Road_data&oldid=1034913644
2021-08-15T00:15:43Z
<p>forked from https://en.wikipedia.org/w/index.php?title=Module:Road_data&oldid=1034913644</p>
<p><b>New page</b></p><div>local p = {}<br />
<br />
-- Change to "" upon deployment.<br />
local moduleSuffix = ""<br />
<br />
local parserModuleName = "Module:Road data/parser" .. moduleSuffix<br />
local statenameModuleName = "Module:Jct/statename" .. moduleSuffix -- TODO transition<br />
<br />
local concat = table.concat<br />
local insert = table.insert<br />
local format = mw.ustring.format<br />
local trim = mw.text.trim<br />
<br />
local parserModule = require(parserModuleName)<br />
local parser = parserModule.parser<br />
local util = require("Module:Road data/util")<br />
local sizeModule = require("Module:Road data/size").size({style = "test"})<br />
<br />
-- Shields<br />
local defaultShieldSize = 24<br />
<br />
local function addContextBanner(route, name, suffix, bannerSpec)<br />
local bannerModule = 'Module:Road data/banners/' .. string.upper(route.country)<br />
local shieldfield = name .. 'shield'<br />
local shield = parser(route, shieldfield)<br />
if shield == nil then<br />
-- This route type does not define shield.<br />
-- Find shield in the default banner table.<br />
shield = parser(route, 'shield', name, bannerModule)<br />
if shield and shield ~= '' then<br />
if suffix == nil then<br />
suffix = parser(route, 'shield', 'suffix', bannerModule)<br />
end<br />
if suffix and suffix ~= '' then<br />
shield = shield .. " " .. suffix<br />
end<br />
shield = shield .. ".svg"<br />
end<br />
end<br />
if shield and shield ~= '' then<br />
local shieldSize = sizeModule<br />
-- Add banner plate.<br />
insert(bannerSpec, {shield, shieldSize})<br />
end<br />
end<br />
<br />
local function bannerSpec(banner, bannerSize, bannerSuffix, route)<br />
local banners = {}<br />
if type(banner) == "table" then<br />
local bannerSizeIsNotTable = type(bannerSize) ~= "table"<br />
for i,filename in ipairs(banner) do<br />
local bannersize = bannerSizeIsNotTable and bannerSize or bannerSize[i] or defaultShieldSize<br />
insert(banners, {filename, bannersize})<br />
end<br />
elseif banner ~= '' then<br />
insert(banners, {banner, bannerSize})<br />
end<br />
<br />
if route.dir then<br />
addContextBanner(route, 'dir', bannerSuffix, banners)<br />
end<br />
if route.to then<br />
addContextBanner(route, 'to', bannerSuffix, banners)<br />
end<br />
<br />
return banners<br />
end<br />
<br />
local function shieldSpec(route, mainShield)<br />
local shieldSpec = {}<br />
<br />
local shield<br />
if mainShield then shield = parser(route, "shieldmain") end<br />
if not shield then shield = parser(route, 'shield') or '' end<br />
if shield == '' then return shieldSpec end<br />
local orientation = parser(route, 'orientation')<br />
<br />
local function size(route)<br />
if orientation == "upright" then<br />
return sizeModule<br />
else return "x" .. sizeModule<br />
end<br />
end<br />
<br />
local shieldsize = size(route)<br />
<br />
local banner = parser(route, 'banner') or {}<br />
local bannersize = sizeModule<br />
local bannersuffix = parser(route, 'bannersuffix')<br />
<br />
local bannerIsNotTable = type(banner) ~= "table"<br />
local bannersizeIsNotTable = type(bannersize) ~= "table"<br />
local bannersuffixIsNotTable = type(bannersuffix) ~= "table"<br />
<br />
if type(shield) == "table" then<br />
for i,filename in ipairs(shield) do<br />
local size = shieldsize or shieldsize[i]<br />
if size == "" then size = nil end<br />
-- banner.all describes banners that apply to all multiple shields.<br />
local shieldBanner = bannerIsNotTable and banner or (banner[i] or banner.all or {})<br />
-- Banner size is default if the corresponding entry<br />
-- in bannerSize table is not set.<br />
local shieldBannerSize =<br />
bannersizeIsNotTable and bannersize<br />
or (bannersize[i] or bannersize.all or defaultShieldSize)<br />
local shieldBannerSuffix = bannersuffix and (bannersuffixIsNotTable and bannersuffix or bannersuffix[i])<br />
insert(shieldSpec, {<br />
shield = {filename, size},<br />
banners = bannerSpec(shieldBanner, shieldBannerSize, shieldBannerSuffix, route)<br />
})<br />
end<br />
elseif shield ~= '' then<br />
if shieldsize == "" then shieldsize = nil end<br />
insert(shieldSpec, {<br />
shield = {shield, shieldsize},<br />
banners = bannerSpec(banner, bannersize, bannersuffix, route)<br />
})<br />
end<br />
<br />
return shieldSpec<br />
end<br />
<br />
local missingShields<br />
<br />
local shieldExistsCache = {}<br />
<br />
-- Return up to two booleans.<br />
-- The first boolean is false if `shield` does not exist, and true otherwise.<br />
-- If the first boolean is true, the second boolean is true if the shield is<br />
-- landscape (width >= height), and false otherwise.<br />
local function shieldExists(shield)<br />
local result = shieldExistsCache[shield]<br />
if result == nil then<br />
local file = mw.title.new(shield, 'Media').file<br />
-- Cache result.<br />
local exists = file.exists<br />
result = {exists}<br />
if exists then result[2] = file.width >= file.height end<br />
shieldExistsCache[shield] = result<br />
end<br />
if result[1] then return true, result[2] end<br />
insert(missingShields, shield)<br />
return false<br />
end<br />
<br />
local function render(shieldEntry, scale, showLink)<br />
local shield = shieldEntry.shield<br />
local banners = shieldEntry.banners<br />
local exists, landscape = shieldExists(shield[1])<br />
if not exists then return '' end<br />
<br />
local size<br />
if shield[2] then<br />
local width, height = mw.ustring.match(shield[2], "(%d*)x?(%d*)")<br />
width = tonumber(width)<br />
height = tonumber(height)<br />
local sizeparts = {}<br />
if width then<br />
insert(sizeparts, format("%d", width * scale))<br />
end<br />
if height then<br />
insert(sizeparts, format("x%d", height * scale))<br />
end<br />
size = concat(sizeparts)<br />
else<br />
size = format("%s%d", landscape and "x" or "", defaultShieldSize * scale)<br />
end<br />
local shieldCode = format("[[File:%s|%spx|link=|alt=]]", shield[1], size)<br />
if not banners[1] then return shieldCode end<br />
<br />
for _,banner in ipairs(banners) do<br />
if shieldExists(banner[1]) then<br />
shieldCode = format("[[File:%s|%spx|link=|alt=]]<br>%s",<br />
banner[1],<br />
banner[2],<br />
shieldCode)<br />
end<br />
end<br />
return '<span style="display: inline-block; vertical-align: baseline; line-height: 0; text-align: center;">' .. shieldCode .. '</span>'<br />
end<br />
<br />
function p.shield(route, scale, showLink, mainShield)<br />
missingShields = {}<br />
if route.rdt then<br />
local shieldSize = mw.ustring.match(route.rdt, '^(%d+)$') or 17<br />
scale = shieldSize/defaultShieldSize<br />
end<br />
scale = scale or 1<br />
<br />
local rendered = {}<br />
for _,entry in ipairs(shieldSpec(route, mainShield)) do<br />
insert(rendered, render(entry, scale, showLink))<br />
end<br />
return concat(rendered), missingShields<br />
end<br />
<br />
function p.link(route)<br />
local abbr, errMsg = parser(route, 'abbr')<br />
if not abbr then<br />
route.typeerror = true<br />
return util.err(errMsg or format("Invalid type: %s", route.type or "(nil)"))<br />
end<br />
if route.nolink then return abbr, abbr end<br />
<br />
local link = parser(route, 'link') or ''<br />
if link == '' then return abbr, abbr end<br />
<br />
return format("[[%s|%s]]", link, abbr), abbr<br />
end<br />
<br />
local function stateName(args)<br />
-- TODO transition<br />
local data = mw.loadData(statenameModuleName) <br />
local abbr = args.state or args.province<br />
local countryData = data[args.country]<br />
return countryData and countryData[abbr]<br />
end<br />
<br />
function p.locations(args, module, group)<br />
module = module or ""<br />
local modulearticle = module .. "article"<br />
local moduleprefix = module .. "prefix"<br />
local modulenameprefix = module .. "nameprefix"<br />
local modulenamesuffix = module .. "namesuffix"<br />
<br />
local warnings = {}<br />
<br />
-- Region, for disambiguation<br />
local region = parserModule.parser(args, "region", " common ")<br />
if not region then<br />
-- TODO transition<br />
if args.region then<br />
warnings.region = "region parameter is deprecated"<br />
region = args.region<br />
elseif args.country and (args.state or args.province) then<br />
warnings.region = "Inferring region from country and state/province"<br />
region = stateName(args)<br />
end<br />
end<br />
local regionName<br />
local regionText<br />
if type(region) == "table" then<br />
regionName = region.name<br />
regionText = format("[[%s|%s]]", region.link, regionName)<br />
elseif region then<br />
regionName = region<br />
regionText = format("[[%s]]", regionName)<br />
end<br />
args.region = regionName<br />
<br />
local locations = parserModule.parser(args, "locations", " common ") or {}<br />
<br />
-- Primary topic requires no specialization to supplied locations.<br />
local primaryTopic = not locations and module == "jctint" and args.primary_topic ~= 'no'<br />
if args.primary_topic then<br />
-- TODO transition<br />
warnings.primary_topic = "primary_topic parameter is deprecated"<br />
end<br />
<br />
-- Independent city<br />
local indepCityText<br />
if args.indep_city_special then<br />
indepCityText = args.indep_city_special -- Overrides `indep_city` argument.<br />
elseif args.indep_city then<br />
local indepCity = args.indep_city<br />
local spec = locations.indep_city<br />
if spec then<br />
local link = format("%s%s%s",<br />
spec.linkprefix or "", indepCity, spec.linksuffix or "")<br />
local name = format("%s%s%s",<br />
spec[modulenameprefix] or spec.nameprefix or "",<br />
indepCity,<br />
spec[modulenamesuffix] or spec.namesuffix or "")<br />
indepCityText = format("%s%s[[%s|%s]]",<br />
spec[modulearticle] or spec.article or "",<br />
spec[moduleprefix] or spec.prefix or "",<br />
link, name)<br />
else<br />
-- TODO transition<br />
warnings.indep_city = "Spec for indep_city parameter undefined in road data module"<br />
local cityLink -- Wikilink for independent city<br />
if primaryTopic then<br />
cityLink = format('[[%s]]', indepCity)<br />
else<br />
-- Specialize independent city to the region.<br />
cityLink = format('[[%s, %s|%s]]', indepCity, region, indepCity)<br />
end<br />
indepCityText = "[[Independent city|City]] of " .. cityLink<br />
end<br />
end<br />
if indepCityText then<br />
return {region = regionText, indep_city = indepCityText, warnings = warnings}<br />
end<br />
<br />
-- First-level subdivision, e.g., county<br />
-- Name of the type of subdivision, e.g., "County" and "Parish"<br />
local sub1name = args.sub1name -- TODO transition<br />
local sub1Text<br />
if args.sub1_special then<br />
sub1Text = args.sub1_special -- Overrides `sub1` argument.<br />
elseif args.sub1 then<br />
local sub1 = args.sub1<br />
local article<br />
local link = sub1<br />
local name = sub1<br />
-- Type of first-level subdivision area, as a form of disambiguation<br />
local sub1area = args.sub1area<br />
if sub1area then<br />
local sub1areaSpec = locations.sub1areas and locations.sub1areas[sub1area]<br />
if sub1areaSpec then<br />
article = sub1areaSpec[modulearticle] or sub1areaSpec.article or ""<br />
link = format("%s%s%s",<br />
sub1areaSpec.linkprefix or "", link, sub1areaSpec.linksuffix or "")<br />
name = format("%s%s%s",<br />
group and "" or sub1areaSpec[modulenameprefix] or sub1areaSpec.nameprefix or "",<br />
name,<br />
group and "" or sub1areaSpec[modulenamesuffix] or sub1areaSpec.namesuffix or "")<br />
else<br />
-- TODO report error<br />
local errMsg = util.err(format("Undefined sub1area: %s", sub1area))<br />
name = format("%s%s", name, errMsg)<br />
end<br />
end<br />
if locations.sub1 then<br />
local spec = locations.sub1<br />
-- Prepend and append text from spec.<br />
link = format("%s%s%s",<br />
spec.linkprefix or "", link, spec.linksuffix or "")<br />
name = format("%s%s%s",<br />
spec[modulenameprefix] or spec.nameprefix or "",<br />
name,<br />
spec[modulenamesuffix] or spec.namesuffix or "")<br />
sub1Text = format("%s[[%s|%s]]", article or "", link, name)<br />
else<br />
-- TODO transition<br />
warnings.sub1 = "Spec for sub1 parameter undefined in road data module"<br />
-- Add type (if specified) to wikilink for first-level subdivision.<br />
local sub1Link = sub1name and trim(format("%s %s", sub1, sub1name)) or sub1<br />
local sub1Name = module == "jcttop" and sub1Link or sub1<br />
if primaryTopic then<br />
sub1Text = format('[[%s|%s]]', sub1Link, sub1Name)<br />
else<br />
-- Specialize first-level subdivision, with type added, to the region.<br />
sub1Text = format('[[%s, %s|%s]]', sub1Link, region, sub1Name)<br />
end<br />
end<br />
end<br />
<br />
-- Second-level subdivision, e.g., city and town<br />
local sub2Text<br />
if args.sub2_special then<br />
sub2Text = args.sub2_special -- Overrides `sub2` argument.<br />
elseif args.sub2 then<br />
local sub2 = args.sub2<br />
if sub2 == "none" then<br />
sub2Text = "&#8203;" -- Zero-width space<br />
elseif sub2 == "&nbsp;" then<br />
-- TODO transition<br />
warnings.sub2 = "&nbsp; argument for sub2 parameter is deprecated"<br />
sub2Text = "&#8203;" -- Zero-width space<br />
elseif primaryTopic then<br />
-- TODO transition<br />
sub2Text = format("[[%s]]", sub2)<br />
else<br />
local article<br />
local link = sub2<br />
local name = sub2<br />
-- Type of area, e.g., city and village, as a form of disambiguation<br />
local sub2area = args.sub2area --[[TODO transition]] or args.area<br />
if sub2area then<br />
local sub2areaSpec = locations.sub2areas and locations.sub2areas[sub2area]<br />
if not sub2areaSpec then<br />
-- TODO transition<br />
warnings.sub2 =<br />
format("Spec for area parameter '%s' undefined in road data module", sub2area)<br />
local sub2areas = { -- table of different area types<br />
city = {<br />
linksuffix = " (city)",<br />
jcttoparticle = "the ",<br />
nameprefix = "City of "<br />
},<br />
town = {<br />
linksuffix = " (town)",<br />
jcttoparticle = "the ",<br />
nameprefix = "Town of "<br />
},<br />
village = {<br />
linksuffix = " (village)",<br />
jcttoparticle = "the ",<br />
nameprefix = "Village of "<br />
},<br />
community = {<br />
linksuffix = " (community)",<br />
jcttoparticle = "the ",<br />
nameprefix = "Community of "<br />
},<br />
CDP = {<br />
linksuffix = " (CDP)",<br />
jcttoparticle = "the ",<br />
nameprefix = "Community of "<br />
},<br />
hamlet = {<br />
linksuffix = " (hamlet)",<br />
jcttoparticle = "the ",<br />
nameprefix = "Hamlet of "<br />
},<br />
["unorganized territory"] = {<br />
linksuffix = " (unorganized territory)",<br />
jcttoparticle = "the ",<br />
nameprefix = "Unorganized Territory of "<br />
},<br />
township = {<br />
linksuffix = " Township",<br />
namesuffix = " Township",<br />
}<br />
}<br />
sub2areaSpec = sub2areas[sub2area]<br />
end<br />
if sub2areaSpec then<br />
article = sub2areaSpec[modulearticle] or sub2areaSpec.article or ""<br />
link = format("%s%s%s",<br />
sub2areaSpec.linkprefix or "", link, sub2areaSpec.linksuffix or "")<br />
name = format("%s%s%s",<br />
group and "" or sub2areaSpec[modulenameprefix] or sub2areaSpec.nameprefix or "",<br />
name,<br />
group and "" or sub2areaSpec[modulenamesuffix] or sub2areaSpec.namesuffix or "")<br />
else<br />
-- TODO report error<br />
local errMsg = util.err(format("Undefined sub2area: %s", sub2area))<br />
name = format("%s%s", name, errMsg)<br />
end<br />
end<br />
if locations.sub2 then<br />
local spec = locations.sub2<br />
-- Prepend and append text from spec.<br />
link = format("%s%s%s",<br />
spec.linkprefix or "", link, spec.linksuffix or "")<br />
name = format("%s%s%s",<br />
spec[modulenameprefix] or spec.nameprefix or "",<br />
name,<br />
spec[modulenamesuffix] or spec.namesuffix or "")<br />
else<br />
-- TODO transition<br />
warnings.sub2 = "Spec for sub2 parameter undefined in road data module"<br />
-- Some second-level subdivisions are not unique in a given region.<br />
-- `sub1dab` is the first-level subdivision to be used for disambiguation.<br />
local sub1dab = args.sub1dab<br />
if sub1dab then<br />
sub1dab = sub1name and trim(format("%s %s", sub1dab, sub1name)) or sub1dab<br />
link = format("%s, %s", link, sub1dab)<br />
end<br />
link = format("%s, %s", link, region) -- Add region to wikilink<br />
end<br />
sub2Text = format("%s[[%s|%s]]", article or "", link, name)<br />
end<br />
end<br />
return {region = regionText, sub1 = sub1Text, sub2 = sub2Text, warnings = warnings}<br />
end<br />
<br />
return p</div>
Fredddie