Module:DBR index

local p = {} local title = mw.title.getCurrentTitle

-- The point of this module is to keep the WP:PEIS lower than is possible -- with nested templates.

local function sizeof(n) return tonumber(mw.getCurrentFrame:callParserFunction('PAGESIZE', {title.fullText .. '/' .. n, 'R'})) end

function p.main(frame) local description = frame.args.description or		frame:getParent.args.description or		title.subpageText:lower local as_of = '; data as of ' .. frame:expandTemplate{ title = title.fullText .. '/1', args = {} } .. '.\n' if sizeof(2) > 50 then -- Make a bulleted list of pages local result = {'Index of ' .. description .. as_of .. 'Page 1Page 2'} for i = 3, 50 do			if sizeof(i) > 50 then result[#result + 1] = 'Page ' .. i .. '' end end result[#result + 1] = '' return table.concat(result) end -- There's only one page so extract the table from its content. local content = mw.title.new(title.fullText .. '/1'):getContent local wikitable = content:match('{|.*|}') -- Copy if it's present too local srn = "" if content:find("") ~= nil then srn = "\n" end content = frame:getParent:preprocess(srn .. wikitable) return mw.getContentLanguage:ucfirst(description) .. as_of .. content end

return p