Changes

Jump to navigation Jump to search
122 bytes added ,  12:06, 14 April 2017
m
1 revision imported
Line 70: Line 70:  
local function getImageName(s)
 
local function getImageName(s)
 
-- Gets the image name for a given string.
 
-- Gets the image name for a given string.
 +
local default = 'Portal-puzzle.svg|link=|alt='
 
if type(s) ~= 'string' or #s < 1 then
 
if type(s) ~= 'string' or #s < 1 then
return 'Portal-puzzle.svg|link=|alt='
+
return default
 
end
 
end
 
s = mw.ustring.lower(s)
 
s = mw.ustring.lower(s)
return matchImagePage(s) or matchImagePage(getAlias(s)) or 'Portal-puzzle.svg|link=|alt='
+
return matchImagePage(s) or matchImagePage(getAlias(s)) or default
 
end
 
end
   Line 133: Line 134:     
function p._image(portals)
 
function p._image(portals)
   
-- Wrapper function to allow getImageName() to be accessed through #invoke.
 
-- Wrapper function to allow getImageName() to be accessed through #invoke.
return getImageName(portals[1])
+
local name = getImageName(portals[1])
 +
return name:match('^(.-)|') or name -- FIXME: use a more elegant way to separate borders etc. from the image name
 
end
 
end
  
Bureaucrats, private-view, public-view, Administrators
97,692

edits

Navigation menu