Module:Toolbar
Itsura
![](https://upload.wikimedia.org/wikipedia/commons/thumb/4/43/Test_Template_Info-Icon_-_Version_%282%29.svg/50px-Test_Template_Info-Icon_-_Version_%282%29.svg.png)
-- This module implements {{toolbar}}.
localmArguments-- Lazily initialise [[Module:Arguments]]
localmTableTools=require('Module:TableTools')
localyesno=require('Module:Yesno')
localp={}
functionp.main(frame)
mArguments=require('Module:Arguments')
localargs=mArguments.getArgs(frame)
returnp._main(args)
end
functionp._main(args)
localtoolbarItems=p.makeToolbarItems(args)
ifnottoolbarItemsthen
-- Return the blank string if no arguments were specified, rather than
-- returning empty brackets.
return''
elseifyesno(args.span)==falsethen
returnstring.format(
'(%s)',
toolbarItems
)
else
returnstring.format(
'<span class= "plainlinks%s" %s>(%s)</span>',
type(args.class)=='string'and' '..args.classor'',
type(args.style)=='string'andstring.format(' style= "%s" ',args.style)or'',
toolbarItems
)
end
end
functionp.makeToolbarItems(args)
localnums=mTableTools.numKeys(args)
localsep=(args.separatoror'pipe')..'-separator'
sep=mw.message.new(sep):plain()
localret={}
fori,vinipairs(nums)do
ret[#ret+1]=mw.ustring.gsub(args[v],"%[%[::+(.-)%]%]","[[:%1]]")
end
if#ret>0then
returntable.concat(ret,sep)
else
returnnil
end
end
returnp