Modulo:InfoboxImage: Malsamoj inter versioj

[kontrolita revizio][kontrolita revizio]
Enhavo forigita Enhavo aldonita
e korekto
aldono laŭ la modula provejo
Linio 1:
-- Inputs:
-- image - Can either be a bare filename (with or without the File:/Image: prefix) or a fully formatted image link
-- ending - An optional parameter for the file ending, like gif, jpg, jpeg, png, svg.
-- def_ending - An optional parameter for the default ending.
-- size - size to display the image
Linio 78:
end
 
function i.add_endingValidateEnding (image, ending, def_endingf)
-- analyzes the validate endings for images in the Wikipedia.
-- according to http://commons.wikimedia.org/wiki/Commons:File_types,
-- but not tiff, because browser can have some problems with this format
-- xcf works only in MediaWiki
if f == "gif" or f == "jpg" or f == "jpeg" or f == "png" or f == "svg" then
return true
else return false
end
end
 
function i.AddEnding (image, ending, def_ending)
-- analyzes, if an ending already exists in the image
local f = image:gsub("^(.*)%.","")
f = mw.ustring.lower(f) -- it changes letters into lower case letters
if i.ValidateEnding(f) == true then
return image -- if yes, it returns the image name without change
end
-- add an ending to the image name
if ending ~="" and ending ~=nil then
imageif i.ValidateEnding(ending) == imagetrue ..then "." .. ending
image = image .. "." .. ending
end
elseif def_ending ~="" and def_ending ~=nil then
imageif i.ValidateEnding(def_ending) == imagetrue ..then "." .. def_ending
image = image .. "." .. def_ending
end
end
return image
Linio 177 ⟶ 198:
size = size .. "px";
end
image = i.add_endingAddEnding (image,ending,def_ending)
result = "[[File:" .. image;