Module:List: Difference between revisions

Jump to navigation Jump to search
imported>DannyS712
Implement edit request - don't trim passed arguments while still removing whitespace-only parameters
MeowyCats2 (talk | contribs)
m 43 revisions imported
 
(9 intermediate revisions by 9 users not shown)
Line 22: Line 22:
-- Classes
-- Classes
data.classes = {}
data.classes = {}
data.templatestyles = ''
if listType == 'horizontal' or listType == 'horizontal_ordered' then
if listType == 'horizontal' or listType == 'horizontal_ordered' then
table.insert(data.classes, 'hlist hlist-separated')
table.insert(data.classes, 'hlist')
data.templatestyles = mw.getCurrentFrame():extensionTag{
name = 'templatestyles', args = { src = 'Template:Flatlist/styles.css' }
}
elseif listType == 'unbulleted' then
elseif listType == 'unbulleted' then
table.insert(data.classes, 'plainlist')
table.insert(data.classes, 'plainlist')
data.templatestyles = mw.getCurrentFrame():extensionTag{
name = 'templatestyles', args = { src = 'Template:Plainlist/styles.css' }
}
end
end
table.insert(data.classes, args.class)
table.insert(data.classes, args.class)
Line 144: Line 151:
end
end


return tostring(root)
return data.templatestyles .. tostring(root)
end
end


Line 182: Line 189:
local origArgs = mArguments.getArgs(frame, {
local origArgs = mArguments.getArgs(frame, {
valueFunc = function (key, value)
valueFunc = function (key, value)
return value and mw.ustring.find(value, '%S') and value or nil
if not value or not mw.ustring.find(value, '%S') then return nil end
if mw.ustring.find(value, '^%s*[%*#;:]') then
return value
else
return value:match('^%s*(.-)%s*$')
end
end
return nil
end
})
})
-- Copy all the arguments to a new table, for faster indexing.
-- Copy all the arguments to a new table, for faster indexing.