This site has been deprecated in favor of https://attack.mitre.org and will remain in place until 11/1/22.

Module:Tools

From attackics
Jump to navigation Jump to search

Documentation for this module may be created at Module:Tools/doc

local p = {}

function p.grouptitle( frame )
    retval = ""
    index = 1
    count = 0
    iterator = mw.text.gsplit(frame.args.array, frame.args.delim)
    for item in iterator do
        if mw.text.trim( item ) ~= "" then
            count = count + 1
        end
    end

    iterator = mw.text.gsplit(frame.args.array, frame.args.delim)
    for item in iterator do 
        if mw.text.trim( item ) ~= "" then
             if index > 1 then
                 retval = retval .. ", "
             end

             if index < 3 or (index == 3 and count == 3) then
                 retval = retval .. item
             else
                 retval = retval .. "..."
                 return retval
             end

             index = index + 1
        end
    end

    return retval
end

return p