Content deleted Content added
continue experiment |
update from Module:Large category TOC |
||
Line 1:
local p = {}
local azupper = mw.text.split('ABCDEFGHIJKLMNOPQRSTUVWXYZ','')
local azlower = mw.text.split('abcdefghijklmnopqrstuvwxyz','')
local aejot = mw.text.split('aejot','')
function p.scrollable(frame)
Line 28:
:addClass('toc')
-- :attr('id','toc')
:css(
-- Contains "Content: Top 0-9 A - Z"
local header =
:attr('id','toctitle')
:attr('class','toctitle')
:css('background','WhiteSmoke')
-- Contains all the rest
local body_wrapper
local body =
:css('text-align', 'center')
if toc_type == 'collapsible' then
Line 47 ⟶ 48:
header:addClass('NavHead')
body:addClass('NavContent')
:css(
elseif toc_type == 'scrollable' then
body:css({ ['overflow-x'] = 'scroll',
['overflow-y']= 'hidden',
['white-space'] = 'nowrap' })
end
local header_content = {'<strong>'
' ['
' ['
for
table.insert(header_content,string.format(' [%s?from=%s %s]',pageurl,v,v))
end
header:wikitext(table.concat(header_content))▼
local body_content = {}▼
▲ header:wikitext(header_content)
▲ local body_content
if toc_type == 'collapsible' then
table.insert(body_content
body_wrapper =
:css('background','White')
else
table.insert(body_content
body_wrapper =
end
for i=0,9 do
table.insert(body_content
end
local function atoz(letter)
local azlist = {}
local letterlist
if toc_type == 'aejot' then
letterlist = aejot
else
letterlist = azlower
end
if toc_type == 'aejot' or toc_type == 'scrollable' then
table.insert(azlist
else
table.insert(azlist
end
for
table.insert(azlist,string.format(' [%s?from=%s%s %s%s] ',pageurl,letter,v,letter,v))
end
return table.concat(azlist)
end
for
table.insert(body_content,atoz(v))
end
body_wrapper:wikitext(table.concat(body_content))
return '__NOTOC__\n'..tostring(toc_frame)
|