![]() |
VOOZH | about |
Implements {{Outdent}}
localp={} localgetArgs=require('Module:Arguments').getArgs functionp.outdent(frame) localargs=getArgs(frame) localwidth=0 args['r']=args['reverse']orargs['indent']orargs['r']orargs['in']-- aliases for reverse ifnotargs[1]thenargs[1]=''end-- un-nil args[1] width=width+select(2,string.gsub(args[1],':',''))-- increase by 1 for every : width=width+select(2,string.gsub(args[1],'*',''))-- increase by 1 for every * width=width+select(2,string.gsub(args[1],'#',''))*2-- increase by 2 for every # ifwidth==0thenwidth=tonumber(args[1])end-- set width to args[1] if needed ifnotwidththenwidth=10end-- default width ifwidth<0 then width=-width args['r']=notargs['r'] end ifwidth>40thenwidth=40end-- max width localtop='<span style="'..(width==0and''or'border-bottom: 1px solid var(--comment-border-color,#54595d);')..'border-'..((width==0orargs['r'])and'left'or'right')..': 1px solid var(--comment-border-color,#54595d);"></span>'-- top half localbottom='<span style="border-'..(args['r']and'right'or'left')..': 1px solid var(--comment-border-color,#54595d);"></span>'-- bottom half localnote=args[2]and'<span>([[wp:Indentation#Outdenting|outdent]]) </span>'or''-- note returnrequire('Module:TSLoader').call('Module:Outdent/styles.css')..'<div class="outdent-template" style="'..'width: calc((1em + 1px) * '..width..');">'..top..bottom..note..'</div>'; end returnp