rename Ox.highlightHTML to Ox.highlight
This commit is contained in:
parent
ce3c5a4a03
commit
90147a69fb
1 changed files with 11 additions and 12 deletions
|
@ -226,32 +226,32 @@
|
|||
};
|
||||
|
||||
/*@
|
||||
Ox.highlightHTML <f> Highlight matches in string
|
||||
Ox.highlight <f> Highlight matches in string
|
||||
(string, query, classname[, isHTML]) -> Output string
|
||||
string <s> Input string
|
||||
query <r|s> Case-insentitive query string, or regular expression
|
||||
classname <s> Class name for matches
|
||||
isHTML <b|false> If true, the input string is treated as HTML
|
||||
> Ox.highlightHTML('<name>', 'name', 'c')
|
||||
> Ox.highlight('<name>', 'name', 'c')
|
||||
'<<span class="c">name</span>>'
|
||||
> Ox.highlightHTML('<span class="name">name</span>', 'name', 'c', true)
|
||||
> Ox.highlight('<span class="name">name</span>', 'name', 'c', true)
|
||||
'<span class="name"><span class="c">name</span></span>'
|
||||
> Ox.highlightHTML('amp & amp', 'amp', 'c', true)
|
||||
> Ox.highlight('amp & amp', 'amp', 'c', true)
|
||||
'<span class="c">amp</span> & <span class="c">amp</span>'
|
||||
> Ox.highlightHTML('amp & amp', 'amp & amp', 'c', true)
|
||||
> Ox.highlight('amp & amp', 'amp & amp', 'c', true)
|
||||
'<span class="c">amp & amp</span>'
|
||||
> Ox.highlightHTML('<b><b></b>', '<b>', 'c', true)
|
||||
> Ox.highlight('<b><b></b>', '<b>', 'c', true)
|
||||
'<span class="c"><b><b></b></span>'
|
||||
> Ox.highlightHTML('<b><b></b>', '<b>', 'c', true)
|
||||
> Ox.highlight('<b><b></b>', '<b>', 'c', true)
|
||||
'<b><b></b>'
|
||||
> Ox.highlightHTML('foo<b>bar</b>baz', 'foobar', 'c', true)
|
||||
> Ox.highlight('foo<b>bar</b>baz', 'foobar', 'c', true)
|
||||
'<span class="c">foo<b>bar</b></span>baz'
|
||||
> Ox.highlightHTML('foo<p>bar</p>baz', 'foobar', 'c', true)
|
||||
> Ox.highlight('foo<p>bar</p>baz', 'foobar', 'c', true)
|
||||
'foo<p>bar</p>baz'
|
||||
> Ox.highlightHTML('foo <br/>bar baz', 'foo bar', 'c', true)
|
||||
> Ox.highlight('foo <br/>bar baz', 'foo bar', 'c', true)
|
||||
'<span class="c">foo <br>bar</span> baz'
|
||||
@*/
|
||||
Ox.highlightHTML = function(string, query, classname, isHTML) {
|
||||
Ox.highlight = function(string, query, classname, isHTML) {
|
||||
var cursor = 0,
|
||||
entities = [],
|
||||
matches = [],
|
||||
|
@ -322,7 +322,6 @@
|
|||
span.join(match.value)
|
||||
);
|
||||
});
|
||||
|
||||
} else {
|
||||
string = string.replace(re, function(value) {
|
||||
return span.join(value);
|
||||
|
|
Loading…
Reference in a new issue