https://en.wikipedia.org/w/index.php?action=history&feed=atom&title=Module%3AMountains_Prism Module:Mountains Prism - Revision history 2025-06-14T16:21:33Z Revision history for this page on the wiki MediaWiki 1.45.0-wmf.5 https://en.wikipedia.org/w/index.php?title=Module:Mountains_Prism&diff=1286281828&oldid=prev RedWolf: v1.3: Support qid after page name for items that exist on Wikidata but not on Wikipedia (updated from sandbox) 2025-04-18T21:57:47Z <p>v1.3: Support qid after page name for items that exist on Wikidata but not on Wikipedia (updated from sandbox)</p> <a href="//en.wikipedia.org/w/index.php?title=Module:Mountains_Prism&amp;diff=1286281828&amp;oldid=1284650166">Show changes</a> RedWolf https://en.wikipedia.org/w/index.php?title=Module:Mountains_Prism&diff=1284650166&oldid=prev RedWolf: v1.2 (updated from /sandbox) 2025-04-08T21:49:03Z <p>v1.2 (updated from /sandbox)</p> <a href="//en.wikipedia.org/w/index.php?title=Module:Mountains_Prism&amp;diff=1284650166&amp;oldid=1282010792">Show changes</a> RedWolf https://en.wikipedia.org/w/index.php?title=Module:Mountains_Prism&diff=1282010792&oldid=prev RedWolf: Various fixes for metric and imperial units (updated from /sandbox) 2025-03-23T19:52:43Z <p>Various fixes for metric and imperial units (updated from /sandbox)</p> <a href="//en.wikipedia.org/w/index.php?title=Module:Mountains_Prism&amp;diff=1282010792&amp;oldid=1279612755">Show changes</a> RedWolf https://en.wikipedia.org/w/index.php?title=Module:Mountains_Prism&diff=1279612755&oldid=prev Jonesey95: Fix Linter errors. 2025-03-09T15:06:36Z <p>Fix <a href="/wiki/Special:LintErrors" title="Special:LintErrors">Linter</a> errors.</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 15:06, 9 March 2025</td> </tr><tr> <td colspan="2" class="diff-lineno">Line 671:</td> <td colspan="2" class="diff-lineno">Line 671:</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> debug("elev=" .. mtn.elevation ..";elev_wd="..mtn.elevation_wd)</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> debug("elev=" .. mtn.elevation ..";elev_wd="..mtn.elevation_wd)</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 (options.showCustom1 or options.showCustom2) and mtn.elevation_wd ~= 0 and mtn.elevation ~= mtn.elevation_wd 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 (options.showCustom1 or options.showCustom2) and mtn.elevation_wd ~= 0 and mtn.elevation ~= mtn.elevation_wd then</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 mm = "&lt;br/&gt;&lt;<del style="font-weight: bold; text-decoration: none;">font</del> <del style="font-weight: bold; text-decoration: none;">color</del>=green&gt;Local/WD elevations mismatch: " .. "\"" .. mtn.elevation .. "\"".. "/\"" .. mtn.elevation_wd.. "\"&lt;/<del style="font-weight: bold; text-decoration: none;">font</del>&gt;"</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 mm = "&lt;br/&gt;&lt;<ins style="font-weight: bold; text-decoration: none;">span</ins> <ins style="font-weight: bold; text-decoration: none;">style</ins>=<ins style="font-weight: bold; text-decoration: none;">\"color:</ins>green<ins style="font-weight: bold; text-decoration: none;">\"</ins>&gt;Local/WD elevations mismatch: " .. "\"" .. mtn.elevation .. "\"".. "/\"" .. mtn.elevation_wd.. "\"&lt;/<ins style="font-weight: bold; text-decoration: none;">span</ins>&gt;"</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> mtn.custom = mtn.custom .. mm</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> mtn.custom = mtn.custom .. mm</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> end</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> end</div></td> </tr> <tr> <td colspan="2" class="diff-lineno">Line 696:</td> <td colspan="2" class="diff-lineno">Line 696:</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> if string.len(errors) &gt; 0 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 string.len(errors) &gt; 0 then</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> printf("&lt;<del style="font-weight: bold; text-decoration: none;">font</del> <del style="font-weight: bold; text-decoration: none;">color</del>=red&gt;%s&lt;/<del style="font-weight: bold; text-decoration: none;">font</del>&gt;\n", errors)</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> printf("&lt;<ins style="font-weight: bold; text-decoration: none;">span</ins> <ins style="font-weight: bold; text-decoration: none;">style</ins>=<ins style="font-weight: bold; text-decoration: none;">\"color:</ins>red<ins style="font-weight: bold; text-decoration: none;">\"</ins>&gt;%s&lt;/<ins style="font-weight: bold; text-decoration: none;">span</ins>&gt;\n", errors)</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> end</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> end</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 options.debug and string.len(dbgout) &gt; 0 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 options.debug and string.len(dbgout) &gt; 0 then</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> printf("&lt;br/&gt;&lt;<del style="font-weight: bold; text-decoration: none;">font</del> <del style="font-weight: bold; text-decoration: none;">color</del>=green&gt;Debug output&lt;br/&gt;\n%s&lt;/<del style="font-weight: bold; text-decoration: none;">font</del>&gt;\n", dbgout)</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> printf("&lt;br/&gt;&lt;<ins style="font-weight: bold; text-decoration: none;">span</ins> <ins style="font-weight: bold; text-decoration: none;">style</ins>=<ins style="font-weight: bold; text-decoration: none;">\"color:</ins>green<ins style="font-weight: bold; text-decoration: none;">\"</ins>&gt;Debug output&lt;br/&gt;\n%s&lt;/<ins style="font-weight: bold; text-decoration: none;">span</ins>&gt;\n", dbgout)</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> end</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> end</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> </table> Jonesey95 https://en.wikipedia.org/w/index.php?title=Module:Mountains_Prism&diff=1279556897&oldid=prev Anomalocaris: That seems to have worked, but it's not what I intended, try again. 2025-03-09T06:51:44Z <p>That seems to have worked, but it&#039;s not what I intended, try again.</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 06:51, 9 March 2025</td> </tr><tr> <td colspan="2" class="diff-lineno">Line 99:</td> <td colspan="2" class="diff-lineno">Line 99:</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 errorFont(value)</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 errorFont(value)</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> return "&lt;span style<del style="font-weight: bold; text-decoration: none;">:</del>color:<del style="font-weight: bold; text-decoration: none;">\"</del>red\"&gt;" .. value .. "&lt;/span&gt;"</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> return "&lt;span style<ins style="font-weight: bold; text-decoration: none;">=\"</ins>color:red\"&gt;" .. value .. "&lt;/span&gt;"</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>end</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>end</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> </table> Anomalocaris https://en.wikipedia.org/w/index.php?title=Module:Mountains_Prism&diff=1279554604&oldid=prev Anomalocaris: <font> → <span style> and boldly assume that quotation marks can be returned by escaping them as \" and if this turns out not to be true I will revert 2025-03-09T06:26:10Z <p>&lt;font&gt; → &lt;span style&gt; and boldly assume that quotation marks can be returned by escaping them as \&quot; and if this turns out not to be true I will revert</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 06:26, 9 March 2025</td> </tr><tr> <td colspan="2" class="diff-lineno">Line 99:</td> <td colspan="2" class="diff-lineno">Line 99:</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 errorFont(value)</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 errorFont(value)</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> return "&lt;<del style="font-weight: bold; text-decoration: none;">font</del> color<del style="font-weight: bold; text-decoration: none;">=</del>red&gt;" .. value .. "&lt;/<del style="font-weight: bold; text-decoration: none;">font</del>&gt;"</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> return "&lt;<ins style="font-weight: bold; text-decoration: none;">span</ins> <ins style="font-weight: bold; text-decoration: none;">style:</ins>color<ins style="font-weight: bold; text-decoration: none;">:\"</ins>red<ins style="font-weight: bold; text-decoration: none;">\"</ins>&gt;" .. value .. "&lt;/<ins style="font-weight: bold; text-decoration: none;">span</ins>&gt;"</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>end</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>end</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> </table> Anomalocaris https://en.wikipedia.org/w/index.php?title=Module:Mountains_Prism&diff=1279536216&oldid=prev RedWolf: Gathers information about mountains from Wikidata and displays it in a table 2025-03-09T03:29:50Z <p>Gathers information about mountains from Wikidata and displays it in a table</p> <p><b>New page</b></p><div>--[[<br /> This module builds a wiki table that lists information pertinent to mountains. This module accomodates up to 996 lines<br /> of mountains where each line consists of the elevation, wiki-linked name and optional notes information. This<br /> module uses the wiki-linked name to find its corresponding Wikidata item (eid) and then retrieve the following<br /> information from Wikidata: elevation, prominence, isolation, range, first ascent, country, coordinates<br /> ]]<br /> local p = {}<br /> --local wd = require(&#039;Module:Wd&#039;)<br /> local Titled_coords = require(&#039;Module:Titled_coords&#039;)<br /> local newBuffer = require(&#039;Module:OutputBuffer&#039;)<br /> <br /> -- Wikidata properties<br /> local WD_PROPERTIES = {<br /> elevation = &quot;P2044&quot;,<br /> prominence = &quot;P2660&quot;,<br /> mtn_range = &quot;P4552&quot;,<br /> coords = &quot;P625&quot;,<br /> sig_event = &quot;P793&quot;,<br /> pt_in_time = &quot;P585&quot;,<br /> isolation = &quot;P2659&quot;,<br /> country = &quot;P17&quot;<br /> }<br /> <br /> -- Table column titles for easier translation<br /> local COL_TITLES = {<br /> rank = &quot;Rank&quot;,<br /> name = &quot;Mountain / Peak&quot;,<br /> elev = &quot;Elevation&quot;,<br /> prom = &quot;Prominence&quot;,<br /> isoltn = &quot;Isolation&quot;,<br /> range = &quot;Subrange&quot;,<br /> fa = &quot;FA&quot;,<br /> coords = &quot;Coordinates&quot;,<br /> country = &quot;Country&quot;,<br /> custom = &quot;Notes&quot;<br /> }<br /> <br /> -- ** Runtime Option names **<br /> local OPT_NAMES = {<br /> NAME = &quot;name&quot;,<br /> RANK = &quot;rank&quot;,<br /> PROM = &quot;prom&quot;,<br /> ISOLTN = &quot;isolation&quot;,<br /> RANGE = &quot;range&quot;,<br /> FA = &quot;fa&quot;,<br /> COORDS = &quot;coords&quot;,<br /> TCOORDS= &quot;tcoords&quot;,<br /> CUSTOM1= &quot;custom1&quot;,<br /> CUSTOM2= &quot;custom2&quot;,<br /> COUNTRY= &quot;country&quot;,<br /> ORDER = &quot;order&quot;,<br /> DEBUG = &quot;debug&quot;<br /> }<br /> <br /> local RANK_ORDER = { ELEV = &quot;E&quot;, PROM = &quot;P&quot;}<br /> <br /> local UNITS = {<br /> METRE = &quot;m&quot;, FEET = &quot;ft&quot;,<br /> KILOMETRE = &quot;km&quot;, MILE = &quot;mi&quot;<br /> }<br /> <br /> -- Runtime options about what information to display<br /> local Options = { debug = false, test = false, showFA = false, showProm = false,<br /> showCoord = false, showTCoord = false, rankOrder = RANK_ORDER.ELEV,<br /> showRank = false, showRange = false, showIsolation = false, <br /> showCountry = false, showCustom1 = false, showCustom2 = false }<br /> <br /> -- Information about a mountain from Module arguments and Wikidata.<br /> local Mountain = { rank, page, name, eid, elevation, elevation_wd = 0, prominence,<br /> range = &quot;&quot;, isolation = &quot;&quot;, fa = &quot;&quot;, coords, custom, country }<br /> <br /> local QID_FIRST_ASCENT = &quot;Q1194369&quot;<br /> local FA_UNKNOWN = &quot;Unk&quot;<br /> local FA_ERROR = &quot;????&quot;<br /> local FS = &quot;^&quot; -- field separator<br /> local NBSP = &quot;&amp;nbsp;&quot;<br /> local COL_TITLE_SEP = &quot;:&quot; -- do not use &quot;=&quot;<br /> local OPTIONS_SEP = &quot;,&quot;<br /> local NEWLINE = &quot;\n&quot;<br /> local BR_NEWLINE =&quot;&lt;br/&gt;&quot;..NEWLINE<br /> local TD = &#039;|&#039;<br /> local errors, dbgout<br /> <br /> local function debug(msg)<br /> mw.log(msg)<br /> dbgout = dbgout .. msg .. BR_NEWLINE<br /> end<br /> <br /> local function debugv(var, value)<br /> local s = var .. &quot;=&quot; .. value<br /> mw.log(s)<br /> dbgout = dbgout .. s .. BR_NEWLINE<br /> end<br /> <br /> local function addError(msg)<br /> errors = errors .. msg .. BR_NEWLINE<br /> debug(msg)<br /> end<br /> <br /> local function errorFont(value)<br /> return &quot;&lt;font color=red&gt;&quot; .. value .. &quot;&lt;/font&gt;&quot;<br /> end<br /> <br /> -- Split a string based on a separator<br /> local function split(istring, sep)<br /> -- if sep is null, use default<br /> if sep == nil then sep = FS end<br /> <br /> local t = {}<br /> for str in string.gmatch(istring, &#039;([^&#039;..sep..&#039;]+)&#039;) do<br /> table.insert(t, str)<br /> end<br /> return t<br /> end<br /> <br /> -- Strip newline character at end --<br /> local function stripNewline(value)<br /> local n = string.find(value, NEWLINE)<br /> if n then<br /> return string.sub(value, 1, n-1)<br /> end<br /> return value<br /> end<br /> <br /> -- Extract raw elevation/prominence/isolation value<br /> local function extractRaw(value)<br /> local i, i1, i2, n<br /> local units = { &quot; metre&quot;, &quot; feet&quot;, &quot; kilometre&quot; }<br /> if value == nil then return -1 end<br /> i = string.find(value, &quot; metre&quot;)<br /> if i then<br /> -- remove thousands separator while we are it<br /> return string.sub(value, 1, i-1):gsub(&#039;,&#039;, &#039;&#039;)<br /> end<br /> i = string.find(value, &quot;feet&quot;) <br /> if i then<br /> return string.sub(value, 1, i-1):gsub(&#039;,&#039;, &#039;&#039;)<br /> end<br /> i = string.find(value, &quot; kilometre&quot;) <br /> if i then<br /> return string.sub(value, 1, i-1):gsub(&#039;,&#039;, &#039;&#039;)<br /> end<br /> return -1<br /> end<br /> <br /> -- Call {{elevation_cells} to format the values<br /> local function getElevationCells(frame, elev, unit)<br /> if frame.expandTemplate then<br /> return frame:expandTemplate{title=&#039;elevation_cells&#039;, args= { elev, unit}}<br /> end<br /> <br /> return &quot;{{elevation_cells|&quot; .. elev .. &quot;|&quot; .. unit .. &quot;}}&quot;<br /> end<br /> <br /> local function getProminenceCells(frame, prom)<br /> return frame:expandTemplate{title=&#039;convert&#039;, args= { prom, &quot;km&quot;, &quot;mi&quot;, disp=&#039;table&#039;, sortable=&#039;on&#039;}}<br /> end<br /> <br /> local function stripBrackets(value)<br /> local stripped = value;<br /> <br /> -- strip leading brackets if found<br /> local n = string.find(stripped, &quot;%[%[&quot;)<br /> if n then<br /> stripped = string.sub(stripped, 3)<br /> end<br /> <br /> -- strip trailing brackets if found<br /> n = string.find(stripped, &quot;%]%]&quot;)<br /> if n then<br /> stripped = string.sub(stripped,1,n-1)<br /> end<br /> <br /> if stripped then return stripped<br /> else return value end<br /> end<br /> <br /> local function getPage(name)<br /> local parts = split(name,&quot;|&quot;)<br /> local page = parts[1]<br /> local n = string.find(page, &quot;%[%[&quot;)<br /> if n then<br /> page = string.sub(page,3)<br /> end<br /> n = string.find(page, &quot;%]%]&quot;)<br /> if n then<br /> page = string.sub(page,1,n-1)<br /> end<br /> return page<br /> end<br /> <br /> local function getPageTitle(name)<br /> local title<br /> <br /> local parts = split(name,&quot;|&quot;)<br /> if parts[2] then<br /> title = stripBrackets(parts[2])<br /> else<br /> title = stripBrackets(parts[1])<br /> end<br /> mw.log(&quot;name=&quot;..name..&quot;;title=&quot;..title)<br /> return title<br /> end<br /> <br /> --[[<br /> Retrieve a entity&#039;s property value from Wikidata. Unfortunately<br /> the interface only supports one property at a time.<br /> ]]<br /> local function getWD(frame, eid, name, cmdFlag, multiple)<br /> if not frame.preprocess then<br /> return &quot;{{Wikidata|property|&quot; .. name .. &quot;|eid=&quot; .. eid .. &quot;}}&quot;<br /> end<br /> <br /> local args<br /> if not multiple then args = &quot;property|&quot; else args = &quot;properties|&quot; end<br /> if cmdFlag then args = args .. cmdFlag .. &quot;|&quot; end<br /> args = args .. name .. &quot;|eid=&quot; .. eid <br /> local invoke = &quot;{{#invoke:Wd|&quot; .. args .. &quot;}}&quot;<br /> local value = frame:preprocess(invoke)<br /> mw.log(invoke .. &quot; =&gt; &quot; .. value)<br /> return value<br /> end<br /> <br /> -- Get a wiki linked property value<br /> local function getWDLinked(frame, eid, name)<br /> return getWD(frame, eid, name, &quot;linked&quot;, false)<br /> end<br /> <br /> -- Get the raw value of a property value<br /> local function getWDRaw(frame, eid, name)<br /> return getWD(frame, eid, name, &quot;raw&quot;, false)<br /> end<br /> <br /> -- Get an entity&#039;s property from Wikidata<br /> local function getWDProperty(frame, eid, name, linked)<br /> debug(&quot;eid=&quot; .. eid .. &quot; name=&quot; .. name)<br /> <br /> --[[ local stmts = mw.wikibase.getBestStatements(eid, name)<br /> if stmts ~= nil then<br /> mw.logObject(stmts)<br /> for i=1,#stmts do<br /> mw.log(&quot;stmts[&quot;..i..&quot;]=&quot;..stmts[i]);<br /> end<br /> end ]]<br /> <br /> -- call Module:Wd using template syntax<br /> if frame.preprocess then<br /> local args = &quot;property|&quot;<br /> if linked then args = args .. &quot;linked|&quot; end<br /> args = args .. name .. &quot;|eid=&quot; .. eid <br /> local invoke = &quot;{{#invoke:Wd|&quot; .. args .. &quot;}}&quot;<br /> local value = frame:preprocess(invoke)<br /> debug(invoke .. &quot; =&gt; &quot; .. value)<br /> return value<br /> end<br /> return &quot;{{Wikidata|property|&quot; .. name .. &quot;|eid=&quot; .. eid .. &quot;}}&quot;<br /> end<br /> -- if frame.expandTemplate then<br /> -- local args = { [&#039;1&#039;] = name, [&#039;page&#039;] = page }<br /> -- return wd._property({eid, args})<br /> -- local args = { [&#039;1&#039;] = &#039;property&#039;, [&#039;2&#039;] = name, [&#039;page&#039;] = page }<br /> -- return frame:expandTemplate{title=&#039;Wikidata&#039;, args= args}<br /> <br /> local function stripCoords(wdCoords)<br /> --debugv(&quot;wdCoords&quot;, wdCoords)<br /> if Options.test then -- this only shows up in console test mode<br /> local stripped = string.gsub(wdCoords, &quot;\&quot;`UNIQ%-%-templatestyles%-%d+%-QINU`\&quot;&quot;, &quot;&quot;)<br /> --debugv(&quot;stripped&quot;, stripped)<br /> return stripped<br /> end<br /> return wdCoords<br /> end<br /> <br /> local function getCountry(frame, eid)<br /> local value = getWD(frame, eid, WD_PROPERTIES.country, nil, true)<br /> return value<br /> end<br /> <br /> -- get location coordinates<br /> local function getCoords(frame, eid)<br /> local wdCoords = getWDLinked(frame, eid, WD_PROPERTIES.coords)<br /> return stripCoords(wdCoords)<br /> end<br /> <br /> -- Call Module:Titled_coords to get titled coordinates<br /> local function getTitledCoords(frame, eid, page)<br /> local title = getPageTitle(page)<br /> local raw_coords = getWDRaw(frame, eid, WD_PROPERTIES.coords)<br /> local fmt_coords = Titled_coords.build(raw_coords, title, &quot;&quot;)<br /> debug(fmt_coords .. &quot; =&gt; &quot; .. fmt_coords)<br /> return stripCoords(fmt_coords)<br /> end<br /> <br /> local function getElevation(frame, eid)<br /> local value = getWD(frame, eid, WD_PROPERTIES.elevation, nil)<br /> return extractRaw(value)<br /> end<br /> <br /> local function getFirstAscent(frame, eid)<br /> if frame.preprocess == nil then return FA_ERROR end<br /> <br /> local names = WD_PROPERTIES.sig_event .. &quot;|&quot; .. QID_FIRST_ASCENT .. &quot;|&quot; .. WD_PROPERTIES.pt_in_time<br /> local value = frame:preprocess(&quot;{{#invoke:Wd|property|qualifier|&quot; .. names .. &quot;|eid=&quot; .. eid .. &quot;}}&quot;)<br /> debugv(&quot;FA value&quot;, value)<br /> if value == &quot;&quot; then<br /> debugv(&quot;No FA found for eid&quot;, eid)<br /> return FA_UNKNOWN<br /> end<br /> <br /> -- FA deliberately set to unknown value<br /> if string.find(value, &quot;(unknown)&quot;) then<br /> debugv(&quot;FA unknown for eid&quot;, eid)<br /> return FA_UNKNOWN<br /> end<br /> <br /> -- Find date such as: 10 July 1913<br /> local i1, i2 = string.find(value, &quot;%(%d+%s%a*%s%d%d%d%d%)&quot;)<br /> if i1 then<br /> --mw.log(&quot;i1=&quot;..i1)<br /> local date = string.sub(value, i1+1, i2-1)<br /> debugv(&quot;FA date&quot;, date)<br /> local len = string.len(date)<br /> local year = string.sub(date, len-4, len)<br /> return year<br /> end<br /> <br /> -- Find date with just the year; e.g. (2025)<br /> i1, i2 = string.find(value, &quot;%(%d+%)&quot;)<br /> if i1 then<br /> local year = string.sub(value, i1+1, i2-1)<br /> return year<br /> end<br /> addError(&quot;Unknown FA date format for eid &quot; .. eid .. &quot;: &quot; .. value)<br /> return FA_ERROR<br /> end<br /> <br /> -- *** get topgraphic isolation from Wikidata ***<br /> local function getIsolation(frame, eid)<br /> local isoltn = getWD(frame, eid, WD_PROPERTIES.isolation, nil)<br /> return extractRaw(isoltn)<br /> end<br /> <br /> -- get prominence from Wikidata<br /> local function getProminence(frame, eid)<br /> local prom = getWD(frame, eid, WD_PROPERTIES.prominence, nil)<br /> return extractRaw(prom)<br /> end<br /> <br /> -- get mountain range from Wikidata. We want it wiki-linked for<br /> -- the first occurrence of it in the output.<br /> local function getRange(frame, eid)<br /> return getWDLinked(frame, eid, WD_PROPERTIES.mtn_range)<br /> end<br /> <br /> -- generate table header<br /> local function genHeader(options, unit)<br /> local unit_1, unit_2<br /> <br /> if unit == nil or unit == &quot;&quot; then<br /> unit = UNITS.METRE<br /> end<br /> <br /> if unit == UNITS.METRE then unit_1 = UNITS.METRE; unit_2 = UNITS.FEET<br /> else unit_1 = UNITS.FEET; unit_2 = UNITS.METRE<br /> end<br /> <br /> local s = &quot;{| class=\&quot;wikitable sortable\&quot;\n!&quot;<br /> <br /> if options.showRank then<br /> s = s .. &quot; align=\&quot;left\&quot; rowspan=2|&quot; ..COL_TITLES.rank .. &quot;||&quot;<br /> end<br /> <br /> s = s .. &quot;rowspan=2|&quot; .. COL_TITLES.name<br /> if options.showCountry then s = s .. &quot;||rowspan=2|&quot; .. COL_TITLES.country end<br /> if options.showCustom1 then s = s .. &quot;||rowspan=2|&quot; .. COL_TITLES.custom end<br /> s = s .. &quot;||colspan=2|&quot; .. COL_TITLES.elev<br /> if options.showProm then s = s .. &quot;||colspan=2|&quot; .. COL_TITLES.prom end<br /> if options.showIsolation then s = s .. &quot;||colspan=2|&quot; .. COL_TITLES.isoltn end<br /> if options.showRange then s = s .. &quot;||rowspan=2|&quot; .. COL_TITLES.range end<br /> if options.showFA then s = s .. &quot;||rowspan=2|&quot; .. COL_TITLES.fa end<br /> if options.showCustom2 then s = s .. &quot;||rowspan=2|&quot; .. COL_TITLES.custom end<br /> if options.showCoord or options.showTCoord then s = s .. &quot;||rowspan=2|&quot; .. COL_TITLES.coords end<br /> <br /> s = s .. &quot;\n|-\n&quot;<br /> s = s .. &#039;!&#039; .. unit_1 .. &#039;||&#039; .. unit_2 -- elevation cells<br /> if options.showProm then s = s .. &#039;||&#039; .. unit_1 .. &#039;||&#039; .. unit_2 end<br /> if options.showIsolation then<br /> local iso_u1, iso_u2<br /> if unit == UNITS.METRE then iso_u1 = UNITS.KILOMETRE; iso_u2 = UNITS.MILE<br /> else iso_u1 = UNITS.MILE; iso_u2 = UNITS.KILOMETRE<br /> end<br /> s = s .. &#039;||&#039; .. iso_u1 .. &#039;||&#039; .. iso_u2<br /> end<br /> s = s .. NEWLINE<br /> <br /> return s<br /> end<br /> <br /> local function finish()<br /> return &quot;|}&quot; -- table end<br /> end<br /> <br /> local function handleCustomOption(n, options, columnTitle)<br /> if columnTitle then<br /> COL_TITLES.custom = columnTitle<br /> end<br /> if n == 1 then options.showCustom1 = true else options.showCustom2 = true end<br /> end<br /> <br /> --[[ Process run options<br /> rank - show ranking<br /> name - override default name column title<br /> elev - show elevation<br /> prom - show prominence<br /> isolation - show isolation<br /> range - show mountain range or subrange from WD<br /> fa - show first ascent (year only) from WD<br /> coords - show coordinates from WD<br /> tcoords - show titled coordinates from WD<br /> custom[1|2]- show custom field (e.g. Notes)<br /> country - show country<br /> debug - generate debug information<br /> ]]<br /> local function processOptions(runOptions)<br /> local o = Options<br /> if runOptions == nil then return o end<br /> runOptions = stripNewline(runOptions)<br /> debugv(&quot;runOptions&quot;, runOptions)<br /> <br /> local parts = split(runOptions, OPTIONS_SEP)<br /> for i=1,#parts do<br /> option = parts[i]<br /> debugv(&quot;option&quot;, option)<br /> <br /> -- Strip out column title if given for an option<br /> local colTitle<br /> local n = string.find(option, COL_TITLE_SEP)<br /> if n then<br /> colTitle = string.sub(option, n+1)<br /> debugv(&quot;colTitle&quot;, colTitle)<br /> option = string.sub(option, 1, n-1)<br /> end<br /> <br /> local valid_option = true<br /> if option == OPT_NAMES.RANK then o.showRank = true<br /> elseif option == OPT_NAMES.PROM then o.showProm = true<br /> elseif option == OPT_NAMES.FA then o.showFA = true<br /> elseif option == OPT_NAMES.PROM then o.showProm = true<br /> elseif option == OPT_NAMES.ISOLTN then o.showIsolation = true<br /> elseif option == OPT_NAMES.COORDS then<br /> o.showCoord = true<br /> if colTitle then COL_TITLES.coords = colTitle end<br /> elseif option == OPT_NAMES.TCOORDS then<br /> o.showTCoord = true<br /> if colTitle then COL_TITLES.coords = colTitle end<br /> elseif option == OPT_NAMES.RANGE then<br /> o.showRange = true<br /> if colTitle then COL_TITLES.range = colTitle end<br /> elseif option == OPT_NAMES.CUSTOM1 then<br /> handleCustomOption(1, o, colTitle)<br /> elseif option == OPT_NAMES.CUSTOM2 then<br /> handleCustomOption(2, o, colTitle)<br /> elseif option == OPT_NAMES.COUNTRY then o.showCountry = true<br /> elseif option == OPT_NAMES.NAME then<br /> if colTitle then COL_TITLES.name = colTitle end<br /> elseif option == OPT_NAMES.ORDER then<br /> if colTitle and colTitle == &quot;prom&quot; then<br /> o.rankOrder = RANK_ORDER.PROM<br /> end<br /> elseif option == OPT_NAMES.DEBUG then o.debug = true<br /> else<br /> addError(&quot;Unknown option: &quot; .. option)<br /> valid_option = false<br /> end<br /> end<br /> <br /> return o<br /> end<br /> <br /> -- ** Process a mountain line **<br /> local function processLine(frame, options, line)<br /> local parts, n, name, elev, page, custom, has_custom<br /> <br /> -- argument contains elevation, page link and custom value<br /> parts = split(line, FS)<br /> if #parts == 2 then<br /> has_custom = false<br /> elseif #parts &lt; 3 then<br /> local m = &quot;&lt;br/&gt;Bad format on argument (&lt;nowiki&gt;&quot; .. line .. &quot;&lt;/nowiki&gt;) -- skipped&quot;<br /> errors = errors .. m<br /> mw.log(m)<br /> return nil<br /> else<br /> has_custom = true<br /> end<br /> <br /> local mtn = Mountain<br /> <br /> elev = parts[1] -- &quot;m&quot; or &quot;ft&quot;<br /> name = parts[2] -- wiki-linked name<br /> if name then<br /> page = getPage(name)<br /> debug(&quot;name = &quot; .. name .. &quot;;page = &quot; .. page)<br /> else<br /> debug(&quot;name is null&quot;)<br /> return nil<br /> end<br /> <br /> mtn.name = name<br /> mtn.page = page<br /> mtn.eid = nil<br /> mtn.elevation = elev;<br /> mtn.elevation_wd = 0<br /> mtn.prominence = nil<br /> mtn.isolation = nil<br /> mtn.range = &quot;&quot;<br /> mtn.fa = &quot;&quot;<br /> <br /> if options.showCustom1 or options.showCustom2 then<br /> if has_custom then<br /> custom = stripNewline(parts[3])<br /> debugv(&quot;custom&quot;, custom)<br /> else<br /> custom = NBSP<br /> end<br /> mtn.custom = custom<br /> end<br /> <br /> -- Get the Wikidata entity id<br /> local eid = mw.wikibase.getEntityIdForTitle(page)<br /> if not eid then<br /> debug(&quot;Cannot find entity id for page &quot; .. page)<br /> mtn.name = mtn.name .. BR_NEWLINE .. errorFont(&quot;Cannot find entity id&quot;)<br /> return mtn<br /> end<br /> debug(&quot;page=&quot;..page .. &quot;,eid=&quot; .. eid)<br /> mtn.eid = eid<br /> <br /> mtn.elevation_wd = getElevation(frame, eid)<br /> mtn.prominence = getProminence(frame, eid)<br /> if options.showIsolation then<br /> mtn.isolation = getIsolation(frame, eid)<br /> debugv(&quot;mtn.isolation&quot;, mtn.isolation)<br /> end<br /> <br /> if options.showRange then<br /> mtn.range = getRange(frame, eid)<br /> end<br /> <br /> if options.showFA then<br /> mtn.fa = getFirstAscent(frame, eid)<br /> end<br /> <br /> if options.showCoord then<br /> mtn.coords = getCoords(frame, eid)<br /> end<br /> <br /> if options.showTCoord then<br /> mtn.coords = getTitledCoords(frame, eid, mtn.name)<br /> end<br /> <br /> if options.showCountry then<br /> mtn.country = getCountry(frame, eid)<br /> end<br /> <br /> return mtn<br /> end<br /> <br /> -- Process a mountain range. Only display the linked range once.<br /> local function processRange(ranges, mtn)<br /> local found = false;<br /> local range = mtn.range<br /> for k,v in pairs(ranges) do<br /> if v == range then<br /> found = true; break<br /> end<br /> end<br /> <br /> if not found then<br /> debug(&quot;Adding range &quot; .. range)<br /> table.insert(ranges, range)<br /> else<br /> local i1, i2 = string.find(range, &quot;|&quot;)<br /> if i1 then<br /> local ei = string.len(range) - 2 -- strip ending brackets<br /> name = string.sub(range, i1+1, ei)<br /> else<br /> local len = string.len(range)<br /> name = string.sub(range, 3, len-2)<br /> end<br /> mtn.range = name<br /> end<br /> end<br /> <br /> -- *** Main entry point ***<br /> function p.list(frame)<br /> local debug_on = false<br /> local rank_number = 0<br /> local last_elev, last_prom = &quot;&quot;<br /> local same_rank = 0<br /> <br /> errors = &quot;&quot;; dbgout = &quot;&quot;<br /> --debugv(&quot;args[1]&quot;, frame.args[1])<br /> --debugv(&quot;args[2]&quot;, frame.args[2])<br /> --debugv(&quot;args[3]&quot;, frame.args[3])<br /> local unit = frame.args[1]<br /> local options = processOptions(frame.args[2])<br /> if options.showCoord and options.showTCoord then<br /> return &quot;&lt;p&gt;&quot; .. errorFont(&quot;Can only specify one of coords or tcoords&quot;) .. &quot;&lt;/p&gt;&quot;<br /> end<br /> <br /> -- Create the output buffer and add the table header<br /> local getBuffer, print, printf = newBuffer()<br /> print(genHeader(options, unit))<br /> local ranges = {}<br /> local rankOrderElev = options.rankOrder == RANK_ORDER.ELV<br /> <br /> -- Main processing loop<br /> for i=3,502,1 do<br /> local prom_cells, isoltn_cells<br /> local line = frame.args[i]<br /> if line == nil then break end<br /> <br /> debugv(&quot;line&quot;, line)<br /> local mtn = processLine(frame, options, line)<br /> if mtn then -- only do if no error<br /> if options.showRank then<br /> if rankOrderElev then<br /> if last_elev ~= mtn.elevation then<br /> rank_number = rank_number + 1 + same_rank<br /> mtn.rank = rank_number<br /> last_elev = mtn.elevation<br /> same_rank = 0<br /> else<br /> same_rank = same_rank + 1<br /> end<br /> else -- ranked by prominence<br /> if last_prom ~= mtn.prominence then<br /> rank_number = rank_number + 1 + same_rank<br /> mtn.rank = rank_number<br /> last_prom = mtn.prominence<br /> same_rank = 0<br /> else<br /> same_rank = same_rank + 1<br /> end<br /> end<br /> end<br /> <br /> if options.showRange and mtn.eid then<br /> processRange(ranges, mtn)<br /> end<br /> <br /> local elev_cells = getElevationCells(frame, mtn.elevation, unit)<br /> local prom = mtn.prominence<br /> if prom ~= nil and prom ~= -1 and prom ~= &quot;&quot; then<br /> prom_cells = getElevationCells(frame, prom, unit)<br /> else<br /> prom_cells = &quot;&amp;nbsp;||&amp;nbsp;&quot;<br /> end<br /> <br /> if options.showIsolation then<br /> local isoltn = mtn.isolation<br /> if isoltn and isoltn ~= -1 and isoltn ~= &quot;&quot; then<br /> isoltn_cells = getProminenceCells(frame, mtn.isolation)<br /> else<br /> isoltn_cells = &quot;&amp;nbsp;||&amp;nbsp;&quot;<br /> end<br /> debugv(&quot;isoltn_cells&quot;, isoltn_cells)<br /> end<br /> <br /> debug(&quot;elev=&quot; .. mtn.elevation ..&quot;;elev_wd=&quot;..mtn.elevation_wd)<br /> if (options.showCustom1 or options.showCustom2) and mtn.elevation_wd ~= 0 and mtn.elevation ~= mtn.elevation_wd then<br /> local mm = &quot;&lt;br/&gt;&lt;font color=green&gt;Local/WD elevations mismatch: &quot; .. &quot;\&quot;&quot; .. mtn.elevation .. &quot;\&quot;&quot;.. &quot;/\&quot;&quot; .. mtn.elevation_wd.. &quot;\&quot;&lt;/font&gt;&quot;<br /> mtn.custom = mtn.custom .. mm<br /> end<br /> <br /> print(&quot;|-\n|&quot;)<br /> if options.showRank then print(&quot;align=center|&quot; .. mtn.rank .. &quot;||&quot;) end<br /> print(mtn.name)<br /> if options.showCountry then printf(&quot;\n|%s&quot;, mtn.country) end<br /> printf(&quot;\n|%s\n&quot;, elev_cells)<br /> if options.showProm then printf(&quot;|%s\n&quot;, prom_cells) end<br /> if options.showIsolation then printf(TD .. &quot;%s\n&quot;, isoltn_cells) end<br /> if options.showRange then printf(TD .. &quot;%s\n&quot;, mtn.range) end<br /> if options.showFA then printf(TD .. &quot;%s\n&quot;, mtn.fa) end<br /> if options.showCustom2 then printf(TD .. &quot;%s\n&quot;, mtn.custom) end<br /> if options.showCoord or options.showTCoord then printf(TD .. &quot;%s\n&quot;, mtn.coords) end<br /> <br /> end<br /> end -- for<br /> <br /> print(finish())<br /> if debug_on then<br /> printf(&quot;&lt;/br&gt;&lt;nowiki&gt;%s&lt;/nowiki&gt;\n&quot;)<br /> end<br /> <br /> if string.len(errors) &gt; 0 then<br /> printf(&quot;&lt;font color=red&gt;%s&lt;/font&gt;\n&quot;, errors)<br /> end<br /> if options.debug and string.len(dbgout) &gt; 0 then<br /> printf(&quot;&lt;br/&gt;&lt;font color=green&gt;Debug output&lt;br/&gt;\n%s&lt;/font&gt;\n&quot;, dbgout)<br /> end<br /> <br /> return getBuffer(&#039;&#039;)<br /> end<br /> <br /> --[[<br /> Test via Preview Window Debug console<br /> print(p.test())<br /> ]]<br /> <br /> function p._test(doDebug)<br /> local frame = mw.getCurrentFrame()<br /> -- if frame then mw.logObject(frame) end<br /> -- local test_data = { {[&quot;e&quot;]=&quot;3954&quot;,[&quot;p&quot;]=&quot;[[Mount Robson]]&quot;,<br /> -- [&quot;n&quot;]=&quot;Highest point in the Canadian Rockies&lt;ref name=robson/&gt;&quot;},<br /> -- {[&quot;e&quot;]=&quot;3747&quot;,[&quot;p&quot;]=&quot;[[Mount Columbia (Canada)|Mount Columbia]]&quot;,<br /> -- [&quot;n&quot;]=&quot;Highest point in [[Alberta]]&lt;ref name=columbia/&gt;&quot;}<br /> -- }<br /> local sep = &quot;,&quot;<br /> frame.args = {}<br /> frame.args[1] = &#039;m&#039;<br /> frame.args[2] = OPT_NAMES.RANK..sep..<br /> OPT_NAMES.RANGE..COL_TITLE_SEP..&quot;Mtn Range&quot;..sep..OPT_NAMES.FA<br /> ..sep..OPT_NAMES.PROM<br /> --..sep..OPT_NAMES.ISOLTN<br /> ..sep..OPT_NAMES.TCOORDS<br /> ..sep..OPT_NAMES.CUSTOM2..COL_TITLE_SEP..&quot;Additional info&quot;<br /> -- ..sep..OPT_NAMES.COUNTRY<br /> -- ..sep..OPT_NAMES.ORDER..COL_TITLE_SEP..&quot;prom&quot;<br /> if doDebug then frame.args[2] = frame.args[2] ..sep .. OPT_NAMES.DEBUG end<br /> <br /> frame.args[3] = &quot;3954&quot;..FS..&quot;[[Mount Robson]]&quot;..FS..&quot;Highest point in the Canadian Rockies&lt;ref name=robson/&gt;&quot;<br /> frame.args[4] = &quot;3448&quot;..FS..&quot;[[Mount Saint Elias]]&quot;..FS..&quot;Canada/US border&quot;<br /> frame.args[5] = &quot;3310&quot;..FS..&quot;[[Mount Vaux]]&quot;..FS..&quot;Ottertail Range&quot;<br /> frame.args[6] = &quot;3204&quot;..FS..&quot;[[Ghost Mountain (Chaba Icefield)|Ghost Mountain]]&quot;..FS..&quot;&lt;ref name=ghost/&gt;&quot;<br /> frame.args[7] = &quot;2433&quot;..FS..&quot;[[Saddle Mountain (Alberta)|Saddle Mountain]]&quot;..FS<br /> --[===[<br /> frame.args[3] = &quot;3954&quot;..FS..&quot;[[Mount Robson]]&quot;..FS..&quot;Highest point in the Canadian Rockies&lt;ref name=robson/&gt;&quot;<br /> frame.args[4] = &quot;3747&quot;..FS..&quot;[[Mount Columbia (Canada)|Mount Columbia]]&quot;..FS..&quot;Highest point in [[Alberta]]&lt;ref name=columbia/&gt;&quot;<br /> frame.args[5] = &quot;3731&quot;..FS..&quot;[[North Twin Peak]]&quot;..FS..&quot;Highest peak of The Twins Massif&quot;<br /> frame.args[6] = &quot;3648&quot;..FS..&quot;[[Mount Clemenceau]]&quot;..FS..&quot;Named for [[Georges Clemenceau]], premier of France during WWI&quot;<br /> frame.args[7] = &quot;3619&quot;..FS..&quot;[[Mount Alberta]]&quot;..FS..&quot;Most difficult +11,000 climbing objective&lt;ref name=alberta/&gt;&quot;<br /> frame.args[8] = &quot;3618&quot;..FS..&quot;[[Mount Assiniboine]]&quot;..FS..&quot;Highest point in the Southern Rockies&lt;ref name=assiniboine/&gt;&quot;<br /> frame.args[9] = &quot;3612&quot;..FS..&quot;[[Mount Forbes]]&quot;..FS..&quot;Highest point within the confines of [[Banff National Park|Banff Nat&#039;l Park]]&lt;ref name=forbes/&gt;&quot;<br /> frame.args[10] = &quot;3567&quot;..FS..&quot;[[Mount Goodsir]]&quot;..FS..&quot;Two major summits: South Tower and North Tower (lowest)&quot;<br /> frame.args[11] = &quot;3556&quot;..FS..&quot;[[South Twin Peak]]&quot;..FS..&quot;Lowest peak of The Twins Massif&quot;<br /> frame.args[12] = &quot;3543&quot;..FS..&quot;[[Mount Temple (Alberta)|Mount Temple]]&quot;..FS..&quot;Highest point near [[Lake Louise, Alberta|Lake Louise]]&lt;ref name=temple/&gt;&quot;<br /> frame.args[13] = &quot;3425&quot;..FS..&quot;[[Resplendent Mountain]]&quot;..FS..&quot;tbd&quot;<br /> frame.args[14] = &quot;3204&quot;..FS..&quot;[[Ghost Mountain (Park Ranges)|Ghost Mountain]]&quot;..FS..&quot;&lt;ref name=ghost/&gt;&quot;<br /> --]===]<br /> -- frame.args[7] = &quot;&quot;<br /> -- frame.args[8] = &quot;&amp;nbsp;&quot;<br /> --[[ Commented out<br /> local fi = 3<br /> for i=1,#test_data do<br /> frame.args[fi] = test_data[i][&quot;e&quot;] .. FS .. test_data[i][&quot;l&quot;] .. FS .. test_data[i][&quot;n&quot;]<br /> fi = fi + 1<br /> end ]]<br /> <br /> Options.test = true<br /> return p.list(frame)<br /> end<br /> <br /> function p.testd()<br /> return p._test(true)<br /> end<br /> <br /> function p.test()<br /> return p._test(false)<br /> end<br /> <br /> function p.test2()<br /> local s = &#039;&lt;a href=&quot;/wiki/Rainbow_Range_(Rocky_Mountains)&quot; title=&quot;Rainbow Range (Rocky Mountains)&quot;&gt;Rainbow Range&lt;/a&gt;&#039;<br /> --local i1,i2 = string.find(s,&quot;%&gt;(.*)%&lt;%/a%&gt;&quot;)<br /> local i1,i2 = string.find(s,&quot;%b&gt;&lt;&quot;)<br /> if i1 then <br /> mw.log(&quot;i1=&quot; .. i1 .. &quot; i2=&quot; .. i2)<br /> mw.log(string.sub(s,i1+1,i2-1))<br /> else<br /> mw.log(&quot;not found&quot;)<br /> end<br /> end<br /> <br /> function p.test3()<br /> mw.log(stripBrackets(&quot;[[abc]]&quot;))<br /> mw.log(stripBrackets(&quot;def&quot;))<br /> mw.log(stripBrackets(&quot;[[Mount Victoria (Bow Range)|Mount Victoria]]&quot;))<br /> mw.log(&quot;title=&quot; .. getPageTitle(&quot;[[Mount Victoria (Bow Range)|Mount Victoria]]&quot;))<br /> end<br /> <br /> function p.testR()<br /> local frame = mw.getCurrentFrame()<br /> frame.args = {}<br /> frame.args[1] = &#039;m&#039;<br /> frame.args[2] = &quot;debug,fa,tcoords,custom2:Easiest route&quot;<br /> <br /> frame.args[3] = &quot;3543&quot;..FS..&quot;[[Mount Temple (Alberta)|Mount Temple]]&quot;..FS..&quot;Moderate scramble on SW face&quot;<br /> frame.args[4] = &quot;3492&quot;..FS..&quot;[[Mount Hungabee|Hungabee Mountain]]&quot;..FS..&quot;[[International Climbing and Mountaineering Federation|UIAA]] III 5.4 on West ridge&quot;<br /> frame.args[5] = &quot;3464&quot;..FS..&quot;[[Mount Victoria (Bow Range)|Mount Victoria]]&quot;..FS..&quot;UIAA II on SE ridge, South Summitend&quot;<br /> <br /> Options.test = true<br /> return p.list(frame)<br /> end<br /> <br /> return p<br /> <br /> --[[<br /> {| class=&quot;wikitable sortable&quot;<br /> |- bgcolor=&quot;#ffffcc&quot;<br /> ! align=&quot;left&quot; rowspan=2|Rank||rowspan=2|Mountain/Peak ||colspan=2|Elevation ||colspan=2| Prominence ||rowspan=2| Subrange<br /> !rowspan=2| FA ||rowspan=2| Notes ||rowspan=2| References<br /> |-<br /> !m || ft || m || ft<br /> |-<br /> |align=center|1||Mount Robson<br /> |{{elevation_cells|3,959|m}}|{{elevation_cells|2829|m}}||Rainbow Range<br /> |1913||Highest point in the Canadian Rockies|| &lt;ref name=robson/&gt;<br /> ]]</div> RedWolf