Module:Roud TOC
Appearance
require('strict')
local p = {}
local getArgs = require('Module:Arguments').getArgs
function p.roud_toc(frame)
local args = getArgs(frame)
local contents = args.contents
if not contents then
local start = tonumber(args.start) or 0
local list_end = tonumber(args['end']) or start + 9
local suffix = string.rep('x', tonumber(args.suffix) or 2)
local links = {}
for i = start, list_end do
local link = i .. suffix
if start == 0 then
link = '0' .. link
end
link = '* [[#' .. link .. '|' .. link .. ']]'
table.insert(links, link)
end
contents = table.concat(links, '\n')
end
return frame:expandTemplate {
title = 'Empty TOC',
args = {
gray = true,
[1] = frame:expandTemplate {
title = 'Flatlist',
args = {
contents
}
}
}
}
end
return p