Module:Listify

From A Wiki of Ice and Fire
Revision as of 17:25, 13 September 2018 by Abjiklam (talk | contribs)
Jump to: navigation, search

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

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

local p = {}

function p.listify(frame)
    local args = getArgs(frame)
    local str = args[1] or ""
    str:gsub("<(br|BR)%s*/*>", "\n")
    
    local l = mw.html.create('ul')
    for s in str:gmatch("[^\n]+") do
        l:tag('li'):wikitext(s)
    end
    return tostring(l)
end

return p