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
 

















Module:Gaps






تۆرکجه
Беларуская (тарашкевіца)

Dansk
فارسی
Føroyskt


Ilokano

Kurdî






Português
Scots
Simple English
Српски / 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  



Wikiversity
 
















Appearance
   

 





Permanently protected module

From Wikipedia, the free encyclopedia
 


local p = {}

local getArgs

function p.main(frame)
 if not getArgs then
  getArgs = require('Module:Arguments').getArgs
 end
 local args = getArgs(frame, {wrappers = 'Template:Gaps'})

 local ret = mw.html.create('span')
  :css({['white-space'] = 'nowrap',
    ['font-size'] = args.size})

 if args.lhs then
  ret:wikitext(args.lhs .. ' = ')
 end

 local gap = string.lower(args.gap or '')
 
 local gapSize, gapUnit = string.match(gap,'([%d%.]+)%s*([ep][mnx])')
 
 local acceptedUnits = { em = 'em', en = 'en', px = 'px' }
 
 gapUnit = acceptedUnits[gapUnit]
 
 if gapSize and gapUnit then
  gap = gapSize..gapUnit
 else
  gap = '0.25em'
 end
 
 for k,v in ipairs(args) do
  if k == 1 then
   ret:wikitext(v)
  else
   ret:tag('span')
    :css('margin-left',gap)
    :wikitext(v)
  end
 end

 if args.e then
  ret
   :tag('span')
    :css({['margin-left'] = '0.27em',
      ['margin-right']= '0.27em'})
    :wikitext('×')
   :done()
   :wikitext(args.base or '10')
   :tag('span')
    :css('display','none')
    :wikitext('^')
   :done()
   :tag('sup')
    -- the double parentheses here are not redundant.
    -- they keep the second return value from being passed
    :wikitext((mw.ustring.gsub(args.e,'-','−')))
   :done()
 end

 if args.u then
  ret:wikitext(' ' .. args.u)
 end

 return ret
end

return p

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

Hidden category: 
Wikipedia semi-protected modules
 



This page was last edited on 24 January 2019, at 21:24 (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