모듈:Anchor
보이기
위 설명은 모듈:Anchor/설명문서의 내용을 가져와 보여주고 있습니다. (편집 | 역사) 연습장 (생성 | 복제) 및 시험장 (생성) 문서에서 이 모듈을 실험할 수 있습니다. 이 모듈에 딸린 문서. |
-- {{anchor}}에 쓰이는 모듈입니다.
local getArgs = require('모듈:Arguments').getArgs
local tableTools = require('모듈: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))
end
function p._main(...)
-- Generate the list of anchors.
local anchors = {...}
local ret = {}
for _, anchor in ipairs(anchors) do
ret[#ret + 1] = '<span class="anchor" id="' .. anchor .. '"></span>'
end
return table.concat(ret)
end
return p