Module:Wide image and Module:Wide image/sandbox: Difference between pages
Appearance
(Difference between pages)
Content deleted Content added
Sohom Datta (talk | contribs) per tp |
No edit summary |
||
Line 79: | Line 79: | ||
function wideimage(image, width, height, caption, boxwidth, float, alt, border, capalign, dir) |
function wideimage(image, width, height, caption, boxwidth, float, alt, border, capalign, dir) |
||
if image then |
if not image then return '' end |
||
image = getfilename(image) |
|||
local imagewidth = getwidth(image, width or '0', height or '0') |
|||
⚫ | |||
if width == nil then |
|||
⚫ | |||
end |
|||
⚫ | |||
⚫ | |||
⚫ | |||
width = width .. 'px' |
|||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
if tonumber(width) then |
|||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
d:tag('div') |
|||
:addClass(cclass) |
|||
:css('overflow', 'auto') |
|||
:css('direction', rtl and 'rtl' or nil) |
|||
:wikitext(getimage(image,width,alt,caption or '',rtl)) |
|||
if caption then |
|||
d = d:tag('div') |
|||
:addClass('thumbcaption') |
|||
:css('text-align', capalign) |
|||
if noborder == nil then |
|||
d:tag('div') |
|||
:addClass('magnify') |
|||
:wikitext('[[:File:' .. image .. '| ]]') |
|||
end |
|||
⚫ | |||
end |
end |
||
⚫ | |||
return tostring(r) |
|||
end |
end |
||
return |
return tostring(r) |
||
end |
end |
||
function p.main(frame) |
function p.main(frame) |
||
local |
local args = require('Module:Arguments').getArgs(frame) |
||
local args = getArgs(frame) |
|||
return wideimage( |
return wideimage( |
||
args['image'] or args[1], |
args['image'] or args[1], |
||
args[2] or nil, -- width |
|||
args['height'] or nil, |
args['height'] or nil, |
||
args['caption'] or args[3], |
|||
args['width'] or args[4], |
args['width'] or args[4], |
||
args['align'] or args[5], |
|||
args['alt'], |
args['alt'], |
||
args['border'], |
|||
args['align-cap'], |
|||
args['dir'] |
|||
) |
|||
end |
end |
||