Module:User:DTLHS/defs

local export = {}

function split(pString, pPattern) local Table = {} local fpat = "(.-)" .. pPattern local last_end = 1 local s, e, cap = pString:find(fpat, 1) while s do      if s ~= 1 or cap ~= "" then table.insert(Table,cap) end last_end = e+1 s, e, cap = pString:find(fpat, last_end) end if last_end <= #pString then cap = pString:sub(last_end) table.insert(Table, cap) end return Table end

function export.show(frame) local ret = "" local args = frame:getParent.args local title = args[1] local text = mw.title.makeTitle("", title):getContent local lines_ = split(text, "\n") for i,v in ipairs(lines_) do       if string.sub(v, 1, 1) == "#" then if ret == "" then ret = ret..v           else ret = ret.."\n"..v           end end end ret = ret:gsub("{", " ") ret = ret:gsub("}", " ") ret = ret:gsub(" ", " ") return ret end

return export