Module:Snippet

local p = {}

-- Remove tags function p.stripRefs( text ) local newText = mw.ustring.gsub( mw.ustring.gsub( mw.text.unstrip( text ), '<[^>]*>[^<]*<\/[^>]*>',  ), '<\/?[^>]*>',  ) return newText end

function p.snippet( frame ) local text = mw.text.trim( frame.args[1] or '' ) if text == '' then return '' end

-- Get the first non-empty, non-Heading line local newText = '' for line in mw.text.gsplit( text, '\n' ) do		local lineTrimmed = mw.text.trim( line ) if lineTrimmed ~= '' and mw.ustring.match( lineTrimmed, '^==' ) == nil then newText = lineTrimmed end end

newText = mw.ustring.sub( p.stripRefs( newText ), 1, 250 )

return ' ' .. newText .. ' ' end

return p