https://en.wikipedia.org/w/index.php?action=history&feed=atom&title=Module%3AOSM%2Fsandbox Module:OSM/sandbox - Revision history 2025-05-25T19:20:02Z Revision history for this page on the wiki MediaWiki 1.45.0-wmf.2 https://en.wikipedia.org/w/index.php?title=Module:OSM/sandbox&diff=1149290603&oldid=prev Lemondoge: More simplification 2023-04-11T09:20:58Z <p>More simplification</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 09:20, 11 April 2023</td> </tr><tr> <td colspan="2" class="diff-lineno">Line 64:</td> <td colspan="2" class="diff-lineno">Line 64:</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> query = ''</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> query = ''</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" 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> if args.coord and <del style="font-weight: bold; text-decoration: none;">not</del>(args.limitToBBOX=<del style="font-weight: bold; text-decoration: none;">=</del>'no') then</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> if args.coord and (args.limitToBBOX<ins style="font-weight: bold; text-decoration: none;"> ~</ins>=<ins style="font-weight: bold; text-decoration: none;"> </ins>'no') 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> -- The user can provide coordinates and a zoom factor</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> -- The user can provide coordinates and a zoom factor</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> coord = '&amp;C=' .. args.coord</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> coord = '&amp;C=' .. args.coord</div></td> </tr> </table> Lemondoge https://en.wikipedia.org/w/index.php?title=Module:OSM/sandbox&diff=1149259548&oldid=prev Lemondoge: Slight simplifications 2023-04-11T03:33:31Z <p>Slight simplifications</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 03:33, 11 April 2023</td> </tr><tr> <td colspan="2" class="diff-lineno">Line 32:</td> <td colspan="2" class="diff-lineno">Line 32:</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> itemID = ""</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> itemID = ""</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> itemObject = nil</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> itemObject = nil</div></td> </tr> <tr> <td colspan="2" class="diff-empty diff-side-deleted"></td> <td class="diff-marker"><a class="mw-diff-movedpara-right" title="Paragraph was moved. Click to jump to old location." href="#movedpara_4_0_lhs">&#x26AB;</a></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><a name="movedpara_1_0_rhs"></a><ins style="font-weight: bold; text-decoration: none;"> elseif</ins> args.id then</div></td> </tr> <tr> <td colspan="2" class="diff-empty diff-side-deleted"></td> <td class="diff-marker"><a class="mw-diff-movedpara-right" title="Paragraph was moved. Click to jump to old location." href="#movedpara_6_0_lhs">&#x26AB;</a></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><a name="movedpara_1_1_rhs"></a> -- build query for specific Q-item(s) </div></td> </tr> <tr> <td colspan="2" class="diff-empty diff-side-deleted"></td> <td class="diff-marker"><a class="mw-diff-movedpara-right" title="Paragraph was moved. Click to jump to old location." href="#movedpara_8_0_lhs">&#x26AB;</a></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><a name="movedpara_1_2_rhs"></a> itemID = args.id</div></td> </tr> <tr> <td colspan="2" class="diff-empty diff-side-deleted"></td> <td class="diff-marker"><a class="mw-diff-movedpara-right" title="Paragraph was moved. Click to jump to old location." href="#movedpara_9_0_lhs">&#x26AB;</a></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><a name="movedpara_1_3_rhs"></a> pcall(function () itemObject = mw.wikibase.getEntityObject(mw.text.split(itemID,";")[1]) 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> else</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> else</div></td> </tr> <tr> <td colspan="2" class="diff-empty diff-side-deleted"></td> <td class="diff-marker"><a class="mw-diff-movedpara-right" title="Paragraph was moved. Click to jump to old location." href="#movedpara_9_2_lhs">&#x26AB;</a></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><a name="movedpara_3_0_rhs"></a> itemObject = mw.wikibase.getEntityObject()</div></td> </tr> <tr> <td class="diff-marker"><a class="mw-diff-movedpara-left" title="Paragraph was moved. Click to jump to new location." href="#movedpara_1_0_rhs">&#x26AB;</a></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><a name="movedpara_4_0_lhs"></a><del style="font-weight: bold; text-decoration: none;"> if</del> args.id then</div></td> <td colspan="2" class="diff-empty diff-side-added"></td> </tr> <tr> <td colspan="2" class="diff-empty diff-side-deleted"></td> <td class="diff-marker"><a class="mw-diff-movedpara-right" title="Paragraph was moved. Click to jump to old location." href="#movedpara_9_3_lhs">&#x26AB;</a></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><a name="movedpara_5_0_rhs"></a> if itemObject == nil then</div></td> </tr> <tr> <td class="diff-marker"><a class="mw-diff-movedpara-left" title="Paragraph was moved. Click to jump to new location." href="#movedpara_1_1_rhs">&#x26AB;</a></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><a name="movedpara_6_0_lhs"></a><del style="font-weight: bold; text-decoration: none;"> </del> -- build query for specific Q-item(s) </div></td> <td colspan="2" class="diff-empty diff-side-added"></td> </tr> <tr> <td colspan="2" class="diff-empty diff-side-deleted"></td> <td class="diff-marker"><a class="mw-diff-movedpara-right" title="Paragraph was moved. Click to jump to old location." href="#movedpara_9_4_lhs">&#x26AB;</a></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><a name="movedpara_7_0_rhs"></a> return "This page doesn't have a wikidata entry"</div></td> </tr> <tr> <td class="diff-marker"><a class="mw-diff-movedpara-left" title="Paragraph was moved. Click to jump to new location." href="#movedpara_1_2_rhs">&#x26AB;</a></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><a name="movedpara_8_0_lhs"></a><del style="font-weight: bold; text-decoration: none;"> </del> itemID = args.id</div></td> <td colspan="2" class="diff-empty diff-side-added"></td> </tr> <tr> <td class="diff-marker"><a class="mw-diff-movedpara-left" title="Paragraph was moved. Click to jump to new location." href="#movedpara_1_3_rhs">&#x26AB;</a></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><a name="movedpara_9_0_lhs"></a><del style="font-weight: bold; text-decoration: none;"> </del> pcall(function () itemObject = mw.wikibase.getEntityObject(mw.text.split(itemID,";")[1]) end)</div></td> <td colspan="2" class="diff-empty diff-side-added"></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> else</div></td> <td colspan="2" class="diff-empty diff-side-added"></td> </tr> <tr> <td class="diff-marker"><a class="mw-diff-movedpara-left" title="Paragraph was moved. Click to jump to new location." href="#movedpara_3_0_rhs">&#x26AB;</a></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><a name="movedpara_9_2_lhs"></a><del style="font-weight: bold; text-decoration: none;"> </del> itemObject = mw.wikibase.getEntityObject()</div></td> <td colspan="2" class="diff-empty diff-side-added"></td> </tr> <tr> <td class="diff-marker"><a class="mw-diff-movedpara-left" title="Paragraph was moved. Click to jump to new location." href="#movedpara_5_0_rhs">&#x26AB;</a></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><a name="movedpara_9_3_lhs"></a><del style="font-weight: bold; text-decoration: none;"> </del> if itemObject == nil then</div></td> <td colspan="2" class="diff-empty diff-side-added"></td> </tr> <tr> <td class="diff-marker"><a class="mw-diff-movedpara-left" title="Paragraph was moved. Click to jump to new location." href="#movedpara_7_0_rhs">&#x26AB;</a></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><a name="movedpara_9_4_lhs"></a><del style="font-weight: bold; text-decoration: none;"> </del> return "This page doesn't have a wikidata entry"</div></td> <td colspan="2" class="diff-empty diff-side-added"></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> end</div></td> <td colspan="2" class="diff-empty diff-side-added"></td> </tr> <tr> <td class="diff-marker"><a class="mw-diff-movedpara-left" title="Paragraph was moved. Click to jump to new location." href="#movedpara_11_0_rhs">&#x26AB;</a></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><a name="movedpara_9_6_lhs"></a><del style="font-weight: bold; text-decoration: none;"> </del> -- build query for current page</div></td> <td colspan="2" class="diff-empty diff-side-added"></td> </tr> <tr> <td class="diff-marker"><a class="mw-diff-movedpara-left" title="Paragraph was moved. Click to jump to new location." href="#movedpara_11_1_rhs">&#x26AB;</a></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><a name="movedpara_9_7_lhs"></a><del style="font-weight: bold; text-decoration: none;"> </del> itemID = itemObject.id</div></td> <td colspan="2" class="diff-empty diff-side-added"></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-empty diff-side-deleted"></td> <td class="diff-marker"><a class="mw-diff-movedpara-right" title="Paragraph was moved. Click to jump to old location." href="#movedpara_9_6_lhs">&#x26AB;</a></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><a name="movedpara_11_0_rhs"></a> -- build query for current page</div></td> </tr> <tr> <td colspan="2" class="diff-empty diff-side-deleted"></td> <td class="diff-marker"><a class="mw-diff-movedpara-right" title="Paragraph was moved. Click to jump to old location." href="#movedpara_9_7_lhs">&#x26AB;</a></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><a name="movedpara_11_1_rhs"></a> itemID = itemObject.id</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> -- Always perform a regular expression based search</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> -- Always perform a regular expression based search</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> -- The data may contain multiple values</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> -- The data may contain multiple values</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 frame.args.overpass == nil 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 frame.args.overpass == nil 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> itemID = '"~"(^|;)(' .. itemID:gsub(";", "<del style="font-weight: bold; text-decoration: none;">\</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> itemID = '"~"(^|;)(' .. itemID:gsub(";", "<ins style="font-weight: bold; text-decoration: none;">%</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;"><div> leftbracket = '["'</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> leftbracket = '["'</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> rightbracket = '"]'</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> rightbracket = '"]'</div></td> </tr> </table> Lemondoge https://en.wikipedia.org/w/index.php?title=Module:OSM/sandbox&diff=1149259392&oldid=prev Lemondoge: Create sandbox version of Module:OSM 2023-04-11T03:31:47Z <p>Create sandbox version of <a href="/wiki/Module:OSM" title="Module:OSM">Module:OSM</a></p> <p><b>New page</b></p><div>local function buildquery(frame, target)<br /> local textToDisplay, leftLink, rightLink, runQueryRightAway, itemObject, itemID, query, coord, bbox, remark, overpassUrl, primitives, timeout, style, logo<br /> local args = frame.args<br /> <br /> if args.display then<br /> -- text to display on link<br /> textToDisplay = &#039; &#039; .. args.display<br /> else<br /> textToDisplay = &#039;&#039;<br /> end<br /> if args.timeout then<br /> timeout = &#039;[timeout:&#039; .. args.timeout .. &#039;][out:json];\n&#039;<br /> else<br /> timeout = &#039;[timeout:20][out:json];\n&#039;<br /> end<br /> if args.link and args.link == &#039;no&#039; then<br /> -- just return the url<br /> leftLink = &#039;&#039;<br /> rightLink = &#039;&#039;<br /> textToDisplay = &#039;&#039;<br /> else<br /> leftLink = &#039;[&#039;<br /> rightLink = &#039;]&#039;<br /> end<br /> if args.run and args.run == &#039;no&#039; then<br /> -- don&#039;t run immediately<br /> runQueryRightAway = &#039;&#039;<br /> else<br /> runQueryRightAway = &#039;&amp;R&#039;<br /> end<br /> if frame.args.overpass then<br /> itemID = &quot;&quot;<br /> itemObject = nil<br /> else<br /> if args.id then<br /> -- build query for specific Q-item(s) <br /> itemID = args.id<br /> pcall(function () itemObject = mw.wikibase.getEntityObject(mw.text.split(itemID,&quot;;&quot;)[1]) end)<br /> else<br /> itemObject = mw.wikibase.getEntityObject()<br /> if itemObject == nil then<br /> return &quot;This page doesn&#039;t have a wikidata entry&quot;<br /> end<br /> -- build query for current page<br /> itemID = itemObject.id<br /> end<br /> end<br /> -- Always perform a regular expression based search<br /> -- The data may contain multiple values<br /> if frame.args.overpass == nil then<br /> itemID = &#039;&quot;~&quot;(^|;)(&#039; .. itemID:gsub(&quot;;&quot;, &quot;\|&quot;) .. &#039;)(;|$)&#039;<br /> leftbracket = &#039;[&quot;&#039;<br /> rightbracket = &#039;&quot;]&#039;<br /> else<br /> leftbracket = &#039;&#039;<br /> rightbracket = &#039;&#039;<br /> end<br /> <br /> if args.query then<br /> -- user can add their own tags to filter on<br /> query = args.query<br /> else<br /> if frame.args.overpass then<br /> return &quot;If you invoke with overpass, you have to include a query=&quot;<br /> end<br /> query = &#039;&#039;<br /> end<br /> if args.coord and not(args.limitToBBOX==&#039;no&#039;) then<br /> -- The user can provide coordinates and a zoom factor<br /> coord = &#039;&amp;C=&#039; .. args.coord<br /> -- In that case we can limit the search to the area in view<br /> bbox = &#039;({{bbox}})&#039;<br /> -- and tell them how to search wider.<br /> remark = &#039; // remove the &#039; .. bbox .. &#039;if you want the query to be executed globally&#039;<br /> else<br /> coord = &#039;&#039;<br /> bbox = &#039;&#039;<br /> remark = &#039;&#039;<br /> end<br /> overpassUrl = timeout .. &#039;(\n&#039;<br /> -- if the user specifies prim(itives), but then leaves the string empty, abort<br /> if args.prim then<br /> if args.prim == &#039;&#039; then<br /> return &quot;Please indicate which primitives you want to query for&quot;<br /> end<br /> primitives = args.prim<br /> else<br /> primitives = &#039;nwr&#039;<br /> end<br /> <br /> if primitives:find(&quot;n&quot;) then<br /> -- Include nodes<br /> overpassUrl = overpassUrl .. &#039;node&#039; .. leftbracket .. target .. itemID .. rightbracket .. query .. bbox .. &#039;;&#039; .. remark .. &#039;\n&#039;<br /> end<br /> if primitives:find(&quot;w&quot;) then<br /> -- Include ways<br /> overpassUrl = overpassUrl .. &#039;way&#039; .. leftbracket .. target .. itemID .. rightbracket .. query .. bbox .. &#039;;\n&#039;<br /> end<br /> if primitives:find(&quot;r&quot;) then<br /> -- Include relations<br /> overpassUrl = overpassUrl .. &#039;relation&#039; .. leftbracket .. target .. itemID .. rightbracket .. query .. bbox .. &#039;;\n&gt;&gt;;\n&#039;<br /> end <br /> overpassUrl = overpassUrl .. &#039;);\n&#039;<br /> overpassUrl = overpassUrl .. &#039;out geom;\n&#039;<br /> if args.style then<br /> style = args.style<br /> else<br /> if args.logo then<br /> logo = &quot; icon-image: url(&quot; .. args.logo .. &#039;);\n&#039;<br /> else<br /> if itemObject then<br /> logo = tostring(itemObject:formatPropertyValues(&#039;P154&#039;)[&#039;value&#039;]):gsub(&quot;&amp;#39;&quot;, &quot;&#039;&quot;)<br /> end<br /> if logo and not(logo == &#039;&#039;) then<br /> logo = &#039; icon-image: url(&quot;https://commons.wikimedia.org/wiki/Special:Redirect/file/&#039;.. logo .. &#039;&quot;);\n&#039;<br /> end<br /> end<br /> if logo then<br /> style = &quot;node [&quot;.. target ..&quot;]{\n text: name;\n&quot;.. logo .. &quot; icon-width: 32;}&quot;<br /> end<br /> end<br /> if style then<br /> overpassUrl = overpassUrl .. &#039;{{style:\n&#039; .. style .. &#039;\n}}\n&#039;<br /> end<br /> <br /> return leftLink .. &#039;http://overpass-turbo.eu/?Q=&#039; .. mw.uri.encode(overpassUrl, &quot;PATH&quot; ) .. coord .. runQueryRightAway .. textToDisplay .. rightLink<br /> end<br /> <br /> local p = {}<br /> <br /> function p.overpass( frame )<br /> frame.args.overpass = true<br /> return buildquery(frame, &#039;&#039;)<br /> end<br /> <br /> function p.wd( frame )<br /> return buildquery(frame, &#039;wikidata&#039;)<br /> end<br /> <br /> function p.pt( frame )<br /> frame.args.style = &quot;node {\n opacity: 0;\n fill-opacity: 0;}\nnode[highway=bus_stop], way[highway=bus_stop]{\n text: name;\n icon-image: url(&#039;icons/maki/bus-18.png&#039;);\n icon-width: 18;}&quot;<br /> frame.args.prim = &quot;r&quot;<br /> frame.args.timeout = 50<br /> return buildquery(frame, &#039;wikidata&#039;)<br /> end<br /> <br /> function p.etym( frame )<br /> return buildquery(frame, &#039;name:etymology:wikidata&#039;)<br /> end<br /> <br /> function p.subject( frame )<br /> return buildquery(frame, &#039;subject:wikidata&#039;)<br /> end<br /> <br /> function p.artist( frame )<br /> return buildquery(frame, &#039;artist:wikidata&#039;)<br /> end<br /> <br /> function p.architect( frame )<br /> return buildquery(frame, &#039;architect:wikidata&#039;)<br /> end<br /> <br /> function p.operator( frame )<br /> return buildquery(frame, &#039;operator:wikidata&#039;)<br /> end<br /> <br /> function p.brand( frame )<br /> return buildquery(frame, &#039;brand:wikidata&#039;)<br /> end<br /> <br /> return p</div> Lemondoge