Module:Nornabr/sandbox
Appearance
This is the module sandbox page for Module:Nornabr (diff). |
This module depends on the following other modules: |
Logic for {{nornabr}}.
require('strict')
local p = {} --p stands for package
local getArgs = require('Module:Arguments').getArgs
local error_message = require('Module:Error')['error']
local function abbr(args)
if not args[1] then
return error_message({message = "Missing first argument"})
end
local data = args.data
local title = args[2] or data[args[1]]
if not title then
return error_message({message = "Unrecognised abbreviation: " .. args[1]})
end
local abbr = mw.html.create('abbr')
:attr('title', title)
:css(args.css or {})
:wikitext(args[1])
return abbr
end
function p.nornabr(frame)
local args = getArgs(frame)
args.data = mw.loadData('Module:Nornabr/data')
return abbr(args)
end
function p.abbreviation(frame)
return p.nornabr(frame)
end
function p.nornabrn(frame)
local args = getArgs(frame)
args.data = mw.loadData('Module:Nornabr/nornabrn data')
if not args[2] then
args.css = {['letter-spacing'] = '0.08em'} -- from [[Template:Nornsp]]
end
return abbr(args)
end
return p