Toggle menu
Toggle preferences menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

Editing Module:Gnoblin

From Deepest Lore
Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.
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[1] or ""
     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))
            else
                file = entry
                description = ""
             end
             end


             if file ~= "" then
             if file ~= "" then
                 local galleryEntry = "File:" .. file
                 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
                     galleryEntry = galleryEntry .. "|" .. description
                     item:tag("div")
                        :addClass("gallery-caption")
                        :wikitext(description)
                 end
                 end


                 table.insert(entries, galleryEntry)
                 table.insert(entries, tostring(item))
             end
             end
         end
         end
Line 39: Line 44:


     return '<div class="character-gallery">' ..
     return '<div class="character-gallery">' ..
         frame:extensionTag{
         table.concat(entries) ..
            name = "gallery",
            content = table.concat(entries, "\n")
        } ..
         '</div>'
         '</div>'
end
end
Please note that all contributions to Deepest Lore may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see Deepest Lore:Copyrights for details). Do not submit copyrighted work without permission!
Cancel Editing help (opens in new window)