Difference between revisions of "Module:Li"
Jump to navigation
Jump to search
Line 33: | Line 33: | ||
end | end | ||
for | for li=1, max_lines do | ||
if args[ | if args[li] == nil then | ||
break | break | ||
elseif args[ | elseif args[li-1] == '' then | ||
result = result .. '<div class="li-text"><br>' .. args[ | result = result .. '<div class="li-text"><br>' .. args[li] .. '</div>' | ||
else | else | ||
result = result .. '<div class="li-text">' .. args[ | result = result .. '<div class="li-text">' .. args[li] .. '</div>' | ||
end | end | ||
end | end |
Revision as of 14:33, 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['noimage'] == nil then result = result .. image ( nil, nil, 'Image not found' ) else result = result .. image ( nil, nil, 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 li=1, max_lines do if args[li] == nil then break elseif args[li-1] == '' then result = result .. '<div class="li-text"><br>' .. args[li] .. '</div>' else result = result .. '<div class="li-text">' .. args[li] .. '</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