Module:Lalisabr

require('strict')

local p = {} local getArgs = require('Module:Arguments').getArgs

function p.lookup(abr) local data = mw.loadData('Module:Lalisabr/data') local newdata = {} for index, value in ipairs(data) do		newdata[value[1]] = {value[2], value[4]} end local expanded = newdata[abr] assert (expanded, "Unrecognised abbreviation: " .. abr) return expanded end

function p.makeTable(frame) local tableStart = ' ' local data = mw.loadData('Module:Lalisabr/data') local args = getArgs(frame) local initial = args[1] local final = args[2] local output = "" local started = nil for index, value in ipairs(data) do		if value[1] == initial or started then output = output .. "\n" started = 1 end

if value[1] == final then return frame:preprocess(tableStart .. output .. tableEnd) end end end

--[=[ Construct the abbbreviation span ]=] function p._abbreviation(args) local span = mw.html.create("span") local data = p.lookup(args[1]); local title = data[1]; local link = data[2]; local wikitext = "''" .. args[1] .. "''";	if link ~= nil then wikitext = "" .. wikitext .. "" end span:attr("title", title):wikitext(wikitext) return tostring(span) end

function p.abbreviation(frame) return p._abbreviation(getArgs(frame)) end

return p