/* Copyright (c) 2010, Yahoo! Inc. All rights reserved. Code licensed under the BSD License: http://developer.yahoo.com/yui/license.html version: 3.3.0 build: 3167 */ YUI.add('highlight-base',function(Y){var YArray=Y.Array,Escape=Y.Escape,WordBreak=Y.Text.WordBreak,isArray=Y.Lang.isArray,EMPTY_OBJECT={},UNCLOSED_ENTITY='(&[^;\\s]*)?',Highlight={_REGEX:UNCLOSED_ENTITY+'(%needles)',_REPLACER:function(match,p1,p2){return p1&&!(/\s/).test(p2)?match:Highlight._TEMPLATE.replace(/\{s\}/g,p2);},_START_REGEX:'^'+UNCLOSED_ENTITY+'(%needles)',_TEMPLATE:'{s}',all:function(haystack,needles,options){var i,len,regex,replacer;if(!options){options=EMPTY_OBJECT;} regex=options.startsWith?Highlight._START_REGEX:Highlight._REGEX;replacer=options.replacer||Highlight._REPLACER;needles=isArray(needles)?needles.concat():[needles];for(i=0,len=needles.length;i