Module:Utilities: Difference between revisions

Jump to navigation Jump to search
Sur (talk | contribs)
m call_lang removed
Tag: Manual revert
Sur (talk | contribs)
m link parameter for get_image_file
Line 22: Line 22:
-- If the image exists exists, return it back enclosed in brackets, else return a blank string
-- If the image exists exists, return it back enclosed in brackets, else return a blank string
function p.get_image_file(image_file_name, px)
function p.get_image_file(image_file_name, px, link)
if (px == nil) then px = 15 end --default
if (px == nil) then px = 15 end --default
if (link == nil) then link = "" end --default
image_file = mw.title.new(image_file_name)
image_file = mw.title.new(image_file_name)
if image_file and image_file.exists then
if image_file and image_file.exists then
    image_file_name = "[[" .. image_file_name .. "|" .. px .. "px]]"
    image_file_name = "[[" .. image_file_name .. "|" .. px .. "px|link=" .. link .. "]]"
else
else
    image_file_name = ''
    image_file_name = ''