Semantic MediaWikiDit bericht verdwijnt nadat alle relevante taken zijn afgerond.

Er is één onvoltooide of openstaande taak, die nodig is om het bijwerken van Semantic MediaWiki te voltooien. Een beheerder of gebruiker met voldoende rechten kan deze uitvoeren. Dit moet worden gedaan voordat nieuwe gegevens worden toegevoegd om tegenstrijdigheden te voorkomen.

Module:Pagination

Summary
Pagination feature



local p = {}

--[[
Bookstrap pagination

{{#invoke:Pagination|...
|total={{{Total|0}}}
|totalvisible=
|target={{{Target|{{FULLPAGENAME}}}}}
|currentoffset={{#cr-urlget:par={{#var:@name offset}}|default=0}}
|nameoffset={{{Name offset|offset}}}
|withurlparameters=
}}
]]

p.getPagination = function(frame) 
	local total = tonumber( frame.args.total or 0 )
	local totalVisible = tonumber( frame.args.totalvisible or 0 )
	local initialOffset = tonumber( frame.args.initialoffset or 0 )
	local nameOffset = frame.args.nameoffset or "offset"
	local target = frame.args.target or ""
	local withUrlParameters = frame.args.withurlparameters or nil

	-- calculated variables
	-- whether to show pagination at all {{#ifexpr: {{#var:@total|0}} < {{#var:@total visible|0}}|false|true}} 
	if ( total < totalVisible ) then return "" end

	-- loop
	local numberOfLoops = math.ceil( total / totalVisible )
	
		--currentOffset
	local str = ""

	for i=1, numberOfLoops do
		--str = str .. " " .. i
		local currentOffset = ( i * totalVisible ) - totalVisible
		--local offset = ( offset * totalVisible ) + totalVisible
		local class = "page-item"
		if currentOffset == initialOffset then class = class .. " active" end
		local href = tostring( mw.uri.fullUrl( target, { [nameOffset] = currentOffset } ) )
		if withUrlParameters ~= nil then
			href = href .. "&" .. withUrlParameters
		end
		local widget = '[' .. i .. "=" .. currentOffset .. '] '
		local widget = frame:callParserFunction( "#widget", { "Link",
			["type"] = "a",
			["class"] = "page-link",
			["href"] = href,
			["text"] = i
		} )
		local li = '<li class="' .. class .. '">' .. widget .. '</li>'
		str = str .. li
	end

	return '<ul class="pagination pagination-lg pl-0 flex-wrap">' .. str .. '</ul>'

	
end

return p;