Module:Sidebar: Difference between revisions

391 bytes added ,  5 years ago
Created page with "-- -- This module implements {{Sidebar}} -- require('Module:No globals') local p = {} local getArgs = require('Module:Arguments').getArgs local navbar = require('Module:Navb..."
m (1 revision imported)
en>Centrist16
(Created page with "-- -- This module implements {{Sidebar}} -- require('Module:No globals') local p = {} local getArgs = require('Module:Arguments').getArgs local navbar = require('Module:Navb...")
Line 19:
else
return s
end
end
 
local function hasSubgroup(s)
if mw.ustring.find(s, 'vertical%-navbox%-subgroup') then
return true
else
return false
end
end
Line 29 ⟶ 37:
local child = args.child and mw.text.trim(args.child) == 'yes'
 
root = root:tag('table')
if not child then
root = root
:tag('table')
:addClass('vertical-navbox')
:addClass(args.wraplinks ~= 'true' and 'nowraplinks' or nil)
Line 90 ⟶ 98:
:wikitext(args.pretitle)
end
else
 
root
:addClass('vertical-navbox-subgroup')
:css('width', '100%')
:css('margin', '0px')
:css('border-spacing', '0px')
:addClass(args.bodyclass or args.class)
:cssText(args.bodystyle or args.style)
end
 
Line 97 ⟶ 112:
root
:wikitext(args.title)
:wikitext('</th></tr>') -- @todo replace this with unclosed again once mw.html gets it
else
root
Line 179 ⟶ 193:
:tag('td')
:addClass(args.contentclass)
:css('padding', hasSubgroup(content) and '0.1em 0 0.2em' or '0 0.1em 0.4em')
:cssText(args.contentstyle)
:cssText(args['content' .. num .. 'style'])
Line 218 ⟶ 232:
end
 
return tostring(root) .. (child and '[[Category:Pages using sidebar with the child parameter]]' or '')
end
 
Anonymous user