Module:Navigation: Difference between revisions
From PC Gaming Shelter
No edit summary |
No edit summary |
||
| Line 1: | Line 1: | ||
local p = {} | local p = {} | ||
local function renderRow( | local function renderRow(label, image, target) | ||
local defaultTarget = label | |||
if not target then | |||
target = defaultTarget | |||
end | |||
local html = mw.html.create() | local html = mw.html.create() | ||
html:tag('div') | html:tag('div') | ||
:tag('div'):attr('data-bg', | :tag('div'):attr('data-bg', image):wikitext(string.format([[%s|%s]], target, label)):done() | ||
:tag('div'):wikitext(string.format([[%s|%s]], target, | :tag('div'):wikitext(string.format([[%s|%s]], target, label)):done() | ||
:done() | :done() | ||
Revision as of 12:57, 15 March 2026
Documentation for this module may be created at Module:Navigation/doc
local p = {}
local function renderRow(label, image, target)
local defaultTarget = label
if not target then
target = defaultTarget
end
local html = mw.html.create()
html:tag('div')
:tag('div'):attr('data-bg', image):wikitext(string.format([[%s|%s]], target, label)):done()
:tag('div'):wikitext(string.format([[%s|%s]], target, label)):done()
:done()
return html
end
function p.data(frame)
local args = frame:getParent().args or {}
local title = args[1] or args['title'] or 'Navigate'
local html = mw.html.create()
html:tag('div'):addClass('card bg-dark thumbwall')
:tag('div'):addClass('card-header'):wikitext(title):done()
:tag('div'):addClass('card-body')
local i = 1
while args['label' .. i] do
local label = args['label' .. i]
local image = args['image' .. i] or ''
local target = args['target' .. i] or label
html:node(renderRow(label, image, target))
i = i + 1
end
return html
end
