Module:List

From Will You Snail Wiki
Jump to navigation Jump to search

Documentation for this module may be created at Module:List/doc

List = {}
ListLocal = {}

----
-- Libraries and Globals
----
-- Parses invocation and template parameters, trims whitespace, and removes blanks.
local getArgs = require('Dev:Arguments').getArgs

----
-- Local Functions
----
local function makeInvokeFunc(funcName)
	return function (frame)
		local args = getArgs(frame)
		return ListLocal[funcName](args)
	end
end

----
-- Public Functions
----
--% Formats dialogue between multiple speakers
List.unbulleted = makeInvokeFunc('unbulleted')
function ListLocal.unbulleted(args)
	local list = mw.html.create('ul'):cssText('list-style-type: none; padding-left: 0; margin-left: 0;')
	for i, value in ipairs(args) do
		list:tag('li'):wikitext(value):done()
	end
	list:done()
	
	return tostring(list)
end

return List