Module:Sandbox/N8wilson/Section

-- Module to create selectively transcluded sections

require('strict')

local p = {}

-- create a LST section by wrapping "body" with and tags function p.create_wrapped(frame) local sectionlabel  = frame.args['label'] or frame.args['1'] or '' local sectioncontent = frame.args['body'] or frame.args['2'] or ''

-- If no label return text without section wrapping if( sectionlabel == '' ) then return sectioncontent end

local base = mw.html.create base = base:tag('span') base:tag('section', {selfClosing=true}) :attr('begin', sectionlabel)

base:wikitext(sectioncontent)

base:tag('br', {selfClosing=true}) base:tag('section', {selfClosing=true}) :attr('end', sectionlabel)

base = base:done return base end

return p