Added highlighting of inserted text

This commit is contained in:
Martin Donnelly 2020-05-02 13:25:50 +01:00
parent 08c530a790
commit d4234d6011

View File

@ -136,6 +136,8 @@ class ChangeDetection extends Scraper {
async processItem(item) {
logger.debug(`Processing ${item.name}...`);
const insRegEx = /<ins>/g;
const now = new Date();
const filename = _.kebabCase(item.name);
const oldFile = `${this.path}/${filename}.html`;
@ -187,6 +189,8 @@ class ChangeDetection extends Scraper {
stats.levenshtein = levenshtein;
stats.since = time.since(new Date(stats.previousChange)).days();
stats.changed = stats.changed.replace(insRegEx, `<ins style="background-color: #ffff99;display:inline;">`);
await this._makeScreenshotV2(this.page, screenshotPath, null);
stats.diffPNG = await this.generateDiffScreenshotV2(stats.previousScreenshot.concat('.png'), screenshotPath.concat('.png'));