"पटलम्: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 .. '&params='
 
--[[ Helper function, replacement for {{coord/display/title}} ]]
local function displaytitle(s, notes)
local l = "[[भूगोलीयनिर्देशाङ्कप्रणाली|निर्देशाङ्कः]] : " .. s
local l = "[[Geographic coordinate system|Coordinates]]: " .. 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">Coordinatesनिर्देशाङ्कः: ' .. v[2] .. '</strong>'
result = result .. errorHTML .. "<br />"
end
Line १०३ ⟶ १०६:
if uriComponents == "" then
-- RETURN error, should never be empty or nil
return "त्रुटिःप्राचलं रिक्तम् अस्ति।"
return "ERROR param was empty"
end
if args["name"] then
Line १०९ ⟶ ११२:
end
local geodmshtml = '<span class="geo-dms" title="Maps,ऐतस्यै aerialअवस्थित्यै photosभूपटानि, andकाल्पनीकचित्राणि otherइत्यादयः दत्तांशाः (data for this location)">'
.. '<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) .. "°Sपश्चिमदिक्"
else
geodeclat = (coordinateSpec["dec-lat"] or 0) .. "°Nउत्तरदिक्"
end
 
Line १२७ ⟶ १३०:
if long < 0 then
-- FIXME does not handle unicode minus
geodeclong = tostring(coordinateSpec["dec-long"]):sub(2) .. "°Wपश्चिमदिक्"
else
geodeclong = (coordinateSpec["dec-long"] or 0) .. "°Eपूर्वदिक्"
end
local geodechtml = '<span class="geo-dec" title="Maps,एतस्यै aerialअवस्थित्यै photosभूपटानि, and other dataकाल्पनीकचित्राणि forइत्यादयः thisदत्तांशाः location(Data)">'
.. 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, "latitudeगोलार्धस्य degreesसूचनया <सह 0शून्यात् withअधिका hemisphere(<) flagअक्षांशस्तिथिः"})
end
if long_d < 0 then
table.insert(errors, {source, "longitudeगोलार्धस्य degreesसूचनया <सह 0शून्यात् withअधिका hemisphere(<) flagदेशान्तरस्थितिः"})
end
--[[
Line २६९ ⟶ २७२:
if lat_d > 90 then
table.insert(errors, {source, "latitude degreesअक्षांशस्थितिः > 90९०"})
end
if lat_d < -90 then
table.insert(errors, {source, "latitude degreesअक्षांशस्थितिः < -90९०"})
end
if lat_m >= 60 then
table.insert(errors, {source, "latitude minutesअक्षांशनिमेषाः >= 60६०"})
end
if lat_m < 0 then
table.insert(errors, {source, "latitude minutesअक्षांशनिमेषाः < 0"})
end
if lat_s >= 60 then
table.insert(errors, {source, "latitude secondsअक्षांशक्षणाः >= 60६०"})
end
if lat_s < 0 then
table.insert(errors, {source, "latitude secondsअक्षांशक्षणाः < 0"})
end
if long_d >= 360 then
table.insert(errors, {source, "longitude degreesदेशान्तरस्थितिः >= 360३६०"})
end
if long_d <= -360 then
table.insert(errors, {source, "longitude degreesदेशान्तरस्थितिः <= -360३६०"})
end
if long_m >= 60 then
table.insert(errors, {source, "longitude minutesदेशान्तरनिमेषाः >= 60६०"})
end
if long_m < 0 then
table.insert(errors, {source, "longitude minutesदेशान्तरनिमेषाः < 0"})
end
if long_s >= 60 then
table.insert(errors, {source, "longitude secondsदेशान्तरक्षणाः >= 60६०"})
end
if long_s < 0 then
table.insert(errors, {source, "longitude secondsदेशान्तरक्षणाः < 0"})
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", "Missingलुप्तः longitudeदेशान्तरः"}}
elseif not tonumber(long) then
return nil, {{"parseDec", "Longitudeदेशान्तरस्य couldसङ्ख्यारूपेण notप्रवेशः be(parse) parsed as a numberनाभवत्: " .. long}}
end
Line ३२९ ⟶ ३३२:
 
local mode = coordinates.determineMode( lat, long );
coordinateSpec["dms-lat"] = convert_dec2dms( lat, "Nउत्तरदिक्", "Sदक्षिणदिक्", mode) -- {{coord/dec2dms|{{{1}}}|N|S|{{coord/prec dec|{{{1}}}|{{{2}}}}}}}
coordinateSpec["dms-long"] = convert_dec2dms( long, "Eपूर्वदिक्", "Wपश्चिमदिक्", mode) -- {{coord/dec2dms|{{{2}}}|E|W|{{coord/prec dec|{{{1}}}|{{{2}}}}}}}
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", "Missingलुप्तः longitudeदेशान्तरः" }}
elseif not tonumber(long_d) then
return nil, {{"parseDMS", "Longitudeदेशान्तरस्य couldसङ्ख्यारूपेण notप्रेवशः beनाभवत् parsed as a number:" .. long_d }}
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
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", "Missingलुप्तः latitudeअक्षांशः"}} )
elseif not tonumber(args[1]) then
-- bad lat logic
return errorPrinter( {{"formatTest", "Unableअक्षांशस्य toसङ्ख्यारूपेण parseप्रवेशः latitudeनाभवत् as a number:" .. args[1]}} )
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', 'Extraअतिरिक्तानि unexpectedअवाञ्छितानि parametersप्राचलानि'})
end
if not result then
Line ४४५ ⟶ ४५८:
args[4], args[5], nil, args[6], args['format'])
if args[8] then
table.insert(errors, {'formatTest', 'Extraअतिरिक्तानि unexpectedअवाच्छितानि parametersप्राचलानि'})
end
if not result then
Line ४५६ ⟶ ४६९:
args[3], nil, nil, args[4], args.format)
if args[6] then
table.insert(errors, {'formatTest', 'Extraअतिरिक्तानि unexpectedअवाच्छितानि parametersप्राचलानि'})
end
if not result then
Line ४६४ ⟶ ४७७:
else
-- Error
return errorPrinter({{"formatTest", "Unknownअज्ञातं argument formatप्रविष्टिप्रारूपम्"}})
end
result.name = args.name
Line ४७१ ⟶ ४८४:
for _, v in ipairs(extra_param) do
if args[v] then
table.insert(errors, {'formatTest', 'Parameterप्राचलम्: "' .. v .. '=" should beआवश्यकम् "' .. v .. ':"' })
end
end
Line ४७७ ⟶ ४९०:
local ret = specPrinter(args, result)
if #errors > 0 then
ret = ret .. ' ' .. errorPrinter(errors) .. '[[Categoryवर्गः:Pagesअयोग्यैः withनिर्देशाङ्कैः malformedयुक्तानि coordinateसर्वाणि tagsपृष्ठानि]]'
end
return ret, backward
Line ४९३ ⟶ ५०६:
if snaktype == 'value' then
-- coordinates exist both here and on Wikidata, and can be compared.
ret = 'निर्देशाङ्कः विकिडेटा-जाले उपलब्धः वर्तते'
ret = 'Coordinates on Wikidata'
elseif snaktype == 'somevalue' then
ret = 'निर्देशाङ्कः विकिडेटा-जाले अज्ञातः वर्तते'
ret = 'Coordinates on Wikidata set to unknown value'
elseif snaktype == 'novalue' then
ret = 'निर्देशाङ्कः विकिडेटा-जाले विना मूल्यं प्रस्थापितः वर्तते'
ret = 'Coordinates on Wikidata set to no value'
end
else
-- We have to either import the coordinates to Wikidata or remove them here.
ret = 'निर्देशाङ्कः विकिडेटा-जाले नोपलब्धः'
ret = 'Coordinates not on Wikidata'
end
end
if ret then
return string.format('[[Categoryवर्गः:%s]]', ret)
else
return ''
Line ५६९ ⟶ ५८२:
 
Usage:
{{#invoke:Coordinates | dms2dec | direction_flag | degrees |
minutes | seconds }}
"https://sa.wikipedia.org/wiki/पटलम्:Coordinates" इत्यस्माद् प्रतिप्राप्तम्