Changes
		
		
		
		
		
		
		Jump to navigation
		Jump to search
		
 require('Module:No globals') 
 local getArgs = require('Module:Arguments').getArgs
 
local function _sidebarp.sidebar(frame, args)	if not args then		args = getArgs(frame)	end
	
	
	
			
			
		
		
			
	
		
	
	
			
					
		return _sidebarp.sidebar(args)end					  function makeWrapper(func)	return function(frame)		if not getArgs then			getArgs = require('Module:Arguments').getArgs		end		return func(getArgs(frame))	end
		
		
		
		
		
		
		
	
fix incorrect navbars, and other minor fixes from sandbox
-- This module implements {{Sidebar}}
--
local p = {}
local HtmlBuilder = require('Module:HtmlBuilder')
local navbar = require('Module:Navbar')._navbar
local function trimAndAddAutomaticNewline(s)
	-- For compatibility with the original {{sidebar with collapsible lists}} 
	-- implementation, which passed some parameters through {{#if}} to trim
	-- their whitespace. This also triggered the automatic newline behavior.
end
	local root = HtmlBuilder.create()
	local child = args.child and mw.text.trim(args.child) == 'yes'
	if not child then
		root = root
			.css('font-size', '88%')
			.cssText(args.bodystyle or args.style)
		if args.outertitle then
			root
					.wikitext(args.outertitle)
		end
		if args.topimage then
			local imageCell = root.tag('tr').tag('td')
			imageCell
				.addClass(args.topimageclass)
				.cssText(args.topimagestyle)
				.wikitext(args.topimage)
			if args.topcaption then
				imageCell
			end
		end
		if args.pretitle then
			root
	if args.image then
		local imageCell = root.tag('tr').tag('td')
		imageCell
			.addClass(args.imageclass)
			.cssText(args.imagestyle)
			.wikitext(args.image)
		if args.caption then
			imageCell
		end
	end
	if args.above then
		root
					.css('font-weight', 'bold')
					.cssText(args.abovestyle)
					.newline()	  -- newline required for bullet-points to work
					.wikitext(args.above)
	end
						.wikitext(heading)
		end
		local content = args['content' .. num]
		if content then
						.wikitext(content)
						.done()
					.newline()  -- Without a linebreak after the </td>, a nested list like "* {{hlist| ...}}" doesn't parse correctly.
		end
	end
	if not child then
		local navbarArg = args.navbar or args.tnavbar
		if navbarArg ~= 'none' and navbarArg ~= 'off' and (args.name or frame:getParent():getTitle():gsub('/sandbox$', '') ~= 'Template:Sidebar') then
			root
				.tag('tr')
end
function _collapsibleSidebarp.collapsibleSidebar(frame)	local args= getArgs(frame) 
	args.abovestyle = 'border-top: 1px solid #aaa; border-bottom: 1px solid #aaa;' .. (args.abovestyle or '')
	args.belowstyle = 'border-top: 1px solid #aaa; border-bottom: 1px solid #aaa;' .. (args.belowstyle or '')
	args.navbarstyle = 'padding-top: 0.6em;' .. (args.navbarstyle or args.tnavbarstyle or '')
	local contentArgs = {}
	for k, v in pairs(args) do
		local num = ('' .string. k):match(k, '^list(%d+)$')		if num then 
			local expand = args.expanded and (args.expanded == 'all' or args.expanded == args['list' .. num .. 'name'])
			local row = HtmlBuilder.create('div')
			row
					.cssText(args['list' .. num .. 'style'])
					.wikitext(trimAndAddAutomaticNewline(args['list' .. num]))
			contentArgs['content' .. num] = tostring(row)
		end
		args[k] = v
	end
end
return {	sidebar = makeWrapper(_sidebar),	collapsible = makeWrapper(_collapsibleSidebar)}p