File tree Expand file tree Collapse file tree 1 file changed +14
-6
lines changed Expand file tree Collapse file tree 1 file changed +14
-6
lines changed Original file line number Diff line number Diff line change @@ -359,12 +359,20 @@ exports.stripTagsInFile = function (obj) {
359359
360360 for ( i = 0 ; i < patterns . length ; i += 1 ) {
361361 var currentPattern = patterns [ i ] ;
362- var index = currentPattern . indexOf ( obj . string ) ;
363- var replacedTag = this . replaceWith ( {
364- string : currentPattern ,
365- index : index ,
366- replacement : ''
367- } ) ;
362+ var replacedTag ;
363+
364+ if ( obj . replace ) {
365+ replacedTag = ( typeof obj . replace === 'function' ) ? obj . replace ( currentPattern ) : obj . replace ;
366+ }
367+ else {
368+ var index = currentPattern . indexOf ( obj . string ) ;
369+
370+ replacedTag = this . replaceWith ( {
371+ string : currentPattern ,
372+ index : index ,
373+ replacement : ''
374+ } ) ;
375+ }
368376
369377 if ( replacedData ) {
370378 replacedData = replacedData . replace ( currentPattern , replacedTag ) ;
You can’t perform that action at this time.
0 commit comments