Module: Listify

From A Wiki of Ice and Fire
Jump to: navigation, search

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

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 mw.ustring.gmatch(str, "([^\n]+)") do
    table.insert(t, s)
  end
  return t
end