Content deleted Content added
put coords into mapframe map |
mw.site.server |
||
(5 intermediate revisions by 2 users not shown) | |||
Line 1:
-- This module is a sandbox. It is also used for testing XFDcloser
local getArgs = require('Module:Arguments').getArgs
local
local mapframe = require("Module:Mapframe")
local p = {}
p.server = function(frame)
return mw.site.server
end
p.main = function(frame)
Line 16 ⟶ 20:
local title = args.article and mw.title.new(args.article) or mw.title.getCurrentTitle()
local content = frame:preprocess(
args.section and
)
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,
})
if coord then
local coord = mw.ustring.gsub(coord, "[° ]", "_")
local name = mw.ustring.match(geo, "<span class=\"fn org\">(.-)</span>")▼
coords[coord] = name
end
▲ local name = mw.ustring.match(geo, "<span class=\"fn org\">(.-)</span>")
▲ coords[coord] = name
end
local mapframeArgs = {
display = "inline",
frame = "yes"
}
local count = 1
for coord, name in pairs(coords) do
mapframeArgs["type"..count] =
mapframeArgs["coord"..count] = coord
mapframeArgs["title"..count] = name
count = count + 1
end
local map = mapframe._main(mapframeArgs)
|