Module:Title

local p = {}

local w_frame = require( 'module:frame' ) local w_table = require( 'module:table' )

function titlePart( f, part ) local args  = w_frame.args( f ) local result = mw.title.getCurrentTitle[part] if w_table.contains( args, 'no disambig' ) then result = string.gsub( result, '%s+%b$', '' ) end return result end

function p.main( f ) return titlePart( f, 'text' ) end

function p.root( f ) return titlePart( f, 'rootText' ) end

function p.subpage( f ) return titlePart( f, 'subpageText' ) end

return p