FANDOM


m
(just in case...)
 
Line 23: Line 23:
 
end
 
end
   
newText = mw.ustring.sub( p.stripRefs( newText ), 1, 250 )
+
newText = mw.ustring.sub( p.stripRefs( newText ), 1, 300 )
   
 
return '<span style="display: none;">' .. newText .. '</span>'
 
return '<span style="display: none;">' .. newText .. '</span>'

Latest revision as of 19:56, July 3, 2014

local p = {}
 
-- Remove <ref></ref> 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
			break
		end
	end
 
	newText = mw.ustring.sub( p.stripRefs( newText ), 1, 300 )
 
	return '<span style="display: none;">' .. newText .. '</span>'
end
 
return p
Community content is available under CC-BY-SA unless otherwise noted.