Jump to content

Module:Listify

Kubijyanye na Wikipedia
Revision as of 00:51, 19 Gicurasi 2022 by BevoLJ (ibiganiro byanjye | Umusanzu) (Creating Module:Listify)
(ubudasa) ← Ivugururwa rya kera | Ivugururwa riheruka (ubudasa) | Ivugururwa rishya → (ubudasa)

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

local getArgs = require('Module:Arguments').getArgs

return function (str)
    str = str or ""
    str = mw.ustring.gsub(str, "<br%s*/*>", "\n")
    str = mw.ustring.gsub(str, "<BR%s*/*>", "\n")
    str = mw.ustring.gsub(str, "^%*", "\n")
    str = mw.ustring.gsub(str, "\n%*", "\n")
    
    local t = {}
    for s in str:gmatch("([^\n]+)") do
        table.insert(t, s)
    end
    return t
end