Module:For/sandbox

local p = {}

local i18n = require('Dev:I18n').loadMessages('For') local title = mw.title.getCurrentTitle

function main(thing, link, link2) thing = type(thing) == 'string' and thing or i18n:msg('other') link = type(link) == 'string' and link or       i18n:inUserLang:msg('disambiguation', title.text) local text = (type(link2) == 'string' and link2 ~= '') and i18n:msg('for-2', thing, link, link2) or       i18n:msg('for-1', thing, link) return text end

function dd(html, text) html:tag('dd') :tag('span') :addClass('dablink') :tag('i') :wikitext(text) :done :done :done end

function p.main(frame) local args = frame:getParent.args local temp = {} local curr = false local html = mw.html.create('dl') for k, v in ipairs(args) do       local rest = tonumber(k) % 3 if rest == 0 then dd(html, main(temp[1], temp[2], v)) curr = false else temp[rest] = v           curr = true end end if curr then dd(html, main(temp[1], temp[2])) end return tostring(html:done) end

return p