Edge Rewrite
// HTMLRewriter · presentation

This page was redesigned at the edge.

Cloudflare fetched the original article and streamed it through HTMLRewriter to apply an entirely new visual system without rebuilding the source page.

Jump to content

Module:Anchored list

From Wikipedia, the free encyclopedia

local yesno = require('Module:Yesno')
local getArgs = require('Module:Arguments').getArgs
local p = {}

-- Argument handling
function p.generate(frame)
	local args = getArgs(frame)
	return p._generate(args)
end

-- Actual function
function p._generate(args)
	local _style = ''
	if not (args.style == '' or args.style == nil) then
		_style = ' style="' .. args.style .. '"'
	end
	local output = '<ol' .. _style .. '>'
	for i,item in ipairs(args) do
		if item ~= '' and not yesno(args.bare) then
			output = output .. '<li ' .. _style .. 'id="alist' .. (args.name or '')  .. '-' .. i .. '">' .. item .. '</li>'
		elseif item ~= '' and yesno(args.bare) then
			output = output .. '<li ' .. _style .. 'id="' .. i ..'">' .. item .. '</li>'
		end
	end
	return output .. '</ol>'
end
return p