Module:Outdent

local p = {} local getArgs = require('Module:Arguments').getArgs

function p.outdent (frame) local args = getArgs (frame) local count = 0 local Start = '┌' local End = '┘' local i = 0 local line = '' local outside = mw.html.create('span') local indentTable = {'reverse','indent','in','r'}                          -- lsit of parameters that mean reverse/indent for k,v in pairs(indentTable) do                                           -- set start and end if reversed if args[v] then Start = '└' End = '┐' end end if not args[1] then args[1] = '' end                                       -- un-nil args[1] for symbol in string.gmatch(args[1], ':' ) or string.gmatch(args[1], '*' ) do		count = count+1                                                        -- increase count for every : or * end if count == 0 then                                                         -- set args[1] to count if needed count = tonumber(args[1]) end if not count then count = 10                                                             -- 10 default end if count > 40 then count = 40                                                             -- 40 max end count = count * 1.6 -- 0.8                                                  -- convert to width while i < count do                                                         -- create line line = line..'───' i = i+1 end if args['test_line_width'] then                                            -- used to test line width before and after width reduction return count..' '..line..' '..' '..line..' ' end outside                                                                    -- create span tag :addClass('outdent-template') :css('display','block') :css('margin-top','-0.5em') :css('color','#AAA;') :wikitext(' '..Start..' ') -- start :wikitext(' '..line..' ') -- middle :wikitext(' '..End..' ') -- end if args[2] then local note = mw.html.create('span') note:wikitext('(outdent)&#32;') -- add (outdent) if needed return tostring(outside)..tostring(note) else return outside end end

return p