Open main menu
Home
Random
Donate
Recent changes
Special pages
Community portal
Preferences
About Stockhub
Disclaimers
Search
User menu
Talk
Contributions
Create account
Log in
Editing
Module:Sandbox/Evad37/X1
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
-- This module is a sandbox. It is also used for testing XFDcloser local getArgs = require('Module:Arguments').getArgs local transcluder = require("Module:Transcluder") local mapframe = require("Module:Mapframe") local p = {} p.server = function(frame) return mw.site.server end p.main = function(frame) local childFrame = frame:newChild{ title = "Sandbox", args = {} } local FULLPAGENAME = childFrame:preprocess( "{{FULLPAGENAME}}" ) return FULLPAGENAME end p.getCoords = function(frame) local args = getArgs(frame, {parentFirst = true}) local title = args.article and mw.title.new(args.article) or mw.title.getCurrentTitle() local content = frame:preprocess( args.section and transcluder.getSection(content, args.section) or title:getContent() ) local coords = {} for geo in mw.ustring.gmatch(content, "<span class=\"geo%-default\">(.-)%)</span></span></span>%]</span>") do local coord = mw.ustring.match(geo, "<span class=\"geo%-dec\".->(.-)</span>") mw.logObject({ geo = geo, coord = coord }) if coord then local coord = mw.ustring.gsub(coord, "[Β° ]", "_") local name = mw.ustring.match(geo, "<span class=\"fn org\">(.-)</span>") coords[coord] = name end end local mapframeArgs = { display = "inline", frame = "yes" } local count = 1 for coord, name in pairs(coords) do mapframeArgs["type"..count] = "point" mapframeArgs["coord"..count] = coord mapframeArgs["title"..count] = name count = count + 1 end local map = mapframe._main(mapframeArgs) return frame:preprocess(map) end return p
Summary:
Please note that all contributions to Stockhub may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
Stockhub:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Templates used on this page:
Template:Coord
(
edit
)
Template:If mobile
(
edit
)
Template:Notice
(
edit
)
Template:WikidataCoord
(
edit
)
Module:Arguments
(
edit
)
Module:Coordinates
(
edit
)
Module:Mapframe
(
edit
)
Module:Sandbox/Evad37/X1
(
edit
)
Module:Sandbox/Evad37/X1/doc
(
edit
)
Module:Transcluder
(
edit
)