14 lines
636 B
JavaScript
14 lines
636 B
JavaScript
const fs = require('fs');
|
|
const p = 'SKILL.md';
|
|
let c = fs.readFileSync(p, 'utf8');
|
|
const wm = 'Www.md';
|
|
// Remove all markdown link pollution around weekly-YYYY-[Www.md]
|
|
c = c.replace(/weekly-YYYY-\[Www\.md\]/g, 'weekly-YYYY-Www.md');
|
|
c = c.replace(/weekly-YYYY-\(?https?:\/\/Www\.md\)?/g, 'weekly-YYYY-Www.md');
|
|
c = c.replace(/weekly-YYYY-Www\.md(?!\.md)/g, 'weekly-YYYY-Www.md');
|
|
fs.writeFileSync(p, c);
|
|
const occ = c.match(/weekly-YYYY-[^\s\r\n`)]+/g);
|
|
console.log('occurrences:', occ);
|
|
console.log('---file excerpt---');
|
|
const lines = c.split('\n').filter(l => l.includes('weekly-YYYY'));
|
|
lines.forEach(l => console.log(l.trim())); |