Module:Delimited tag: Difference between revisions

mNo edit summary
seems this doesn't break anything; don't mind the uhhh... ternary expression
 
(3 intermediate revisions by 3 users not shown)
Line 9: Line 9:


local tag = function(txt)
local tag = function(txt)
return '<' .. args['tag'] .. '>' .. txt .. '</' .. args['tag'] .. '>'
return '<' .. args['tag'] .. (args['wordbreak'] and ' style="word-break:break-all"' or '') .. '>' .. txt .. '</' .. args['tag'] .. '>'
end
end
local listLevel = args['list-level'] or '**'
local listLevel = args['list-level'] or '**'


local output = tag(args[1])
local output = tag(assert(args[1], 'No tag text provided.?'))
local finalDelimiterValues = {
local finalDelimiterValues = {
Line 19: Line 19:
['comma'] = ', ',
['comma'] = ', ',
[','] = ', ',
[','] = ', ',
['and'] = ' and ',
['and'] = ', and ',
['&'] = ' &amp;&nbsp;',
['&'] = ' &amp;&nbsp;',
['or'] = ' or&nbsp;',
['or'] = ' or&nbsp;',
['to'] = ' to&nbsp;',
['to'] = ' to&nbsp;',
['br'] = '<br/>',
['br'] = '<br/>',
['newline'] = '<br>',
['newline'] = '<br/>',
['list'] = '\n' .. listLevel,
['list'] = '\n' .. listLevel,
['bullet'] = '\n' .. listLevel,
['bullet'] = '\n' .. listLevel,
Line 39: Line 39:
['&'] = ', ',
['&'] = ', ',
['or'] = ', ',
['or'] = ', ',
['and-list'] = ',<br>\n' .. listLevel,
['and-list'] = ',<br/>\n' .. listLevel,
['&-list'] = ',<br>\n' .. listLevel,
['&-list'] = ',<br/>\n' .. listLevel,
['or-list'] = ',<br>\n' .. listLevel,
['or-list'] = ',<br/>\n' .. listLevel,
}
}