Difference between revisions of "Module:Li"
Jump to navigation
Jump to search
Line 21: | Line 21: | ||
for i=1, max_images do | for i=1, max_images do | ||
if i == 1 then | if i == 1 then | ||
if image == nil then | if args['image'] == nil then | ||
result = result .. image ( args['image'], args['imagedesc'], 'Image not found' ) | result = result .. image ( args['image'], args['imagedesc'], 'Image not found' ) | ||
else | else |
Revision as of 14:18, 24 March 2022
Documentation for this module may be created at Module:Li/doc
local p = {} function p.li(frame) max_images = 10 max_lines = 30 if (frame:getParent().args['blocksize'] == 'small') then image_css = 'li-small-image-block' image_size = 'x90px' noimage_css = 'li-small-noimage-block' else image_css = 'li-image-block' image_size = 'x230px' noimage_css = 'li-noimage-block' end args = frame:getParent().args result = '<div class="li-block">' for i=1, max_images do if i == 1 then if args['image'] == nil then result = result .. image ( args['image'], args['imagedesc'], 'Image not found' ) else result = result .. image ( args['image'], args['imagedesc'], args['noimage'] ) end elseif args['image' .. i] == nil then break else result = result .. image ( args['image' .. i], args['imagedesc' .. i], args['noimage' .. i] ) end end for i=1, max_lines do if args[i] == nil then break elseif args[i-1] == '' then result = result .. '<div class="li-text"><br>' .. args[i] .. '</div>' else result = result .. '<div class="li-text">' .. args[i] .. '</div>' end end result = result .. '</div>' return result end function image(image, img_description, noimage) if (noimage ~= nil) then img_result = '<div class="' .. noimage_css .. '">' img_result = img_result .. '<span class="li-image-space"></span>' img_result = img_result .. '<div class="li-noimage-text">' img_result = img_result .. noimage img_result = img_result .. '</div></div>' else img_result = '<div class="'.. image_css .. '"><div class="li-image">' img_result = img_result .. '<span class="li-image-space"></span>' img_result = img_result .. '[[File:' .. image .. '|' .. image_size .. ']]' if img_description ~= nil then img_result = img_result .. '<div class="li-image-text">' .. img_description .. '</div>' end img_result = img_result .. '</div></div>' end return img_result end return p