"पटलम्:Coordinates" इत्यस्य संस्करणे भेदः
Content deleted Content added
Update from enwiki अङ्कनानि : जङ्गमदूरवाण्या सम्पादितम् जङ्गमदूरवाण्या जालसम्पादनम् |
Capankajsmilyo (talk) द्वारा कृता 439040 पूर्ववत्-प्रक्रिया निरस्तीक्रियताम् । अङ्कनम् : किए हुए कार्य को पूर्ववत करना |
||
पङ्क्तिः १:
--[[
एतत् पटलं भोजपुरीविकि-तः आयातीकृतम् आस्ति। देवनागरीलिप्याम् अङ्कान् प्रदर्शयितुम् एतत् पटलम् अस्ति।
This module is intended to replace the functionality of {{Coord}} and related
templates. It provides several methods, including
Line १९ ⟶ २१:
local math_mod = require("Module:Math")
local convert = require( "Module:Numeral converter").convert;
local coordinates = {};
local current_page = mw.title.getCurrentTitle()
local page_name = mw.uri.encode( current_page.prefixedText, 'WIKI' );
local coord_link = '//tools.wmflabs.org/geohack/geohack.php?language=sa&pagename=' .. page_name .. '¶ms='
--[[ Helper function, replacement for {{coord/display/title}} ]]
local function displaytitle(s, notes)
local l = "[[भूगोलीयनिर्देशाङ्कप्रणाली|निर्देशाङ्कः]] : " .. s
local co = '<span id="coordinates">' .. l .. notes .. '</span>';
return '<span style="font-size: small;">' .. co .. '</span>';
Line ६८ ⟶ ७१:
local result = ""
for i,v in ipairs(errors) do
local errorHTML = '<strong class="error">
result = result .. errorHTML .. "<br />"
end
Line १०३ ⟶ १०६:
if uriComponents == "" then
-- RETURN error, should never be empty or nil
return "त्रुटिःप्राचलं रिक्तम् अस्ति।"
end
if args["name"] then
Line १०९ ⟶ ११२:
end
local geodmshtml = '<span class="geo-dms" title="
.. '<span class="latitude">' .. convert("sa",coordinateSpec["dms-lat"]) .. '</span> '
.. '<span class="longitude">' .. convert("sa",coordinateSpec["dms-long"]) .. '</span>'
.. '</span>'
Line ११८ ⟶ १२१:
if lat < 0 then
-- FIXME this breaks the pre-existing precision
geodeclat = tostring(coordinateSpec["dec-lat"]):sub(2) .. "°
else
geodeclat = (coordinateSpec["dec-lat"] or 0) .. "°
end
Line १२७ ⟶ १३०:
if long < 0 then
-- FIXME does not handle unicode minus
geodeclong = tostring(coordinateSpec["dec-long"]):sub(2) .. "°
else
geodeclong = (coordinateSpec["dec-long"] or 0) .. "°
end
local geodechtml = '<span class="geo-dec" title="
.. geodeclat .. ' '
.. geodeclong
Line १३८ ⟶ १४१:
local geonumhtml = '<span class="geo">'
.. convert("bh",coordinateSpec["dec-lat"]) .. '; '
.. convert("bh",coordinateSpec["dec-long"])
.. '</span>'
Line २५१ ⟶ २५४:
if strong then
if lat_d < 0 then
table.insert(errors, {source, "
end
if long_d < 0 then
table.insert(errors, {source, "
end
--[[
Line २६९ ⟶ २७२:
if lat_d > 90 then
table.insert(errors, {source, "
end
if lat_d < -90 then
table.insert(errors, {source, "
end
if lat_m >= 60 then
table.insert(errors, {source, "
end
if lat_m < 0 then
table.insert(errors, {source, "
end
if lat_s >= 60 then
table.insert(errors, {source, "
end
if lat_s < 0 then
table.insert(errors, {source, "
end
if long_d >= 360 then
table.insert(errors, {source, "
end
if long_d <= -360 then
table.insert(errors, {source, "
end
if long_m >= 60 then
table.insert(errors, {source, "
end
if long_m < 0 then
table.insert(errors, {source, "
end
if long_s >= 60 then
table.insert(errors, {source, "
end
if long_s < 0 then
table.insert(errors, {source, "
end
Line ३११ ⟶ ३१४:
parseDec
Transforms decimal format latitude and longitude into the a
structure to be used in displaying coordinates
]]
Line ३१९ ⟶ ३२२:
if not long then
return nil, {{"parseDec", "
elseif not tonumber(long) then
return nil, {{"parseDec", "
end
Line ३२९ ⟶ ३३२:
local mode = coordinates.determineMode( lat, long );
coordinateSpec["dms-lat"] = convert_dec2dms( lat, "
coordinateSpec["dms-long"] = convert_dec2dms( long, "
if format then
Line ३५६ ⟶ ३५९:
if lat_f == 'E' or lat_f == 'W' then
lat_d, long_d, lat_m, long_m, lat_s, long_s, lat_f, long_f, backward = long_d, lat_d, long_m, lat_m, long_s, lat_s, long_f, lat_f, true;
end
end ▼
errors = validate( lat_d, lat_m, lat_s, long_d, long_m, long_s, 'parseDMS', true );
if not long_d then
return nil, {{"parseDMS", "
elseif not tonumber(long_d) then
return nil, {{"parseDMS", "
end
Line ३७७ ⟶ ३८०:
end
end
local function bhoChars(enChar)
if enChar == "W" then
coordinateSpec["dms-lat"] = lat_d.."°"..optionalArg(lat_m,"′") .. optionalArg(lat_s,"″") .. lat_f▼
return " पश्चिमदिक्"
coordinateSpec["dms-long"] = long_d.."°"..optionalArg(long_m,"′") .. optionalArg(long_s,"″") .. long_f▼
elseif enChar == "N" then
return " उत्तरदिक्"
elseif enChar == "S" then
return " दक्षिणदिक्"
elseif enChar == "E" then
return " पूर्वदिक्"
end
▲ coordinateSpec["dms-lat"] = lat_d.."°"..optionalArg(lat_m,"′") .. optionalArg(lat_s,"″") .. bhoChars(lat_f)
▲ coordinateSpec["dms-long"] = long_d.."°"..optionalArg(long_m,"′") .. optionalArg(long_s,"″") .. bhoChars(long_f)
coordinateSpec["dec-lat"] = convert_dms2dec(lat_f, lat_d, lat_m, lat_s) -- {{coord/dms2dec|{{{4}}}|{{{1}}}|0{{{2}}}|0{{{3}}}}}
coordinateSpec["dec-long"] = convert_dms2dec(long_f, long_d, long_m, long_s) -- {{coord/dms2dec|{{{8}}}|{{{5}}}|0{{{6}}}|0{{{7}}}}}
Line ४१० ⟶ ४२३:
if not args[1] then
-- no lat logic
return errorPrinter( {{"formatTest", "
elseif not tonumber(args[1]) then
-- bad lat logic
return errorPrinter( {{"formatTest", "
elseif not args[4] and not args[5] and not args[6] then
-- dec logic
Line ४१९ ⟶ ४३२:
if not result then
return errorPrinter(errors);
end
-- formatting for geohack: geohack expects D_N_D_E notation or D;D notation
-- wikiminiatlas doesn't support D;D notation
Line ४३४ ⟶ ४४७:
args[5], args[6], args[7], args[8], args.format)
if args[10] then
table.insert(errors, {'formatTest', '
end
if not result then
Line ४४५ ⟶ ४५८:
args[4], args[5], nil, args[6], args['format'])
if args[8] then
table.insert(errors, {'formatTest', '
end
if not result then
Line ४५६ ⟶ ४६९:
args[3], nil, nil, args[4], args.format)
if args[6] then
table.insert(errors, {'formatTest', '
end
if not result then
Line ४६४ ⟶ ४७७:
else
-- Error
return errorPrinter({{"formatTest", "
end
result.name = args.name
Line ४७१ ⟶ ४८४:
for _, v in ipairs(extra_param) do
if args[v] then
table.insert(errors, {'formatTest', '
end
end
Line ४७७ ⟶ ४९०:
local ret = specPrinter(args, result)
if #errors > 0 then
ret = ret .. ' ' .. errorPrinter(errors) .. '[[
end
return ret, backward
Line ४९३ ⟶ ५०६:
if snaktype == 'value' then
-- coordinates exist both here and on Wikidata, and can be compared.
ret = 'निर्देशाङ्कः विकिडेटा-जाले उपलब्धः वर्तते'
elseif snaktype == 'somevalue' then
ret = 'निर्देशाङ्कः विकिडेटा-जाले अज्ञातः वर्तते'
elseif snaktype == 'novalue' then
ret = 'निर्देशाङ्कः विकिडेटा-जाले विना मूल्यं प्रस्थापितः वर्तते'
end
else
-- We have to either import the coordinates to Wikidata or remove them here.
ret = 'निर्देशाङ्कः विकिडेटा-जाले नोपलब्धः'
end
end
if ret then
return string.format('[[
else
return ''
Line ५६९ ⟶ ५८२:
Usage:
{{#invoke:Coordinates | dms2dec | direction_flag | degrees |
minutes | seconds }}
|