Module:Sandbox/Jackmcbarn: Difference between revisions

Content deleted Content added
Jackmcbarn (talk | contribs)
add a second return value
Jackmcbarn (talk | contribs)
act like a template
Line 2:
 
function p.main(frame)
local parentTitle =return frame:getParent():getTitlepreprocess(mw.title.new(frame.args[1]):getContent())
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