https://en.wikipedia.org/w/index.php?action=history&feed=atom&title=Module%3ASandbox%2FFavonide
Module:Sandbox/Favonide - Revision history
2025-06-01T04:45:14Z
Revision history for this page on the wiki
MediaWiki 1.45.0-wmf.3
https://en.wikipedia.org/w/index.php?title=Module:Sandbox/Favonide&diff=1282774576&oldid=prev
Favonide: +
2025-03-28T14:50:27Z
<p>+</p>
<a href="//en.wikipedia.org/w/index.php?title=Module:Sandbox/Favonide&diff=1282774576&oldid=1282773996">Show changes</a>
Favonide
https://en.wikipedia.org/w/index.php?title=Module:Sandbox/Favonide&diff=1282773996&oldid=prev
Favonide: ←Created page with 'require('strict') 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 = 'https://geohack.toolforge.org/geohack.php?pagename=' .. page_name .. '¶ms=' local function displaytitle(coords) return mw.getCurrentFrame():extensionTag{ n...'
2025-03-28T14:45:07Z
<p><a href="/wiki/Wikipedia:AES" class="mw-redirect" title="Wikipedia:AES">←</a>Created page with 'require('strict') 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 = 'https://geohack.toolforge.org/geohack.php?pagename=' .. page_name .. '&params=' local function displaytitle(coords) return mw.getCurrentFrame():extensionTag{ n...'</p>
<p><b>New page</b></p><div>require('strict')<br />
<br />
local math_mod = require("Module:Math")<br />
local coordinates = {};<br />
local isSandbox = mw.getCurrentFrame():getTitle():find('sandbox', 1, true);<br />
<br />
local current_page = mw.title.getCurrentTitle()<br />
local page_name = mw.uri.encode( current_page.prefixedText, 'WIKI' );<br />
local coord_link = 'https://geohack.toolforge.org/geohack.php?pagename=' .. page_name .. '&params='<br />
<br />
local function displaytitle(coords)<br />
return mw.getCurrentFrame():extensionTag{<br />
name = 'indicator',<br />
args = { name = 'coordinates' },<br />
content = '<span id="coordinates">[[Geographic coordinate system|Coordinates]]: ' .. coords .. '</span>'<br />
}<br />
end<br />
<br />
local function dmsTest(first, second)<br />
if type(first) ~= 'string' or type(second) ~= 'string' then<br />
return nil<br />
end<br />
local s = (first .. second):upper()<br />
return s:find('^[NS][EW]$') or s:find('^[EW][NS]$')<br />
end<br />
<br />
<br />
local function makeInvokeFunc(funcName)<br />
return function (frame)<br />
local args = require('Module:Arguments').getArgs(frame, {<br />
wrappers = 'Template:Coord'<br />
})<br />
return coordinates[funcName](args, frame)<br />
end<br />
end<br />
<br />
local function optionalArg(arg, supplement)<br />
return arg and arg .. supplement or ''<br />
end<br />
<br />
local function errorPrinter(errors)<br />
local result = ""<br />
for i,v in ipairs(errors) do<br />
result = result .. '<strong class="error">Coordinates: ' .. v[2] .. '</strong><br />'<br />
end<br />
return result<br />
end<br />
<br />
local function displayDefault(default, mode)<br />
if default == "" then<br />
default = "dec"<br />
end<br />
<br />
if default == mode then<br />
return "geo-default"<br />
else<br />
return "geo-nondefault"<br />
end<br />
end<br />
<br />
local function specPrinter(args, coordinateSpec)<br />
local uriComponents = coordinateSpec["param"]<br />
if uriComponents == "" then<br />
return "ERROR param was empty"<br />
end<br />
if args["name"] then<br />
uriComponents = uriComponents .. "&title=" .. mw.uri.encode(coordinateSpec["name"])<br />
end<br />
<br />
local geodmshtml = '<span class="geo-dms" title="Maps, aerial photos, and other data for this location">'<br />
.. '<span class="latitude">' .. coordinateSpec["dms-lat"] .. '</span> '<br />
.. '<span class="longitude">' ..coordinateSpec["dms-long"] .. '</span>'<br />
.. '</span>'<br />
<br />
local lat = tonumber( coordinateSpec["dec-lat"] ) or 0<br />
local geodeclat<br />
if lat < 0 then<br />
-- FIXME this breaks the pre-existing precision<br />
geodeclat = tostring(coordinateSpec["dec-lat"]):sub(2) .. "°S"<br />
else<br />
geodeclat = (coordinateSpec["dec-lat"] or 0) .. "°N"<br />
end<br />
<br />
local long = tonumber( coordinateSpec["dec-long"] ) or 0<br />
local geodeclong<br />
if long < 0 then<br />
-- FIXME does not handle unicode minus<br />
geodeclong = tostring(coordinateSpec["dec-long"]):sub(2) .. "°W"<br />
else<br />
geodeclong = (coordinateSpec["dec-long"] or 0) .. "°E"<br />
end<br />
<br />
local geodechtml = '<span class="geo-dec" title="Maps, aerial photos, and other data for this location">'<br />
.. geodeclat .. ' '<br />
.. geodeclong<br />
.. '</span>'<br />
<br />
local geonumhtml = '<span class="geo">'<br />
.. coordinateSpec["dec-lat"] .. '; '<br />
.. coordinateSpec["dec-long"]<br />
.. '</span>'<br />
<br />
local inner = '<span class="' .. displayDefault(coordinateSpec["default"], "dms" ) .. '">' .. geodmshtml .. '</span>'<br />
.. '<span class="geo-multi-punct">&#xfeff; / &#xfeff;</span>'<br />
.. '<span class="' .. displayDefault(coordinateSpec["default"], "dec" ) .. '">';<br />
<br />
if not args["name"] then<br />
inner = inner .. geodechtml<br />
.. '<span style="display:none">&#xfeff; / ' .. geonumhtml .. '</span></span>'<br />
else<br />
inner = inner .. '<span class="vcard">' .. geodechtml<br />
.. '<span style="display:none">&#xfeff; / ' .. geonumhtml .. '</span>'<br />
.. '<span style="display:none">&#xfeff; (<span class="fn org">'<br />
.. args["name"] .. '</span>)</span></span></span>'<br />
end<br />
<br />
local stylesheetLink = 'Module:Coordinates' .. ( isSandbox and '/sandbox' or '' ) .. '/styles.css'<br />
return mw.getCurrentFrame():extensionTag{<br />
name = 'templatestyles', args = { src = stylesheetLink }<br />
} .. '<span class="plainlinks nourlexpansion">[' .. coord_link .. uriComponents ..<br />
' ' .. inner .. ']</span>' .. '[[Category:Pages using gadget WikiMiniAtlas]]'<br />
end<br />
<br />
local function convert_dec2dms_d(coordinate)<br />
local d = math_mod._round( coordinate, 0 ) .. "°"<br />
return d .. ""<br />
end<br />
<br />
local function convert_dec2dms_dm(coordinate)<br />
coordinate = math_mod._round( coordinate * 60, 0 );<br />
local m = coordinate % 60;<br />
coordinate = math.floor( (coordinate - m) / 60 );<br />
local d = coordinate % 360 .."°"<br />
<br />
return d .. string.format( "%02d′", m )<br />
end<br />
<br />
local function convert_dec2dms_dms(coordinate)<br />
coordinate = math_mod._round( coordinate * 60 * 60, 0 );<br />
local s = coordinate % 60<br />
coordinate = math.floor( (coordinate - s) / 60 );<br />
local m = coordinate % 60<br />
coordinate = math.floor( (coordinate - m) / 60 );<br />
local d = coordinate % 360 .."°"<br />
<br />
return d .. string.format( "%02d′", m ) .. string.format( "%02d″", s )<br />
end<br />
<br />
local function convert_dec2dms(coordinate, firstPostfix, secondPostfix, precision)<br />
local coord = tonumber(coordinate)<br />
local postfix<br />
if coord >= 0 then<br />
postfix = firstPostfix<br />
else<br />
postfix = secondPostfix<br />
end<br />
<br />
precision = precision:lower();<br />
if precision == "dms" then<br />
return convert_dec2dms_dms( math.abs( coord ) ) .. postfix;<br />
elseif precision == "dm" then<br />
return convert_dec2dms_dm( math.abs( coord ) ) .. postfix;<br />
elseif precision == "d" then<br />
return convert_dec2dms_d( math.abs( coord ) ) .. postfix;<br />
end<br />
end<br />
<br />
local function convert_dms2dec(direction, degrees_str, minutes_str, seconds_str)<br />
local degrees = tonumber(degrees_str)<br />
local minutes = tonumber(minutes_str) or 0<br />
local seconds = tonumber(seconds_str) or 0<br />
<br />
local factor = 1<br />
if direction == "S" or direction == "W" then<br />
factor = -1<br />
end<br />
<br />
local precision = 0<br />
if seconds_str then<br />
precision = 5 + math.max( math_mod._precision(seconds_str), 0 );<br />
elseif minutes_str and minutes_str ~= '' then<br />
precision = 3 + math.max( math_mod._precision(minutes_str), 0 );<br />
else<br />
precision = math.max( math_mod._precision(degrees_str), 0 );<br />
end<br />
<br />
local decimal = factor * (degrees+(minutes+seconds/60)/60)<br />
return string.format( "%." .. precision .. "f", decimal ) -- not tonumber since this whole thing is string based.<br />
end<br />
<br />
local function validate( lat_d, lat_m, lat_s, long_d, long_m, long_s, source, strong )<br />
local errors = {};<br />
lat_d = tonumber( lat_d ) or 0;<br />
lat_m = tonumber( lat_m ) or 0;<br />
lat_s = tonumber( lat_s ) or 0;<br />
long_d = tonumber( long_d ) or 0;<br />
long_m = tonumber( long_m ) or 0;<br />
long_s = tonumber( long_s ) or 0;<br />
<br />
if strong then<br />
if lat_d < 0 then<br />
table.insert(errors, {source, "latitude degrees < 0 with hemisphere flag"})<br />
end<br />
if long_d < 0 then<br />
table.insert(errors, {source, "longitude degrees < 0 with hemisphere flag"})<br />
end<br />
end<br />
<br />
if lat_d > 90 then<br />
table.insert(errors, {source, "latitude degrees > 90"})<br />
end<br />
if lat_d < -90 then<br />
table.insert(errors, {source, "latitude degrees < -90"})<br />
end<br />
if lat_m >= 60 then<br />
table.insert(errors, {source, "latitude minutes >= 60"})<br />
end<br />
if lat_m < 0 then<br />
table.insert(errors, {source, "latitude minutes < 0"})<br />
end<br />
if lat_s >= 60 then<br />
table.insert(errors, {source, "latitude seconds >= 60"})<br />
end<br />
if lat_s < 0 then<br />
table.insert(errors, {source, "latitude seconds < 0"})<br />
end<br />
if long_d >= 360 then<br />
table.insert(errors, {source, "longitude degrees >= 360"})<br />
end<br />
if long_d <= -360 then<br />
table.insert(errors, {source, "longitude degrees <= -360"})<br />
end<br />
if long_m >= 60 then<br />
table.insert(errors, {source, "longitude minutes >= 60"})<br />
end<br />
if long_m < 0 then<br />
table.insert(errors, {source, "longitude minutes < 0"})<br />
end<br />
if long_s >= 60 then<br />
table.insert(errors, {source, "longitude seconds >= 60"})<br />
end<br />
if long_s < 0 then<br />
table.insert(errors, {source, "longitude seconds < 0"})<br />
end<br />
<br />
return errors;<br />
end<br />
<br />
local function parseDec( lat, long, format )<br />
local coordinateSpec = {}<br />
local errors = {}<br />
<br />
if not long then<br />
return nil, {{"parseDec", "Missing longitude"}}<br />
elseif not tonumber(long) then<br />
return nil, {{"parseDec", "Longitude could not be parsed as a number: " .. long}}<br />
end<br />
<br />
errors = validate( lat, nil, nil, long, nil, nil, 'parseDec', false );<br />
coordinateSpec["dec-lat"] = lat;<br />
coordinateSpec["dec-long"] = long;<br />
<br />
local mode = coordinates.determineMode( lat, long );<br />
coordinateSpec["dms-lat"] = convert_dec2dms( lat, "N", "S", mode)<br />
coordinateSpec["dms-long"] = convert_dec2dms( long, "E", "W", mode)<br />
<br />
if format then<br />
coordinateSpec.default = format<br />
else<br />
coordinateSpec.default = "dec"<br />
end<br />
<br />
return coordinateSpec, errors<br />
end<br />
<br />
local function parseDMS( lat_d, lat_m, lat_s, lat_f, long_d, long_m, long_s, long_f, format )<br />
local coordinateSpec, errors, backward = {}, {}<br />
<br />
lat_f = lat_f:upper();<br />
long_f = long_f:upper();<br />
<br />
if lat_f == 'E' or lat_f == 'W' then<br />
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;<br />
end<br />
<br />
errors = validate( lat_d, lat_m, lat_s, long_d, long_m, long_s, 'parseDMS', true );<br />
if not long_d then<br />
return nil, {{"parseDMS", "Missing longitude" }}<br />
elseif not tonumber(long_d) then<br />
return nil, {{"parseDMS", "Longitude could not be parsed as a number:" .. long_d }}<br />
end<br />
<br />
if not lat_m and not lat_s and not long_m and not long_s and #errors == 0 then<br />
if math_mod._precision( lat_d ) > 0 or math_mod._precision( long_d ) > 0 then<br />
if lat_f:upper() == 'S' then<br />
lat_d = '-' .. lat_d;<br />
end<br />
if long_f:upper() == 'W' then<br />
long_d = '-' .. long_d;<br />
end<br />
<br />
return parseDec( lat_d, long_d, format );<br />
end<br />
end<br />
<br />
coordinateSpec["dms-lat"] = lat_d.."°"..optionalArg(lat_m,"′") .. optionalArg(lat_s,"″") .. lat_f<br />
coordinateSpec["dms-long"] = long_d.."°"..optionalArg(long_m,"′") .. optionalArg(long_s,"″") .. long_f<br />
coordinateSpec["dec-lat"] = convert_dms2dec(lat_f, lat_d, lat_m, lat_s) -- {{coord/dms2dec|{{{4}}}|{{{1}}}|0{{{2}}}|0{{{3}}}}}<br />
coordinateSpec["dec-long"] = convert_dms2dec(long_f, long_d, long_m, long_s) -- {{coord/dms2dec|{{{8}}}|{{{5}}}|0{{{6}}}|0{{{7}}}}}<br />
<br />
if format then<br />
coordinateSpec.default = format<br />
else<br />
coordinateSpec.default = "dms"<br />
end<br />
<br />
return coordinateSpec, errors, backward<br />
end<br />
<br />
local function formatTest(args)<br />
local result, errors<br />
local backward, primary = false, false<br />
<br />
local function getParam(args, lim)<br />
local ret = {}<br />
for i = 1, lim do<br />
ret[i] = args[i] or ''<br />
end<br />
return table.concat(ret, '_')<br />
end<br />
<br />
if not args[1] then<br />
return errorPrinter( {{"formatTest", "Missing latitude"}} )<br />
elseif not tonumber(args[1]) then<br />
return errorPrinter( {{"formatTest", "Unable to parse latitude as a number:" .. args[1]}} )<br />
elseif not args[4] and not args[5] and not args[6] then<br />
result, errors = parseDec(args[1], args[2], args.format)<br />
if not result then<br />
return errorPrinter(errors);<br />
end<br />
result.param = table.concat({<br />
math.abs(tonumber(args[1])),<br />
((tonumber(args[1]) or 0) < 0) and 'S' or 'N',<br />
math.abs(tonumber(args[2])),<br />
((tonumber(args[2]) or 0) < 0) and 'W' or 'E',<br />
args[3] or ''}, '_')<br />
elseif dmsTest(args[4], args[8]) then<br />
result, errors, backward = parseDMS(args[1], args[2], args[3], args[4],<br />
args[5], args[6], args[7], args[8], args.format)<br />
if args[10] then<br />
table.insert(errors, {'formatTest', 'Extra unexpected parameters'})<br />
end<br />
if not result then<br />
return errorPrinter(errors)<br />
end<br />
result.param = getParam(args, 9)<br />
elseif dmsTest(args[3], args[6]) then<br />
result, errors, backward = parseDMS(args[1], args[2], nil, args[3],<br />
args[4], args[5], nil, args[6], args['format'])<br />
if args[8] then<br />
table.insert(errors, {'formatTest', 'Extra unexpected parameters'})<br />
end<br />
if not result then<br />
return errorPrinter(errors)<br />
end<br />
result.param = getParam(args, 7)<br />
elseif dmsTest(args[2], args[4]) then<br />
result, errors, backward = parseDMS(args[1], nil, nil, args[2],<br />
args[3], nil, nil, args[4], args.format)<br />
if args[6] then<br />
table.insert(errors, {'formatTest', 'Extra unexpected parameters'})<br />
end<br />
if not result then<br />
return errorPrinter(errors)<br />
end<br />
result.param = getParam(args, 5)<br />
else<br />
return errorPrinter({{"formatTest", "Unknown argument format"}}) .. '[[Category:Pages with malformed coordinate tags]]'<br />
end<br />
result.name = args.name<br />
<br />
local extra_param = {'dim', 'globe', 'scale', 'region', 'source', 'type'}<br />
for _, v in ipairs(extra_param) do<br />
if args[v] then<br />
table.insert(errors, {'formatTest', 'Parameter: "' .. v .. '=" should be "' .. v .. ':"' })<br />
end<br />
end<br />
<br />
local ret = specPrinter(args, result)<br />
if #errors > 0 then<br />
ret = ret .. ' ' .. errorPrinter(errors) .. '[[Category:Pages with malformed coordinate tags]]'<br />
end<br />
return ret, backward<br />
end<br />
<br />
local function makeWikidataCategories(qid)<br />
local ret<br />
local qid = qid or mw.wikibase.getEntityIdForCurrentPage()<br />
if mw.wikibase and current_page.namespace == 0 then<br />
if qid and mw.wikibase.entityExists(qid) and mw.wikibase.getBestStatements(qid, "P625") and mw.wikibase.getBestStatements(qid, "P625")[1] then<br />
local snaktype = mw.wikibase.getBestStatements(qid, "P625")[1].mainsnak.snaktype<br />
if snaktype == 'value' then<br />
ret = 'Coordinates on Wikidata'<br />
elseif snaktype == 'somevalue' then<br />
ret = 'Coordinates on Wikidata set to unknown value'<br />
elseif snaktype == 'novalue' then<br />
ret = 'Coordinates on Wikidata set to no value'<br />
end<br />
else<br />
ret = 'Coordinates not on Wikidata'<br />
end<br />
end<br />
if ret then<br />
return string.format('[[Category:%s]]', ret)<br />
else<br />
return ''<br />
end<br />
end<br />
<br />
function coordinates.link(frame)<br />
return coord_link;<br />
end<br />
<br />
coordinates.dec2dms = makeInvokeFunc('_dec2dms')<br />
function coordinates._dec2dms(args)<br />
local coordinate = args[1]<br />
local firstPostfix = args[2] or ''<br />
local secondPostfix = args[3] or ''<br />
local precision = args[4] or ''<br />
<br />
return convert_dec2dms(coordinate, firstPostfix, secondPostfix, precision)<br />
end<br />
<br />
function coordinates.determineMode( value1, value2 )<br />
local precision = math.max( math_mod._precision( value1 ), math_mod._precision( value2 ) );<br />
if precision <= 0 then<br />
return 'd'<br />
elseif precision <= 2 then<br />
return 'dm';<br />
else<br />
return 'dms';<br />
end<br />
end<br />
<br />
coordinates.dms2dec = makeInvokeFunc('_dms2dec')<br />
function coordinates._dms2dec(args)<br />
local direction = args[1]<br />
local degrees = args[2]<br />
local minutes = args[3]<br />
local seconds = args[4]<br />
<br />
return convert_dms2dec(direction, degrees, minutes, seconds)<br />
end<br />
<br />
coordinates.coord = makeInvokeFunc('_coord')<br />
function coordinates._coord(args)<br />
if not tonumber(args[1]) and not args[2] then<br />
args[3] = args[1]; args[1] = nil<br />
local entity = mw.wikibase.getEntityObject(args.qid)<br />
if entity<br />
and entity.claims<br />
and entity.claims.P625<br />
and entity.claims.P625[1].mainsnak.snaktype == 'value'<br />
then<br />
local precision = entity.claims.P625[1].mainsnak.datavalue.value.precision<br />
args[1] = entity.claims.P625[1].mainsnak.datavalue.value.latitude<br />
args[2] = entity.claims.P625[1].mainsnak.datavalue.value.longitude<br />
if precision then<br />
precision = -math_mod._round(math.log(precision)/math.log(10),0)<br />
args[1] = math_mod._round(args[1],precision)<br />
args[2] = math_mod._round(args[2],precision)<br />
end<br />
end<br />
end<br />
<br />
local contents, backward = formatTest(args)<br />
local Notes = args.notes or ''<br />
local Display = args.display and args.display:lower() or 'inline'<br />
<br />
local function isInline(s)<br />
return s:find('inline') ~= nil or s == 'i' or s == 'it' or s == 'ti'<br />
end<br />
local function isInTitle(s)<br />
return s:find('title') ~= nil or s == 't' or s == 'it' or s == 'ti'<br />
end<br />
<br />
local function coord_wrapper(in_args)<br />
return mw.getCurrentFrame():callParserFunction('#coordinates', in_args) or ''<br />
end<br />
<br />
local text = ''<br />
if isInline(Display) then<br />
text = text .. '<span class="geo-inline">' .. contents .. Notes .. '</span>'<br />
end<br />
if isInTitle(Display) then<br />
if not isInline(Display) then<br />
text = text .. '<span class="geo-inline-hidden noexcerpt">' .. contents .. Notes .. '</span>'<br />
end<br />
text = text .. displaytitle(contents .. Notes) .. makeWikidataCategories(args.qid)<br />
end<br />
if not args.nosave then<br />
local page_title, count = mw.title.getCurrentTitle(), 1<br />
if backward then<br />
local tmp = {}<br />
while not string.find((args[count-1] or ''), '[EW]') do tmp[count] = (args[count] or ''); count = count+1 end<br />
tmp.count = count; count = 2*(count-1)<br />
while count >= tmp.count do table.insert(tmp, 1, (args[count] or '')); count = count-1 end<br />
for i, v in ipairs(tmp) do args[i] = v end<br />
else<br />
while count <= 9 do args[count] = (args[count] or ''); count = count+1 end<br />
end<br />
if isInTitle(Display) and not page_title.isTalkPage and page_title.subpageText ~= 'doc' and page_title.subpageText ~= 'testcases' then args[10] = 'primary' end<br />
args.notes, args.format, args.display = nil<br />
text = text .. coord_wrapper(args)<br />
end<br />
return text<br />
end<br />
<br />
function coordinates._coord2text(coord,type)<br />
if coord == '' or type == '' or not type then return nil end<br />
type = mw.text.trim(type)<br />
if type == 'lat' or type == 'long' then<br />
local result, negative = mw.text.split((mw.ustring.match(coord,'[%.%d]+°[NS] [%.%d]+°[EW]') or ''), ' ')<br />
if type == 'lat' then<br />
result, negative = result[1], 'S'<br />
else<br />
result, negative = result[2], 'W'<br />
end<br />
result = mw.text.split(result, '°')<br />
if result[2] == negative then result[1] = '-'..result[1] end<br />
return result[1]<br />
else<br />
return mw.ustring.match(coord, 'params=.-_' .. type .. ':(.-)[ _]')<br />
end<br />
end<br />
<br />
function coordinates.coord2text(frame)<br />
return coordinates._coord2text(frame.args[1],frame.args[2])<br />
end<br />
<br />
function coordinates.coordinsert(frame)<br />
for i, v in ipairs(frame.args) do<br />
if i ~= 1 then<br />
if not mw.ustring.find(frame.args[1], (mw.ustring.match(frame.args[i], '^(.-:)') or '')) then<br />
frame.args[1] = mw.ustring.gsub(frame.args[1], '(params=.-)_? ', '%1_'..frame.args[i]..' ')<br />
end<br />
end<br />
end<br />
if frame.args.name then<br />
if not mw.ustring.find(frame.args[1], '<span class="vcard">') then<br />
local namestr = frame.args.name<br />
frame.args[1] = mw.ustring.gsub(<br />
frame.args[1],<br />
'(<span class="geo%-default">)(<span[^<>]*>[^<>]*</span><span[^<>]*>[^<>]*<span[^<>]*>[^<>]*</span></span>)(</span>)',<br />
'%1<span class="vcard">%2<span style="display:none">&#xfeff; (<span class="fn org">' .. namestr .. '</span>)</span></span>%3'<br />
)<br />
frame.args[1] = mw.ustring.gsub(<br />
frame.args[1],<br />
'(&params=[^&"<>%[%] ]*) ',<br />
'%1&title=' .. mw.uri.encode(namestr) .. ' '<br />
)<br />
end<br />
end<br />
<br />
frame.args[1] = mw.ustring.gsub(<br />
frame.args[1],<br />
'(<span class="geo%-inline[^"]*">(.+)</span>)\127[^\127]*UNIQ%-%-indicator%-%x+%-%-?QINU[^\127]*\127',<br />
function (inline, coord) return inline .. displaytitle(coord) end<br />
)<br />
<br />
return frame.args[1]<br />
end<br />
<br />
return coordinates</div>
Favonide