Module:Sandbox/Jackmcbarn

This is an old revision of this page, as edited by Jackmcbarn (talk | contribs) at 15:03, 8 June 2014 (headline generator). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

local p = {}

function p.main(frame)
	local parentTitle = frame:getParent():getTitle()
	if mw.title.getCurrentTitle().prefixedText == parentTitle then
		-- we're not being transcluded, so show the content normally
		return '== ' .. frame.args[1] .. ' =='
	else
		-- we're being transcluded, so show links to the sections
		return '#[[' .. parentTitle .. '#' .. frame.args[1] .. '|' .. frame.args[1] .. ']]'
	end
end

return p