(Very rough sketch of TOC template based on Sidebar code) |
m (further improvement) |
||
Line 5: | Line 5: | ||
root = root:tag('div') | root = root:tag('div') | ||
root:addClass('template-toc') | root:addClass('template-toc') | ||
if args.title then | |||
root:tag('div') | |||
:addClass('toctitle') | |||
:tag('big') | |||
:wikitext(title) | |||
end | |||
local rowNums = {} | local rowNums = {} | ||
for k,v in pairs(args) do | for k,v in pairs(args) do | ||
Line 11: | Line 17: | ||
end | end | ||
end | end | ||
end | end | ||
return p | return p |
Revision as of 13:50, 22 June 2022
local p = {}
function p.toc( frame )
local args = frame:getParent().args
local root = mw.html.create()
root = root:tag('div')
root:addClass('template-toc')
if args.title then
root:tag('div')
:addClass('toctitle')
:tag('big')
:wikitext(title)
end
local rowNums = {}
for k,v in pairs(args) do
local num = k:match('^heading(%d+)$') or k:match('^content(%d+)$')
if num then table.insert(rowNums, tonumber(num))
end
end
end
return p