Module:Sandbox/BrandonXLF/4
Appearance
-- Sandbox, do not delete
local p = {}
function p.main(frame)
local wikitext = frame:preprocess(frame.args[1])
local items = {}
-- Parse each row
for indent, item in wikitext:gmatch("(**) *([^\n]+)") do
items[#items + 1] = {'*' .. indent, item}
end
-- Bold sublist titles and add a blank list item before them
-- The blank item is used by CSS to make the list item block leel
for i, item in pairs(items) do
if i < #items and #items[i + 1][1] > #item[1] then
-- Add {{Inline sublist}} after the bold and italics
local inlineNext = item[2]:match('INLINE%-UL$') ~= ni
if inlineNext then
item[2] = item[2]:gsub(' *INLINE%-UL$', '')
end
local post = inlineNext and ':' or ''
item[2] = '\n' .. item[1] .. "'''''" .. item[2] .. post .. "'''''"
if inlineNext then
item[2] = item[2] .. '<span class="content-inline-ul"></span>'
end
end
end
local out = ''
for _, item in pairs(items) do
out = out .. item[1] .. item[2] .. '\n'
end
return '<div class="content-list">\n' .. out .. '</div>' .. frame:extensionTag{
name = 'templatestyles', args = { src = 'User:BrandonXLF/styles2.css' }
}
end
return p