Module:Shortcut: Difference between revisions
From the Croc Wiki, the Croc encyclopedia
Jump to navigationJump to search
Content added Content deleted
(add a nocat option to suppress category output) |
(use the number of shortcuts to generate the plural for the shortcut heading, rather than the number of list items; also, don't output the heading if we don't have any shortcuts to display) |
||
Line 34: | Line 34: | ||
end |
end |
||
table.insert(listItems, options.msg) |
table.insert(listItems, options.msg) |
||
local nListItems = #listItems |
|||
-- Exit if we have nothing to display |
-- Exit if we have nothing to display |
||
if |
if #listItems < 1 then |
||
return nil |
return nil |
||
end |
end |
||
Line 56: | Line 55: | ||
-- Shortcut heading |
-- Shortcut heading |
||
local shortcutHeading |
local shortcutHeading |
||
do |
|||
⚫ | |||
local nShortcuts = #shortcuts |
|||
nListItems |
|||
if nShortcuts > 0 then |
|||
⚫ | |||
shortcutHeading = mw.message.newRawMessage( |
|||
⚫ | |||
nShortcuts |
|||
⚫ | |||
shortcutHeading = frame:preprocess(shortcutHeading) |
|||
shortcutHeading = shortcutHeading .. '\n' |
|||
end |
|||
end |
|||
-- Shortcut box |
-- Shortcut box |
||
Line 79: | Line 85: | ||
:tag('small') |
:tag('small') |
||
:wikitext(shortcutHeading) |
:wikitext(shortcutHeading) |
||
:newline() |
|||
:tag('ul') |
:tag('ul') |
||
for i, item in ipairs(listItems) do |
for i, item in ipairs(listItems) do |