Module:Su: Difference between revisions

m
1 revision imported from wikipedia:Module:Su
m (1 revision: What an ugly messy way to do this!)
m (1 revision imported from wikipedia:Module:Su)
 
(5 intermediate revisions by 4 users not shown)
Line 20:
local options = {
align = args.a,
fontSize = args.w,
lineHeight = args.lh,
verticalAlign = args.va
}
return p._main(sup, sub, options)
Line 33 ⟶ 35:
['display'] = 'inline-block',
['margin-bottom'] = '-0.3em',
['vertical-align'] = options.verticalAlign or sub and '-0.4em' or '0.8em',
['line-height'] = options.lineHeight or '1.2em',
}
if options.fontSize == 'f' or options.fontSize == 'fixed' then
span:css{
['font-family'] = 'monospace,courier',
['font-size'] = '8580%'
}
else
span:css('font-size', options.fontSize and options.fontSize or '8580%')
end
if options.align == 'r' or options.align == 'right' then
Line 54 ⟶ 56:
-- Add the wikitext.
span
:wikitexttag('sup')
:css('font-size', 'inherit')
:css('line-height', 'inherit')
:css('vertical-align', 'baseline')
:wikitext(sup)
:done()
:tag('br', {selfClosing = true}):done()
:wikitexttag('sub')
:css('font-size', 'inherit')
:css('line-height', 'inherit')
:css('vertical-align', 'baseline')
:wikitext(sub)
return tostring(span)