Module:Delimited tag

local p = {}

function p.output(f)

local args = f	if f == mw.getCurrentFrame then args = require('Module:ProcessArgs').merge(true) end

local tag = function(txt) return '<' .. args['tag'] .. '>' .. txt .. ''	end local listLevel = args['list-level'] or '**'

local output = tag(assert(args[1], 'No tag text provided.?')) local finalDelimiterValues = { ['none'] = ' ', ['comma'] = ', ', [','] = ', ',		['and'] = ' and ', ['&'] = ' &amp; ', ['or'] = ' or ', ['to'] = ' to ', ['br'] = ' ', ['newline'] = ' ', ['list'] = '\n' .. listLevel, ['bullet'] = '\n' .. listLevel, ['*'] = '\n' .. listLevel, ['and-list'] = ', and\n' .. listLevel, ['or-list'] = ', or\n' .. listLevel, ['&-list'] = ' &\n' .. listLevel, ['comma-list'] = ',\n' .. listLevel, [',-list'] = ',\n' .. listLevel, }	local midDelimiterValues = { ['and'] = ', ', ['&'] = ', ',		 ['or'] = ', ', ['and-list'] = ', \n' .. listLevel, ['&-list'] = ', \n' .. listLevel, ['or-list'] = ', \n' .. listLevel, }	local delimiter = args['delimiter'] or args['delim'] or args['d'] or ' ' local finalDelimiter = finalDelimiterValues[delimiter] or delimiter local midDelimiter = midDelimiterValues[delimiter] or finalDelimiter for i,val in ipairs(args) do		if (i > 1) then local currentDelimiter = args[i+1] and midDelimiter or finalDelimiter output = output .. currentDelimiter .. tag(val) end end return output end

return p