Modul:TOC
Dokumentaci tohoto modulu lze vytvořit na stránce Nápověda:Modul:TOC
local p = {}
function p.short(frame, from, through, head, pref, postf, prefLink, postLink, offset)
pargs = frame:getParent().args
local result, i
local items = {}
from = tonumber ( from or pargs[1] ) or 1
through = tonumber ( through or pargs[2] ) or 0
head = head or "Kapitoly"
pref = pref or ""
postf = postf or ""
prefLink = prefLink or ""
postfLink = postfLink or ""
offset = tonumber ( offset ) or 0
if through>from then
result = [[
<div id="shorttoc">
<div id="toc" class="toc">
<div id="toctitle"><h2>]] .. head .. [[</h2></div>
]]
for i = from, through do
table.insert (items,"*[[#" .. prefLink .. i+offset .. postfLink .. "|" .. pref .. i .. postf .. "]]")
end
result = result .. mw.text.listToText( items, "\n", "\n") .. "</div></div>\n"
end
return result
end
return p