Module documentation
[create]
The documentation for this module is missing. Click here to create it.
-- <nowiki>
local p = {}
local i18n = require('Dev:I18n').loadMessages('For')
local title = mw.title.getCurrentTitle()
-- @param {*} val
-- @returns {(string|nil)}
local function sanitize(val)
if type(val) == 'string' and mw.text.trim(val) ~= '' then
return val
end
return nil
end
-- @param {table} args
-- @returns {string}
function p._main(args)
local html = mw.html.create('dl')
for i = 3, math.huge, 3 do
local thing = sanitize(args[i - 2])
local link = sanitize(args[i - 1])
local link2 = sanitize(args[i])
if not (thing or link or link2) then
break
end
local message = i18n:msg(
link2 and 'for-2' or 'for-1',
thing or i18n:msg('other'),
link or i18n:inUserLang():msg('disambiguation', title.text),
link2
)
html:tag('dd')
:tag('span')
:addClass('dablink')
:tag('i')
:wikitext(message)
:allDone()
end
return tostring(html)
end
-- @param {table} frame
-- @returns {string}
function p.main(frame)
local args = frame:getParent().args
return p._main(args)
end
return p