Module:Coordinates: திருத்தங்களுக்கு இடையிலான வேறுபாடு

உள்ளடக்கம் நீக்கப்பட்டது உள்ளடக்கம் சேர்க்கப்பட்டது
imported>Sukanthi
"--[[ This module is intended to replace the functionality of {{Coord}} and related templates. It provides several methods, including {{#invoke:Coordinates | coord }} : General function formatting and displaying coordinate values. {{#invoke:Coordinates | dec2dms }} : Simple function for converting decimal degree values to DMS format. {{#invoke:Coordinates | dms..."-இப்பெயரில் புதிய பக்கம் உருவாக்கப்பட்டுள்ளது
imported>Sukanthi
No edit summary
வரிசை 16:
]]
 
require('strictModule:No globals')
 
local math_mod = require("Module:Math")
local coordinates = {};
local isSandbox = mw.getCurrentFrame():getTitle():find('sandbox', 1, true);
 
local current_page = mw.title.getCurrentTitle()
local page_name = mw.uri.encode( current_page.prefixedText, 'WIKI' );
local coord_link = '//geohack.toolforge.org/geohack.php?pagename=' .. page_name .. '&params='
local templatestyles = 'Module:Coordinates/styles.css'
 
--[[ Helper function, replacement for {{coord/display/title}} ]]
local function displaytitle(s, notes)
local l = "[[Geographic coordinate system|Coordinates]]: " .. s
local coords = s .. notes;
local co = '<span id="coordinates">' .. l .. notes .. '</span>';
return '<span style="font-size: small;">' .. co .. '</span>';
end
 
--[[ Helper function, Replacement for {{coord/display/inline}} ]]
return '<!-- COORD INDICATOR START ' .. coords .. ' -->'
local function displayinline(s, notes)
.. mw.getCurrentFrame():extensionTag{
local coords =return s .. notes;
name = 'indicator',
args = { name = 'coordinates' },
content = '<span id="coordinates">[[புவியியல் ஆள்கூற்று முறை|ஆள்கூறுகள்]]: ' .. coords .. '</span>'
}
.. '<!-- COORD INDICATOR END -->'
end
 
வரி 70 ⟶ 69:
local result = ""
for i,v in ipairs(errors) do
resultlocal errorHTML = result .. '<strong class="error">Coordinates: ' .. v[2] .. '</strong><br />'
result = result .. errorHTML .. "<br />"
end
return result
வரிசை 157:
end
 
return mw.getCurrentFrame():extensionTag{ name = 'templatestyles', args = { src = templatestyles} }
local stylesheetLink = 'Module:Coordinates' .. ( isSandbox and '/sandbox' or '' ) .. '/styles.css'
} .. '<span class="plainlinks nourlexpansion">[' .. coord_link .. uriComponents ..
return mw.getCurrentFrame():extensionTag{
.. '[' .. coord_link .. uriComponents .. ' ' .. inner .. ']'
name = 'templatestyles', args = { src = stylesheetLink }
' ' .. inner .. ']</span>'
} .. '<span class="plainlinks nourlexpansion">[' .. coord_link .. uriComponents ..
' ' .. inner .. ']</span>'
end
 
வரி 634 ⟶ 633:
local Display = args.display and args.display:lower() or 'inline'
 
-- it and ti are short for inline,title and title,inline
local function isInline(s)
-- Finds whether coordinates are displayed inline.
வரி 651 ⟶ 649:
local text = ''
if isInline(Display) then
text = text .. displayinline(contents .., Notes)
end
if isInTitle(Display) then
text = text
text = text .. displaytitle(contents, Notes) .. makeWikidataCategories(args.qid)
.. displaytitle(contents, Notes)
text = text .. displaytitle(contents, Notes) .. makeWikidataCategories(args.qid)
end
if not args.nosave then
வரிசை 719:
]]
function coordinates.coordinsert(frame)
-- for the 2nd or later integer parameter (the first is the coord template, as above)
for i, v in ipairs(frame.args) do
if i ~= 1 then
-- if we cannot find in the coord_template the i_th coordinsert parameter e.g. region
if not mw.ustring.find(frame.args[1], (mw.ustring.match(frame.args[i], '^(.-:)') or '')) then
-- find from the params= up to the first possibly-present underscore
-- and append the i_th coordinsert parameter and a space
-- IDK why we're adding a space but it does seem somewhat convenient
frame.args[1] = mw.ustring.gsub(frame.args[1], '(params=.-)_? ', '%1_'..frame.args[i]..' ')
end
வரி 732 ⟶ 727:
end
if frame.args.name then
-- if we can't find the vcard class
if not mw.ustring.find(frame.args[1], '<span class="vcard">') then
-- take something that looks like a coord template and add the vcard span with class and fn org class
local namestr = frame.args.name
frame.args[1] = mw.ustring.gsub(frame.args[1],
frame.args[1],
'(<span class="geo%-default">)(<span[^<>]*>[^<>]*</span><span[^<>]*>[^<>]*<span[^<>]*>[^<>]*</span></span>)(</span>)',
'%1<span class="vcard">%2<span style="display:none">&#xfeff; (<span class="fn org">' .. namestr .. '</span>)</span></span>%3')
frame.args[1] = mw.ustring.gsub(frame.args[1], '(&params=[^&"<>%[%] ]*) ', '%1&title=' .. mw.uri.encode(namestr) .. ' ')
)
-- then find anything from coordinates parameters to the 'end' and attach the title parameter
frame.args[1] = mw.ustring.gsub(
frame.args[1],
'(&params=[^&"<>%[%] ]*) ',
'%1&title=' .. mw.uri.encode(namestr) .. ' '
)
end
end
-- find the in-source 'indicators' and then call displaytitle
mw.ustring.gsub(
frame.args[1],
'<!%-%- COORD INDICATOR START (.-) %-%->.-<!%-%- COORD INDICATOR END %-%->',
function (coords) return displaytitle(coords, '') end
)
 
return frame.args[1]
end
"https://tamilar.wiki/w/Module:Coordinates" இலிருந்து மீள்விக்கப்பட்டது