Module:Sandbox/Tigerfell
Jump to navigation
Jump to search
This documentation is transcluded from Module:Sandbox/Tigerfell/doc. (Edit | history)
Note to editors: Please don't categorize this template by editing it directly. Instead, place the category in its documentation page, in its "includeonly" section.
Note to editors: Please don't categorize this template by editing it directly. Instead, place the category in its documentation page, in its "includeonly" section.
currently unused page
local p = {}
function p.slippymap(frame)
local output = {}
local marker = p.cleanParameter(frame.args[6])
local alignment = p.cleanParameter(frame.args[7])
output[1] = '<mapframe latitude="'
output[2] = frame.args[1]
output[3] = '" longitude="'
output[4] = frame.args[2]
output[5] = '" height="'
output[6] = frame.args[3]
output[7] = '" width="'
output[8] = frame.args[4]
output[9] = '" zoom="'
output[10] = frame.args[5]
output[11] = '" '
output[12] = p.addNonemptyParameter('align', frame.args[7])
output[13] = p.addNonemptyParameter('text', frame.args[8])
if marker == "no" then
output[14] = '/>'
else
output[14] = '>\n {\n "type": "Feature",\n "geometry": { "type": "Point", "coordinates": ['
output[15] = frame.args[2]
output[16] = ', '
output[17] = frame.args[1]
output[18] = '] },\n }\n </mapframe>'
end
return frame:preprocess(tostring(table.concat(output)))
end
-- cleans input of excessive whitespace typically added by linebreaks and spaces
function p.cleanParameter(input)
local output = ""
if (input ~= nil) then
output = string.gsub(input, "%s+", "")
end
return output
end
-- returns a parameter and its value if it is not unset or not empty only
function p.addNonemptyParameter(kartographerName, inputValue)
local output = {}
if (inputValue ~= nil and inputValue ~= '') then
output[1] = ' '
output[2] = kartographerName
output[3] = '="'
output[4] = inputValue
output[5] = '" '
end
return tostring(table.concat(output))
end
return p