Jump to content
 







Main menu
   


Navigation  



Main page
Contents
Current events
Random article
About Wikipedia
Contact us
Donate
 




Contribute  



Help
Learn to edit
Community portal
Recent changes
Upload file
 








Search  

































Create account

Log in
 









Create account
 Log in
 




Pages for logged out editors learn more  



Contributions
Talk
 



















Contents

   



(Top)
 


1 See also  














Module:Outdent






Azərbaycanca
تۆرکجه

Беларуская
Eesti
فارسی
Gaeilge

Kurdî
Lietuvių
Norsk bokmål
Português
Русский
Slovenščina
Српски / srpski
 
Tiếng Vit

 

Edit links
 









Module
Talk
 

















Read
View source
View history
 








Tools
   


Actions  



Read
View source
View history
 




General  



What links here
Related changes
Upload file
Special pages
Permanent link
Page information
Get shortened URL
Download QR code
Wikidata item
 




Print/export  



Download as PDF
Printable version
 




In other projects  



Wikimedia Commons
Wikispecies
Wikiversity
 
















Appearance
   

 





Permanently protected module

From Wikipedia, the free encyclopedia
 


See also

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]])&#32;</span>' or '' -- note
 
 return '<div class="outdent-template" style="position:relative;left:1px;">' .. top .. bottom .. note .. '</div>';
end

return p

Retrieved from "https://en.wikipedia.org/w/index.php?title=Module:Outdent&oldid=1045125078"

Hidden category: 
Wikipedia template-protected modules
 



This page was last edited on 18 September 2021, at 23:44 (UTC).

Text is available under the Creative Commons Attribution-ShareAlike License 4.0; additional terms may apply. By using this site, you agree to the Terms of Use and Privacy Policy. Wikipedia® is a registered trademark of the Wikimedia Foundation, Inc., a non-profit organization.



Privacy policy

About Wikipedia

Disclaimers

Contact Wikipedia

Code of Conduct

Developers

Statistics

Cookie statement

Mobile view



Wikimedia Foundation
Powered by MediaWiki