Editing Module:Outdent

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.

The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then publish the changes below to finish undoing the edit.

Latest revision Your text
Line 6: Line 6:
local width = 0
local width = 0
local reversed = args['reverse'] or args['indent'] or args['r'] or args['in'] -- aliases for reverse
args['r'] = args['reverse'] or args['indent'] or args['r'] or args['in'] -- aliases for reverse
if not args[1] then args[1] = '' end                                        -- un-nil args[1]
if not args[1] then args[1] = '' end                                        -- un-nil args[1]
Line 14: Line 14:
if width == 0 then width = tonumber(args[1]) end -- set width to args[1] if needed
if width == 0 then width = tonumber(args[1]) end -- set width to args[1] if needed
 
if not width then width = 10 end -- default width
if not width then width = 10 end -- default width
if width < 0
if width < 0
then
then
width = -width
width = -width
reversed = not reversed
args['r'] = not args['r']
end
end
if width > 40 then width = 40 end -- max width
if width > 40 then width = 40 end -- max width
Line 25: Line 25:
width = width * 1.6 -- set width to proper width
width = width * 1.6 -- set width to proper width
local top = '<span style="display:block;width:' .. width .. 'em;height:0.5em;' .. (width == 0 and '' or 'border-bottom:1px solid #a2a9b1;') .. 'border-' .. ((width == 0 or reversed) and 'left' or 'right') ..':1px solid #a2a9b1;"></span>' -- top half
local top = '<span style="display:block;width:' .. width .. 'em;height:0.5em;' .. (width == 0 and '' or 'border-bottom:1px solid #AAA;') .. 'border-' .. ((width == 0 or args['r']) and 'left' or 'right') ..':1px solid #AAA;"></span>' -- top half
local bottom = '<span style="display:block;width:' .. width .. 'em;height:0.5em;border-' .. (reversed and 'right' or 'left') .. ':1px solid #a2a9b1;"></span>' -- bottom half
local bottom = '<span style="display:block;width:' .. width .. 'em;height:0.5em;border-' .. (args['r'] and 'right' or 'left') .. ':1px solid #AAA;"></span>' -- bottom half
local note = args[2] and '<span>([[Wikipedia:Indentation#Outdenting|outdent]])&#32;</span>' or '' -- note
local note = args[2] and '<span>([[Wikipedia:Indentation|giảm lề]])&#32;</span>' or '' -- note
return '<div class="outdent-template" style="position:relative;left:1px;">' .. top .. bottom .. note .. '</div>';
return '<div class="outdent-template" style="position:relative;left:1px;">' .. top .. bottom .. note .. '</div>';
Cancel Editing help (opens in new window)

  [] · [[]] · [[|]] · {{}} · · “” ‘’ «» ‹› „“ ‚‘ · ~ | ° &nbsp; · ± × ÷ ² ³ ½ · §
     [[Category:]] · [[:File:]] · [[Special:MyLanguage/]] · Special:MyLanguage/ · <code></code> · <nowiki></nowiki> <code><nowiki></nowiki></code> · <syntaxhighlight lang="php"></syntaxhighlight> · <includeonly></includeonly> · <noinclude></noinclude> · #REDIRECT[[]] · <translate></translate> · <languages/> · {{#translation:}} · <tvar name=1></tvar> · {{DEFAULTSORT:}} · <s></s>

Template used on this page: