library-ts/browser/text/replacing/TextReplacementProcessor.ts

24 lines
549 B
TypeScript

import { TextReplacer } from "./TextReplacer";
export class TextReplacementProcessor
{
replacers:TextReplacer[] = [];
process( source:string ):string
{
let text = source;
this.replacers.forEach( r => text = r.process( text ) );
return text;
}
/*replaceFile( filePath:string, suffix:string = ".replaced.html")
{
let newFilePath = filePath + suffix;
let text = Files.loadUTF8( filePath );
let replacedText = this.process( text );
Files.saveUTF8( newFilePath, replacedText );
}*/
}