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

24 lines
549 B
TypeScript
Raw Normal View History

2025-03-08 12:22:18 +00:00
2025-03-08 08:16:54 +00:00
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;
}
2025-03-08 12:22:18 +00:00
/*replaceFile( filePath:string, suffix:string = ".replaced.html")
2025-03-08 08:16:54 +00:00
{
let newFilePath = filePath + suffix;
let text = Files.loadUTF8( filePath );
let replacedText = this.process( text );
Files.saveUTF8( newFilePath, replacedText );
2025-03-08 12:22:18 +00:00
}*/
2025-03-08 08:16:54 +00:00
}