Editing
Module:Delimited tag
Jump to navigation
Jump to search
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
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'] .. (args['wordbreak'] and ' style="word-break:break-all"' or '') .. '>' .. txt .. '</' .. args['tag'] .. '>' end local listLevel = args['list-level'] or '**' local output = tag(assert(args[1], 'No tag text provided.?')) local finalDelimiterValues = { ['none'] = '<nowiki/>', ['comma'] = ', ', [','] = ', ', ['and'] = ', and ', ['&'] = ' & ', ['or'] = ' or ', ['to'] = ' to ', ['br'] = '<br/>', ['newline'] = '<br/>', ['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'] = ',<br/>\n' .. listLevel, ['&-list'] = ',<br/>\n' .. listLevel, ['or-list'] = ',<br/>\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
Summary:
Please note that all contributions to Modded Wiki are considered to be released under the Creative Commons Attribution-NonCommercial-ShareAlike (see
Wiki:Copyrights
for details). If you do not want your writing to be edited mercilessly and redistributed at will, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource.
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Template used on this page:
Module:Delimited tag/doc
(
edit
)
Navigation menu
Personal tools
Not logged in
Talk
Contributions
Create account
Log in
Namespaces
Module
Discussion
English
Views
Read
Edit source
View history
More
Refresh
Search
Navigation
Main page
Recent changes
Random page
Help about MediaWiki
Tools
What links here
Related changes
Special pages
Page information