ಮಾಡ್ಯೂಲ್:Toolbar: ಪರಿಷ್ಕರಣೆಗಳ ನಡುವಿನ ವ್ಯತ್ಯಾಸ
Content deleted Content added
generate more natural html if class and style arguments are absent |
use a more efficient string-building algorithm |
||
೧ ನೇ ಸಾಲು:
local p = {}
local args = {}▼
-- Get the keys of the numerical arguments that are present.
local function getArgNums(args)
local nums = {}
local tinsert = table.insert
for k, v in pairs(args) do
if type(k) == 'number' then
end
end
೧೪ ನೇ ಸಾಲು:
end
local function makeToolbarItems(args)
-- Get numerical argument keys.
local nums = getArgNums(args)
-- Get the separator text.
local sep = (args.separator or 'pipe') .. '-separator'
೨೨ ನೇ ಸಾಲು:
-- Generate the toolbar items.
local ret =
local tinsert = table.insert
for i, v in ipairs(nums) do
end▼
end
return table.concat(ret, sep)
end
local function makeToolbar(args)
return mw.ustring.format(
local class = (args.class and (' ' .. args.class)) or ''▼
'<span class="plainlinks%s"%s>(%s)</span>',
▲ )
end
Line ೪೯ ⟶ ೪೫:
if frame == mw.getCurrentFrame() then
origArgs = frame:getParent().args
for k, v in pairs(frame.args) do
origArgs = frame.args
break
else
origArgs = frame
೫೪ ನೇ ಸಾಲು:
-- Strip whitespace and remove nil values
▲ local args = {}
for k, v in pairs(origArgs) do
if
v = mw.text.trim(v)
▲ end
if v ~= '' then
args[k] = v
Line ೬೧ ⟶ ೬೪:
end
return makeToolbar(args)
end
|