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.
Anti-spam check. Do
not
fill this in!
local p = {} local getArgs = require('Module:Arguments').getArgs function p.outdent (frame) local args = getArgs(frame) local width = 0 local reversed = 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] 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 # 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 width < 0 then width = -width reversed = not reversed end if width > 40 then width = 40 end -- max 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 bottom = '<span style="display:block;width:' .. width .. 'em;height:0.5em;border-' .. (reversed and 'right' or 'left') .. ':1px solid #a2a9b1;"></span>' -- bottom half local note = args[2] and '<span>([[Wikipedia:Indentation#Outdenting|outdent]]) </span>' or '' -- note return '<div class="outdent-template" style="position:relative;left:1px;">' .. top .. bottom .. note .. '</div>'; end return p
Edit summary
(Briefly describe your changes)
Please note that all contributions to A2wiki may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, 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 (see
A2wiki:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Template used on this page:
Module:Outdent/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
Search
Navigation
Main page
Current events
Random page
About A2wiki
interaction
Help
Community portal
Recent changes
Upload file
Tools
What links here
Related changes
Special pages
Page information