پودمان:Multiple image: تفاوت میان نسخهها
محتوای حذفشده محتوای افزودهشده
بدون خلاصۀ ویرایش |
بدون خلاصۀ ویرایش برچسبها: واگردانی دستی برگرداندهشده |
||
خط ۱۰:
local function isnotempty(s)
return s and s:match( '^%s*(.-)%s*$' ) ~= ''
end
سطر ۲۹ ⟵ ۲۵:
end
local function renderImageCell(image, width, height, link, alt, thumbtime, caption, textalign, istyle
local root = mw.html.create('')
سطر ۳۷ ⟵ ۳۳:
local thumbtimestr = ''
if isnotempty( thumbtime ) then
thumbtimestr = '|thumbtime=' .. thumbtime
سطر ۴۵ ⟵ ۳۸:
local imagediv = root:tag('div')
imagediv:addClass(
imagediv:cssText(istyle)
if( height ) then
سطر ۵۴ ⟵ ۴۷:
if isnotempty(caption) then
local captiondiv = root:tag('div')
captiondiv:addClass(
if isnotempty(textalign) then
captiondiv:addClass('text-align-' .. textalign)
سطر ۹۹ ⟵ ۹۲:
local pargs = frame:getParent().args
local args = frame.args
local width =
local dir = pargs['direction'] or ''
local border = pargs['border'] or args['border'] or ''
local align = pargs['align'] or args['align'] or (border == 'infobox' and 'center' or '')
local capalign = pargs['caption_align'] or args['caption_align'] or ''
local totalwidth =
local imgstyle = pargs['image_style'] or args['image_style']
local header = pargs['header'] or pargs['title'] or ''
سطر ۱۳۳ ⟵ ۱۲۶:
-- create an array with the number of images per row
perrow = getPerRow(dir == 'vertical' and '1' or convert('en', pargs['perrow']), imagecount)
-- compute the number of rows
سطر ۱۵۳ ⟵ ۱۴۶:
widths[k], heights[k] = getdimensions(pargs['image' .. i], pargs['width' .. i], pargs['height' .. i])
else
widths[k] = getWidth(width, convert('en', pargs['width' .. i]))
end
widthsum[r] = widthsum[r] + widths[k]
سطر ۲۳۵ ⟵ ۲۲۸:
local div = root:tag('div')
div:addClass(
div:css('width', tostring(bodywidth) .. 'px')
:css('max-width', tostring(bodywidth) .. 'px')
سطر ۲۵۰ ⟵ ۲۴۳:
:tag('div')
:addClass('theader')
:css('text-align', pargs['header_align'] or 'center')
:css('background-color', pargs['header_background'] or 'transparent')
:wikitext(header)
end
سطر ۲۷۶ ⟵ ۲۶۹:
imagediv:wikitext(renderImageCell(img, w, heights[k],
pargs['link' .. i], pargs['alt' .. i],
pargs['thumbtime' .. i], pargs['caption' .. i], capalign, imgstyle
end
end
سطر ۲۸۲ ⟵ ۲۷۵:
-- add the footer
if( isnotempty(footer) ) then
div:tag('div')
:addClass('trow')
:tag('div')
:addClass(
:css('text-align',
:css('background-color', pargs['footer_background'] or 'transparent')
:wikitext(footer)
end
سطر ۳۰۴ ⟵ ۲۹۴:
return frame:extensionTag {name = 'templatestyles', args = {src = 'Multiple image/styles.css', wrapper = ".tmulti"}}
.. renderMultipleImages( frame )
.. (autoscaledimages and '[[رده:صفحههایی که از تصویر چندگانه با مقیاس خودکار استفاده میکنند]]' or '')
.. (nonautoscaledimages and '[[رده:صفحههایی که از تصویر چندگانه با مقیاس دستی استفاده میکنند]]' or '')
end
|