Module:File title list

From MOASSpedia
Jump to navigation Jump to search


Usage

{{#invoke:File title list|main}}

To be used in templates, not directly. (It gets parameters from the parent/transcluding template, not passed directly into it.) That parent template's positional parameters will then be output as a list (default bulleted; set type=type in invoke call for something else; types are from Module:List) of Template:File title formatted links.



list = require('Module:List')

local p = {}

function p.main()
	local list_type = mw.getCurrentFrame().args['type'] or 'bulleted'
	local list_items = {}
	for _, item in ipairs(mw.getCurrentFrame():getParent().args) do
		table.insert(
			list_items,
			'[[:' .. mw.getCurrentFrame():expandTemplate{
				title = 'file title',
				args = {item}
			} .. ']]'
		)
	end
	return list[list_type](list_items)
end

return p