Module:Coordinates: Difference between revisions

Jump to navigation Jump to search
update from sandbox. Add export hook for coord_url, remove uneccesary use of frame:preprocess
(trim spaces on direction for convert_dms2dec)
(update from sandbox. Add export hook for coord_url, remove uneccesary use of frame:preprocess)
Line 11:
{{#Invoke:Coordinates | dms2dec }} : Simple function for converting DMS format
to decimal degree format.
 
{{#Invoke:Coordinates | link }} : Export the link used to reach the tools
 
]]
Line 16 ⟶ 18:
math_mod = require( "Module:Math" );
globalFrame = nil
 
coordinates = {};
 
page_name = mw.uri.encode( mw.title.getCurrentTitle().prefixedText, 'WIKI' );
coord_link = '[//tools.wmflabs.org/geohack/geohack.php?pagename={{FULLPAGENAMEE}}&params=' .. page_name .. '&params='
 
--[[ Helper function, replacement for {{coord/display/title}} ]]
Line 205 ⟶ 209:
end
 
return '<span class="plainlinks nourlexpansion">' .. globalFrame:preprocess(
'[' .. coord_link .. uriComponents .. ' ' .. inner .. ']') .. '</span>'
'[//tools.wmflabs.org/geohack/geohack.php?pagename={{FULLPAGENAMEE}}&params=' ..
uriComponents .. ' ' .. inner .. ']') .. '</span>'
end
 
Line 454 ⟶ 457:
return errors;
end
 
--[[
link
 
Simple function to export the coordinates link for other uses.
 
Usage:
{{ Invoke:Coordinates | link }}
]]
function coordinates.link(frame)
return coord_link;
end
 
Anonymous user
Cookies help us deliver our services. By using our services, you agree to our use of cookies.

Navigation menu