Module:Shortcut: Difference between revisions

From the Croc Wiki, the Croc encyclopedia
Jump to navigationJump to search
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
(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:
end
table.insert(listItems, options.msg)
local nListItems = #listItems
 
-- Exit if we have nothing to display
if nListItems#listItems < 1 then
return nil
end
Line 56 ⟶ 55:
 
-- Shortcut heading
local shortcutHeading = mw.message.newRawMessage(
do
cfg['shortcut-heading'],
local nShortcuts = #shortcuts
nListItems
if nShortcuts > 0 then
):plain()
shortcutHeading = frame:preprocessmw.message.newRawMessage(shortcutHeading)
cfg['shortcut-heading'],
nShortcuts
):plain()
shortcutHeading = frame:preprocess(shortcutHeading)
shortcutHeading = shortcutHeading .. '\n'
end
end
 
-- Shortcut box
Line 79 ⟶ 85:
:tag('small')
:wikitext(shortcutHeading)
:newline()
:tag('ul')
for i, item in ipairs(listItems) do
Cookies help us deliver our services. By using our services, you agree to our use of cookies.

Navigation menu