Modul:Message Box Templates
| This module is rated as ready for general use. It has reached a mature form and is thought to be bug-free and ready for use wherever appropriate. It is ready to mention on help pages and other Wikipedia resources as an option for new users to learn. To reduce server load and bad output, it should be improved by sandbox testing rather than repeated trial-and-error editing. |
| This module depends on the following other modules: |
This module implements template {{Message Box Templates}}.
Usage
{{#invoke:Message Box Templates|main}}
local p = {}
local getArgs = require('Module:Arguments').getArgs
local tl = function(template)
return '{{[[Template:' .. template .. '|' .. template .. ']]}}'
end
local messageBoxTemplates = {
{
template = 'Deprecated',
description = 'articles that are outdated and are not maintained anymore.',
}, {
template = 'Deprecated template',
description = 'outdated/deprecated templates and pages, that use these templates. <i>(used by template programmers)</i>',
}, {
template = 'Draft',
description = 'articles/sections currectly in development or in revision.',
}, {
template = 'Faulty',
description = 'articles/sections that are erroneous, faulty, or otherwise dangerous.',
}, {
template = 'Stub',
description = 'articles that needs expanding.',
}, {
template = 'Template warning',
description = 'the error feedback from templates. <i>(used by template programmers)</i>',
}, {
template = 'Untested',
description = 'articles that lack validation and positive user feedback.',
}, {
template = 'Warning',
description = 'Warning text.',
}
}
function p.main(frame)
local args = getArgs(frame)
local envelopeMask, lineMask
if args.type == 'dl' then
envelopeMask = '<dl>\n%s</dl>\n'
lineMask = '\t<dt>%s</dt>\n\t<dd>%s</dd>\n'
else
envelopeMask = '<ul>\n%s</ul>\n'
lineMask = '\t<li>%s to mask <b>%s</b></li>\n'
end
local content = ''
for _, t in ipairs(messageBoxTemplates) do
content = content .. string.format(lineMask, tl(t.template), t.description)
end
return string.format(envelopeMask, content)
end
return p