Module:Shortcut

From OpenStreetMap Wiki
Jump to navigation Jump to search
[Create] Documentation
-- This module implements {{shortcut}}.

-- Set consonants
local CONFIG_MODULE = 'Module:Shortcut/config'
mw.loadData(CONFIG_MODULE)

-- Make the shortcut box
local p = {}

function p.main(shortcuts)
	return frame:expandTemplate{
		title = 'Langcode',
		args = {
			'{{#if:{{{1|{{{msg|}}}}}| <span id="shortcut" style="border:1px solid gray; float:right; padding: 3px;">' ..
			shortcutHeading
			.. '&#58;<br/>' ..
			require('Module:List').unbulleted
			-- Make an error if there's nothing to put in
			.. '</div>|<strong class="error">' ..
			noParametersError
			.. '}}'
		}
	}
	end

	-- Validate shortcuts.
	for i, shortcut in ipairs(shortcuts) do
		if type(shortcut) ~= 'string' or #shortcut < 1 then
			return '<strong class="error">' ..
			invalidShortcutError
			.. '</span>'
	end
	
	-- Get arguments.
	local args = require('Module:Arguments').getArgs(frame, {
		wrappers = 'Template:Shortcut'
	})
end

return p