imported>Legoktm Replace Module:No globals with require( "strict" ) |
(No difference)
|
Latest revision as of 20:58, 23 October 2022
Documentation for this module may be created at Module:Sandbox/N8wilson/Section/doc
-- Module to create selectively transcluded sections
require('strict')
local p = {}
-- create a LST section by wrapping "body" with <section begin= /> and <section end= /> 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