Jump to content

Module:Sandbox/isaacl/ExpandPageAbbreviation

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Isaacl (talk | contribs) at 02:12, 28 February 2013 (add comment pointing to test cases). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.
-- For unit tests, see [[Module:Sandbox/isaacl/ExpandPageAbbreviation/tests]]

local phraseForAbbr = mw.loadData('Module:Sandbox/isaacl/ExpandPageAbbreviation/data');

local moduleSelf = { }

function moduleSelf._expand(abbr)
    if phraseForAbbr[abbr] == nil then
        return abbr
    else
        return phraseForAbbr
    end
end

function moduleSelf.expand(frame)
    local abbr = frame.args[1]
    return moduleSelf._expand(abbr)
end

return moduleSelf