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
-- Added by {{Keep inline}}
local keepInline = item[2]:match('KEEP%-INLINE$') ~= nil
if keepInline then
item[2] = item[2]:gsub(' *KEEP%-INLINE$', '') .. '<span class="content-list-inline"></span>'
end
if not keepInline and i < #items and #items[i + 1][1] > #item[1] then
-- local post = inlineNext and ':' or ''
local post = ':'
item[2] = '\n' .. item[1] .. "'''''" .. item[2] .. post .. "'''''"
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