Editing Module:Gnoblin
From Deepest Lore
More actions
The edit can be undone.
Please check the comparison below to verify that this is what you want to do, and then publish the changes below to finish undoing the edit.
| Latest revision | Your text | ||
| Line 2: | Line 2: | ||
function p.gallery(frame) | function p.gallery(frame) | ||
local text = frame.args | local text = frame.args.text or "" | ||
local entries = {} | local entries = {} | ||
| Line 11: | Line 11: | ||
local separator = string.find(entry, "::", 1, true) | local separator = string.find(entry, "::", 1, true) | ||
local file | local file = entry | ||
local description | local description = "" | ||
if separator then | if separator then | ||
file = mw.text.trim(string.sub(entry, 1, separator - 1)) | file = mw.text.trim(string.sub(entry, 1, separator - 1)) | ||
description = mw.text.trim(string.sub(entry, separator + 2)) | description = mw.text.trim(string.sub(entry, separator + 2)) | ||
end | end | ||
if file ~= "" then | if file ~= "" then | ||
local | local image = mw.html.create("div") | ||
:addClass("gallery-image") | |||
:wikitext("[[File:" .. file .. "|frameless]]") | |||
local item = mw.html.create("div") | |||
:addClass("gallery-item") | |||
:node(image) | |||
if description ~= "" then | if description ~= "" then | ||
item:tag("div") | |||
:addClass("gallery-caption") | |||
:wikitext(description) | |||
end | end | ||
table.insert(entries, | table.insert(entries, tostring(item)) | ||
end | end | ||
end | end | ||
| Line 39: | Line 44: | ||
return '<div class="character-gallery">' .. | return '<div class="character-gallery">' .. | ||
table.concat(entries) .. | |||
'</div>' | '</div>' | ||
end | end | ||