Module:Pagelist

From About PCs Wiki
Jump to navigation Jump to search

Invoke procedure proc: {{#invoke:Pagelist|proc}} · use module: local t = require('Module:Pagelist')

Subpages

Module Usage


local p = {}
local t = require('Module:Lily/Arguments')

function p.list_by_id(frame)
	--{{#invoke:Hili|list_by_id|ab=}}
	--creates a table with pagenames, id and namespace
	--very expensive
	--arguments: start (first id in the list)
	local args = frame.args                                   -- called by #invoke
	if empty(args) then args = mw.getCurrentFrame().args end  -- called by template	
	local tabel, tabtr, tabtre = '<table>', '<tr>', '</tr>'
	local _ = ''
	local page
	
	local abwo = tonumber(args.start) or 1
	for i = abwo, abwo + 99 do
		page = mw.title.new(i)
		if page then
			_ = _ .. '<tr><td>' .. i .. '</td><td>[[:' .. page.prefixedText .. '|' .. page.text .. ']]</td><td>' .. page.nsText .. '</td></tr>\n'
		end
	end
	_ = '<table class="cute"><tr><th>ID</th><th>name</th><th>namespace</th></tr>' .. _ .. '</table>'
	return _
end

return p