Module:FlexGallery: Difference between revisions
Appearance
No edit summary |
No edit summary |
||
| Line 9: | Line 9: | ||
p.hi = function(frame) | p.hi = function(frame) | ||
for k, v in pairs(frame.args) do | for k, v in pairs(frame.args) do | ||
v = v:gsub("[\n\r\ ]", "") | |||
v = tostring(v) | v = tostring(v) | ||
if k == 1 then | if k == 1 then | ||
| Line 21: | Line 21: | ||
local gallery = "<div><ul>" | local gallery = "<div><ul>" | ||
for k, v in pairs(images) do | for k, v in pairs(images) do | ||
local line = "[[ | local line = string.format("[[%s|thumb|none|%spx|%s]]", | ||
v, width, thumbnails[k]) | |||
local li = mw.html.create('li') | local li = mw.html.create('li') | ||
li | li | ||
| Line 27: | Line 28: | ||
:css("vertical-align", "top") | :css("vertical-align", "top") | ||
:wikitext(frame:preprocess(line)) | :wikitext(frame:preprocess(line)) | ||
line = "[[File:carabine_edge_1.png |thumb|none|120px|Positioning carabiner over an edge atypically loads the carabiner]]" | -- line = "[[File:carabine_edge_1.png |thumb|none|120px|Positioning carabiner over an edge atypically loads the carabiner]]" | ||
return frame:preprocess(line) | return frame:preprocess(line) | ||
Revision as of 21:03, 20 August 2025
Documentation for this module may be created at Module:FlexGallery/doc
local p = {}
local width
local images = {}
local thumbnails = {}
local gallery
-- frame.args
p.hi = function(frame)
for k, v in pairs(frame.args) do
v = v:gsub("[\n\r\ ]", "")
v = tostring(v)
if k == 1 then
width = tonumber(v)
elseif (k % 2) == 0 then
table.insert(images, tostring(v))
else
table.insert(thumbnails, tostring(v))
end
end
local gallery = "<div><ul>"
for k, v in pairs(images) do
local line = string.format("[[%s|thumb|none|%spx|%s]]",
v, width, thumbnails[k])
local li = mw.html.create('li')
li
:css("display", "inline-block")
:css("vertical-align", "top")
:wikitext(frame:preprocess(line))
-- line = "[[File:carabine_edge_1.png |thumb|none|120px|Positioning carabiner over an edge atypically loads the carabiner]]"
return frame:preprocess(line)
end
end
return p