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 &quot;<a href="/wiki/Module:Road_data/locations" title="Module:Road data/locations">Module:Road data/locations</a>&quot;: <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&amp;action=edit&amp;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&amp;diff=1241903604&amp;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&amp;oldid=1034913644</p> <p><b>New page</b></p><div>local p = {}<br /> <br /> -- Change to &quot;&quot; upon deployment.<br /> local moduleSuffix = &quot;&quot;<br /> <br /> local parserModuleName = &quot;Module:Road data/parser&quot; .. moduleSuffix<br /> local statenameModuleName = &quot;Module:Jct/statename&quot; .. 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(&quot;Module:Road data/util&quot;)<br /> local sizeModule = require(&quot;Module:Road data/size&quot;).size({style = &quot;test&quot;})<br /> <br /> -- Shields<br /> local defaultShieldSize = 24<br /> <br /> local function addContextBanner(route, name, suffix, bannerSpec)<br /> local bannerModule = &#039;Module:Road data/banners/&#039; .. string.upper(route.country)<br /> local shieldfield = name .. &#039;shield&#039;<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, &#039;shield&#039;, name, bannerModule)<br /> if shield and shield ~= &#039;&#039; then<br /> if suffix == nil then<br /> suffix = parser(route, &#039;shield&#039;, &#039;suffix&#039;, bannerModule)<br /> end<br /> if suffix and suffix ~= &#039;&#039; then<br /> shield = shield .. &quot; &quot; .. suffix<br /> end<br /> shield = shield .. &quot;.svg&quot;<br /> end<br /> end<br /> if shield and shield ~= &#039;&#039; 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) == &quot;table&quot; then<br /> local bannerSizeIsNotTable = type(bannerSize) ~= &quot;table&quot;<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 ~= &#039;&#039; then<br /> insert(banners, {banner, bannerSize})<br /> end<br /> <br /> if route.dir then<br /> addContextBanner(route, &#039;dir&#039;, bannerSuffix, banners)<br /> end<br /> if route.to then<br /> addContextBanner(route, &#039;to&#039;, 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, &quot;shieldmain&quot;) end<br /> if not shield then shield = parser(route, &#039;shield&#039;) or &#039;&#039; end<br /> if shield == &#039;&#039; then return shieldSpec end<br /> local orientation = parser(route, &#039;orientation&#039;)<br /> <br /> local function size(route)<br /> if orientation == &quot;upright&quot; then<br /> return sizeModule<br /> else return &quot;x&quot; .. sizeModule<br /> end<br /> end<br /> <br /> local shieldsize = size(route)<br /> <br /> local banner = parser(route, &#039;banner&#039;) or {}<br /> local bannersize = sizeModule<br /> local bannersuffix = parser(route, &#039;bannersuffix&#039;)<br /> <br /> local bannerIsNotTable = type(banner) ~= &quot;table&quot;<br /> local bannersizeIsNotTable = type(bannersize) ~= &quot;table&quot;<br /> local bannersuffixIsNotTable = type(bannersuffix) ~= &quot;table&quot;<br /> <br /> if type(shield) == &quot;table&quot; then<br /> for i,filename in ipairs(shield) do<br /> local size = shieldsize or shieldsize[i]<br /> if size == &quot;&quot; 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 ~= &#039;&#039; then<br /> if shieldsize == &quot;&quot; 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 &gt;= 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, &#039;Media&#039;).file<br /> -- Cache result.<br /> local exists = file.exists<br /> result = {exists}<br /> if exists then result[2] = file.width &gt;= 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 &#039;&#039; end<br /> <br /> local size<br /> if shield[2] then<br /> local width, height = mw.ustring.match(shield[2], &quot;(%d*)x?(%d*)&quot;)<br /> width = tonumber(width)<br /> height = tonumber(height)<br /> local sizeparts = {}<br /> if width then<br /> insert(sizeparts, format(&quot;%d&quot;, width * scale))<br /> end<br /> if height then<br /> insert(sizeparts, format(&quot;x%d&quot;, height * scale))<br /> end<br /> size = concat(sizeparts)<br /> else<br /> size = format(&quot;%s%d&quot;, landscape and &quot;x&quot; or &quot;&quot;, defaultShieldSize * scale)<br /> end<br /> local shieldCode = format(&quot;[[File:%s|%spx|link=|alt=]]&quot;, 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(&quot;[[File:%s|%spx|link=|alt=]]&lt;br&gt;%s&quot;,<br /> banner[1],<br /> banner[2],<br /> shieldCode)<br /> end<br /> end<br /> return &#039;&lt;span style=&quot;display: inline-block; vertical-align: baseline; line-height: 0; text-align: center;&quot;&gt;&#039; .. shieldCode .. &#039;&lt;/span&gt;&#039;<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, &#039;^(%d+)$&#039;) 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, &#039;abbr&#039;)<br /> if not abbr then<br /> route.typeerror = true<br /> return util.err(errMsg or format(&quot;Invalid type: %s&quot;, route.type or &quot;(nil)&quot;))<br /> end<br /> if route.nolink then return abbr, abbr end<br /> <br /> local link = parser(route, &#039;link&#039;) or &#039;&#039;<br /> if link == &#039;&#039; then return abbr, abbr end<br /> <br /> return format(&quot;[[%s|%s]]&quot;, 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 &quot;&quot;<br /> local modulearticle = module .. &quot;article&quot;<br /> local moduleprefix = module .. &quot;prefix&quot;<br /> local modulenameprefix = module .. &quot;nameprefix&quot;<br /> local modulenamesuffix = module .. &quot;namesuffix&quot;<br /> <br /> local warnings = {}<br /> <br /> -- Region, for disambiguation<br /> local region = parserModule.parser(args, &quot;region&quot;, &quot; common &quot;)<br /> if not region then<br /> -- TODO transition<br /> if args.region then<br /> warnings.region = &quot;region parameter is deprecated&quot;<br /> region = args.region<br /> elseif args.country and (args.state or args.province) then<br /> warnings.region = &quot;Inferring region from country and state/province&quot;<br /> region = stateName(args)<br /> end<br /> end<br /> local regionName<br /> local regionText<br /> if type(region) == &quot;table&quot; then<br /> regionName = region.name<br /> regionText = format(&quot;[[%s|%s]]&quot;, region.link, regionName)<br /> elseif region then<br /> regionName = region<br /> regionText = format(&quot;[[%s]]&quot;, regionName)<br /> end<br /> args.region = regionName<br /> <br /> local locations = parserModule.parser(args, &quot;locations&quot;, &quot; common &quot;) or {}<br /> <br /> -- Primary topic requires no specialization to supplied locations.<br /> local primaryTopic = not locations and module == &quot;jctint&quot; and args.primary_topic ~= &#039;no&#039;<br /> if args.primary_topic then<br /> -- TODO transition<br /> warnings.primary_topic = &quot;primary_topic parameter is deprecated&quot;<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(&quot;%s%s%s&quot;,<br /> spec.linkprefix or &quot;&quot;, indepCity, spec.linksuffix or &quot;&quot;)<br /> local name = format(&quot;%s%s%s&quot;,<br /> spec[modulenameprefix] or spec.nameprefix or &quot;&quot;,<br /> indepCity,<br /> spec[modulenamesuffix] or spec.namesuffix or &quot;&quot;)<br /> indepCityText = format(&quot;%s%s[[%s|%s]]&quot;,<br /> spec[modulearticle] or spec.article or &quot;&quot;,<br /> spec[moduleprefix] or spec.prefix or &quot;&quot;,<br /> link, name)<br /> else<br /> -- TODO transition<br /> warnings.indep_city = &quot;Spec for indep_city parameter undefined in road data module&quot;<br /> local cityLink -- Wikilink for independent city<br /> if primaryTopic then<br /> cityLink = format(&#039;[[%s]]&#039;, indepCity)<br /> else<br /> -- Specialize independent city to the region.<br /> cityLink = format(&#039;[[%s, %s|%s]]&#039;, indepCity, region, indepCity)<br /> end<br /> indepCityText = &quot;[[Independent city|City]] of &quot; .. 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., &quot;County&quot; and &quot;Parish&quot;<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 &quot;&quot;<br /> link = format(&quot;%s%s%s&quot;,<br /> sub1areaSpec.linkprefix or &quot;&quot;, link, sub1areaSpec.linksuffix or &quot;&quot;)<br /> name = format(&quot;%s%s%s&quot;,<br /> group and &quot;&quot; or sub1areaSpec[modulenameprefix] or sub1areaSpec.nameprefix or &quot;&quot;,<br /> name,<br /> group and &quot;&quot; or sub1areaSpec[modulenamesuffix] or sub1areaSpec.namesuffix or &quot;&quot;)<br /> else<br /> -- TODO report error<br /> local errMsg = util.err(format(&quot;Undefined sub1area: %s&quot;, sub1area))<br /> name = format(&quot;%s%s&quot;, 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(&quot;%s%s%s&quot;,<br /> spec.linkprefix or &quot;&quot;, link, spec.linksuffix or &quot;&quot;)<br /> name = format(&quot;%s%s%s&quot;,<br /> spec[modulenameprefix] or spec.nameprefix or &quot;&quot;,<br /> name,<br /> spec[modulenamesuffix] or spec.namesuffix or &quot;&quot;)<br /> sub1Text = format(&quot;%s[[%s|%s]]&quot;, article or &quot;&quot;, link, name)<br /> else<br /> -- TODO transition<br /> warnings.sub1 = &quot;Spec for sub1 parameter undefined in road data module&quot;<br /> -- Add type (if specified) to wikilink for first-level subdivision.<br /> local sub1Link = sub1name and trim(format(&quot;%s %s&quot;, sub1, sub1name)) or sub1<br /> local sub1Name = module == &quot;jcttop&quot; and sub1Link or sub1<br /> if primaryTopic then<br /> sub1Text = format(&#039;[[%s|%s]]&#039;, sub1Link, sub1Name)<br /> else<br /> -- Specialize first-level subdivision, with type added, to the region.<br /> sub1Text = format(&#039;[[%s, %s|%s]]&#039;, 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 == &quot;none&quot; then<br /> sub2Text = &quot;&amp;#8203;&quot; -- Zero-width space<br /> elseif sub2 == &quot;&amp;nbsp;&quot; then<br /> -- TODO transition<br /> warnings.sub2 = &quot;&amp;nbsp; argument for sub2 parameter is deprecated&quot;<br /> sub2Text = &quot;&amp;#8203;&quot; -- Zero-width space<br /> elseif primaryTopic then<br /> -- TODO transition<br /> sub2Text = format(&quot;[[%s]]&quot;, 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(&quot;Spec for area parameter &#039;%s&#039; undefined in road data module&quot;, sub2area)<br /> local sub2areas = { -- table of different area types<br /> city = {<br /> linksuffix = &quot; (city)&quot;,<br /> jcttoparticle = &quot;the &quot;,<br /> nameprefix = &quot;City of &quot;<br /> },<br /> town = {<br /> linksuffix = &quot; (town)&quot;,<br /> jcttoparticle = &quot;the &quot;,<br /> nameprefix = &quot;Town of &quot;<br /> },<br /> village = {<br /> linksuffix = &quot; (village)&quot;,<br /> jcttoparticle = &quot;the &quot;,<br /> nameprefix = &quot;Village of &quot;<br /> },<br /> community = {<br /> linksuffix = &quot; (community)&quot;,<br /> jcttoparticle = &quot;the &quot;,<br /> nameprefix = &quot;Community of &quot;<br /> },<br /> CDP = {<br /> linksuffix = &quot; (CDP)&quot;,<br /> jcttoparticle = &quot;the &quot;,<br /> nameprefix = &quot;Community of &quot;<br /> },<br /> hamlet = {<br /> linksuffix = &quot; (hamlet)&quot;,<br /> jcttoparticle = &quot;the &quot;,<br /> nameprefix = &quot;Hamlet of &quot;<br /> },<br /> [&quot;unorganized territory&quot;] = {<br /> linksuffix = &quot; (unorganized territory)&quot;,<br /> jcttoparticle = &quot;the &quot;,<br /> nameprefix = &quot;Unorganized Territory of &quot;<br /> },<br /> township = {<br /> linksuffix = &quot; Township&quot;,<br /> namesuffix = &quot; Township&quot;,<br /> }<br /> }<br /> sub2areaSpec = sub2areas[sub2area]<br /> end<br /> if sub2areaSpec then<br /> article = sub2areaSpec[modulearticle] or sub2areaSpec.article or &quot;&quot;<br /> link = format(&quot;%s%s%s&quot;,<br /> sub2areaSpec.linkprefix or &quot;&quot;, link, sub2areaSpec.linksuffix or &quot;&quot;)<br /> name = format(&quot;%s%s%s&quot;,<br /> group and &quot;&quot; or sub2areaSpec[modulenameprefix] or sub2areaSpec.nameprefix or &quot;&quot;,<br /> name,<br /> group and &quot;&quot; or sub2areaSpec[modulenamesuffix] or sub2areaSpec.namesuffix or &quot;&quot;)<br /> else<br /> -- TODO report error<br /> local errMsg = util.err(format(&quot;Undefined sub2area: %s&quot;, sub2area))<br /> name = format(&quot;%s%s&quot;, 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(&quot;%s%s%s&quot;,<br /> spec.linkprefix or &quot;&quot;, link, spec.linksuffix or &quot;&quot;)<br /> name = format(&quot;%s%s%s&quot;,<br /> spec[modulenameprefix] or spec.nameprefix or &quot;&quot;,<br /> name,<br /> spec[modulenamesuffix] or spec.namesuffix or &quot;&quot;)<br /> else<br /> -- TODO transition<br /> warnings.sub2 = &quot;Spec for sub2 parameter undefined in road data module&quot;<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(&quot;%s %s&quot;, sub1dab, sub1name)) or sub1dab<br /> link = format(&quot;%s, %s&quot;, link, sub1dab)<br /> end<br /> link = format(&quot;%s, %s&quot;, link, region) -- Add region to wikilink<br /> end<br /> sub2Text = format(&quot;%s[[%s|%s]]&quot;, article or &quot;&quot;, link, name)<br /> end<br /> end<br /> return {region = regionText, sub1 = sub1Text, sub2 = sub2Text, warnings = warnings}<br /> end<br /> <br /> return p</div> Fredddie