Changes
		
		
		
		
		
		
		Jump to navigation
		Jump to search
		
 
 
                    
                -- Apply automatic newlines ([[meta:Help:Newlines and spaces#Automatic newline]]) to
                -- simulate template behavior.
                if mw.ustring.find(v, '^[#*:;]') or mw.ustring.find(v, '^{|') then
                    v = '\n' .. v
                end
		
		
		
		
		
		
		
	
correct handling of automatic newlines
local Navbar = require('Module: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.
    -- ([[meta:Help:Newlines and spaces#Automatic newline]])
    s = mw.ustring.gsub(s, "^%s*(.-)%s*$", "%1")
    if mw.ustring.find(s, '^[#*:;]') or mw.ustring.find(s, '^{|') then
        return '\n' .. s
    else
        return s
    end
end
local function _sidebar(args)
    local root = HtmlBuilder.create('table')
                    .cssText(args.listtitlestyle)
                    .cssText(args['list' .. num .. 'titlestyle'])
                    .wikitext(trimAndAddAutomaticNewline(args['list' .. num .. 'title'] or 'List'))
                    .done()
                .tag('div')
                    .cssText(args.liststyle)
                    .cssText(args['list' .. num .. 'style'])
                    .wikitext(trimAndAddAutomaticNewline(args['list' .. num]))
            contentArgs['content' .. num] = tostring(row)
        for k, v in pairs(origArgs) do
            if v ~= '' then
                args[k] = v
            end