|
@@ -1,11 +1,13 @@
|
|
|
import assert from 'node:assert/strict';
|
|
import assert from 'node:assert/strict';
|
|
|
-import fs from 'node:fs';
|
|
|
|
|
import { execFileSync } from 'node:child_process';
|
|
import { execFileSync } from 'node:child_process';
|
|
|
|
|
|
|
|
// The user's verified handoff is the preservation baseline for this body-only edit.
|
|
// The user's verified handoff is the preservation baseline for this body-only edit.
|
|
|
const baseline = '9cae31f7ac0c1ef41790436e0454757d79b7783d';
|
|
const baseline = '9cae31f7ac0c1ef41790436e0454757d79b7783d';
|
|
|
const before = JSON.parse(execFileSync('git', ['show', `${baseline}:src/content/blog/articles.json`], { encoding: 'utf8' }));
|
|
const before = JSON.parse(execFileSync('git', ['show', `${baseline}:src/content/blog/articles.json`], { encoding: 'utf8' }));
|
|
|
-const after = JSON.parse(fs.readFileSync('src/content/blog/articles.json', 'utf8'));
|
|
|
|
|
|
|
+// Preserve the accepted readability milestone; subsequent targeted source additions
|
|
|
|
|
+// are checked separately by check-blog-targeted-copy.mjs.
|
|
|
|
|
+const acceptedReadability = 'e84a62e17e2f4cbd985968d716361e3bbd6d0f87';
|
|
|
|
|
+const after = JSON.parse(execFileSync('git', ['show', `${acceptedReadability}:src/content/blog/articles.json`], { encoding: 'utf8' }));
|
|
|
const key = a => `${a.locale}/${a.id}`;
|
|
const key = a => `${a.locale}/${a.id}`;
|
|
|
const links = body => [...body.matchAll(/\]\(([^)\s]+)\)/g)].map(m => m[1]).sort();
|
|
const links = body => [...body.matchAll(/\]\(([^)\s]+)\)/g)].map(m => m[1]).sort();
|
|
|
const headings = body => (body.match(/^## /gm) || []).length;
|
|
const headings = body => (body.match(/^## /gm) || []).length;
|
|
@@ -28,5 +30,5 @@ for (const article of after) {
|
|
|
assert(!/<\/?(?:script|iframe|html|body)\b/i.test(body), 'Unsafe HTML');
|
|
assert(!/<\/?(?:script|iframe|html|body)\b/i.test(body), 'Unsafe HTML');
|
|
|
report.push({ article: key(article), changed: body !== oldBody, before: stats(oldBody), after: stats(body) });
|
|
report.push({ article: key(article), changed: body !== oldBody, before: stats(oldBody), after: stats(body) });
|
|
|
}
|
|
}
|
|
|
-console.log(JSON.stringify({ baseline, changedBodies: report.filter(a => a.changed).length, articles: report }, null, 2));
|
|
|
|
|
|
|
+console.log(JSON.stringify({ baseline, acceptedReadability, changedBodies: report.filter(a => a.changed).length, articles: report }, null, 2));
|
|
|
console.log('PASS: 21-article inventory, body-only scope, exact link occurrences and H2 boundaries. Readability statistics are descriptive; factual qualifiers require editorial review.');
|
|
console.log('PASS: 21-article inventory, body-only scope, exact link occurrences and H2 boundaries. Readability statistics are descriptive; factual qualifiers require editorial review.');
|