Bước tới nội dung

Mô đun:Anchor

Trang mô đun bị khóa vô hạn
Bách khoa toàn thư mở Wikipedia
-- Mô đun này thực hiện {{anchor}}.local getArgs = require('Mô đun:Arguments').getArgslocal tableTools = require('Mô đun:TableTools')local p = {}function p.main(frame)	-- Get the positional arguments from #invoke, remove any nil values,	-- and pass them to p._main.	local args = getArgs(frame)	local argArray = tableTools.compressSparseArray(args)	return p._main(unpack(argArray))endfunction p._main(...)	-- Generate the list of anchors.	local anchors = {...}	local ret = {}	for _, anchor in ipairs(anchors) do		ret[#ret + 1] = '<span id="' .. anchor .. '"></span>'	end	return table.concat(ret)endreturn p