Module:TooltipGen

local p = {}

local function getInfobox(content) local infobox = '' if mw.ustring.match(content, '') then infobox = mw.ustring.match(content, '') elseif mw.ustring.match(content, '') then infobox = mw.ustring.match(content, '') end if mw.text.trim(infobox) == '' then infobox = false end local result = infobox and () or  return result end

local invalidSymbols = { ['{'] = true, ['}'] = true, ['|'] = true, [' '] = true, [''] = true, -- HTML comments ['<'] = true, ['-'] = true, -- images ['['] = true, }

local function getContent(content) local result = {} local strings = mw.text.split(content, '\n') local i = 1 local flag = false while string.sub(strings[i], 1, 1) ~= '=' do		if not flag then if not invalidSymbols[string.sub(strings[i], 1, 1)] then flag = true end end if flag then result[#result + 1] = strings[i] end i = i + 1 end return table.concat(result, '\n') end

function p.getTooltip(frame) local page = frame.args[1] local title = mw.title.new(page) local content = title:getContent if content then return frame:preprocess(getInfobox(content) .. '\n\n' .. getContent(content)) else return 'Error' end end

return p