"ഘടകം:Coordinates" എന്ന താളിന്റെ പതിപ്പുകൾ തമ്മിലുള്ള വ്യത്യാസം

Content deleted Content added
(ചെ.) en:Module:Coordinates എന്നതിൽ നിന്ന് 7 പതിപ്പുകൾ ഇറക്കുമതി ചെയ്തു
add new functions per request of User:Jc86035
വരി 3:
templates. It provides several methods, including
 
{{#Invokeinvoke:Coordinates | coord }} : General function formatting and displaying
coordinate values.
 
{{#Invokeinvoke:Coordinates | dec2dms }} : Simple function for converting decimal
degree values to DMS format.
 
{{#Invokeinvoke:Coordinates | dms2dec }} : Simple function for converting DMS format
to decimal degree format.
 
{{#Invokeinvoke:Coordinates | link }} : Export the link used to reach the tools
 
]]
വരി 520:
 
Usage:
{{ Invoke#invoke:Coordinates | link }}
]]
വരി 533:
 
Usage:
{{ Invoke#invoke:Coordinates | dec2dms | decimal_coordinate | positive_suffix |
negative_suffix | precision }}
വരി 572:
 
Usage:
{{ Invoke#invoke:Coordinates | dms2dec | direction_flag | degrees |
minutes | seconds }}
വരി 595:
 
Usage:
{{ Invoke#invoke:Coordinates | coord }}
{{ Invoke#invoke:Coordinates | coord | lat | long }}
{{ Invoke#invoke:Coordinates | coord | lat | lat_flag | long | long_flag }}
...
വരി 651:
end
return text
end
 
--[[
coord2text
 
Extracts a single value from a transclusion of {{Coord}}.
IF THE GEOHACK LINK SYNTAX CHANGES THIS FUNCTION MUST BE MODIFIED.
 
Usage:
 
{{#invoke:Coordinates | coord2text | {{Coord}} | parameter }}
 
Valid values for the second parameter are: lat (signed integer), long (signed integer), type, scale, dim, region, globe, source
 
]]
function coordinates.coord2text(frame)
if frame.args[1] == '' or frame.args[2] == '' or not frame.args[2] then return nil end
frame.args[2] = mw.text.trim(frame.args[2])
if frame.args[2] == 'lat' or frame.args[2] == 'long' then
local result, negative = mw.text.split((mw.ustring.match(frame.args[1],'%d+.?%d*°[NS] %d+.?%d*°[EW]') or ''), ' ')
if frame.args[2] == 'lat' then
result, negative = result[1], 'S'
else
result, negative = result[2], 'W'
end
result = mw.text.split(result, '°')
if result[2] == negative then result[1] = '-'..result[1] end
return result[1]
else
return mw.ustring.match(frame.args[1], 'params=.-_'..frame.args[2]..':(.-)[ _]')
end
end
 
--[[
coordinsert
 
Injects some text into the Geohack link of a transclusion of {{Coord}} (if that text isn't already in the transclusion). Outputs the modified transclusion of {{Coord}}.
IF THE GEOHACK LINK SYNTAX CHANGES THIS FUNCTION MUST BE MODIFIED.
 
Usage:
 
{{#invoke:Coordinates | coordinsert | {{Coord}} | parameter:value | parameter:value | … }}
 
Do not make Geohack unhappy by inserting something which isn't mentioned in the {{Coord}} documentation.
 
]]
function coordinates.coordinsert(frame)
for i, v in ipairs(frame.args) do
if i ~= 1 then
if not mw.ustring.find(frame.args[1], (mw.ustring.match(frame.args[i], '^(.-:)') or '')) then frame.args[1] = mw.ustring.gsub(frame.args[1], '(params=.-)_? ', '%1_'..frame.args[i]..' ', 1) end
end
end
return frame.args[1]
end
 
"https://ml.wikipedia.org/wiki/ഘടകം:Coordinates" എന്ന താളിൽനിന്ന് ശേഖരിച്ചത്