Jump to content

Module:Transcludable section

Permanently protected module
From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Frietjes (talk | contribs) at 17:20, 11 April 2019 (for use with module:sports table and module:sports results). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.
(diff) ← Previous revision | Latest revision (diff) | Newer revision → (diff)

-- Module to create selectively transcluded sections using syntax which is
-- compatible with [[Module:Sports table]] and [[Module:Sports results]]

require('Module:No globals')

local p = {}

-- Main function
function p.main(frame)
	-- Declare locals
	local tsection = frame:getParent().args['transcludesection'] or ''
	local bsection = frame.args['section'] or frame.args['1'] or ''

	-- Exit early if we are using section transclusion for a different section
	if( tsection ~= '' and bsection ~= '' ) then
		if( tsection ~= bsection ) then
			return ''
		end
	end
	
	return frame.args['text'] or ''
end
 
return p