edit full article archive to publication standard
Build and deploy / deploy (push) Successful in 18s

This commit is contained in:
2026-07-31 23:08:19 +03:00
parent 440c8721dc
commit 7c5b19c960
28 changed files with 583 additions and 39 deletions
+6 -3
View File
@@ -2,6 +2,7 @@ import { access, readFile } from 'node:fs/promises';
import { join } from 'node:path';
import { fileURLToPath } from 'node:url';
import { editorialRevisions } from '../data/editorial-revisions.mjs';
import { cleanReaderHtml } from '../lib/editorial-content.mjs';
const webRoot = join(fileURLToPath(new URL('..', import.meta.url)));
const articlesPath = join(webRoot, 'data', 'articles.json');
@@ -14,12 +15,14 @@ const archive = archivedArticles.map((article) => ({
...revisionBySlug.get(article.slug),
}));
const requestedSlugs = process.argv.slice(2);
const slugs = requestedSlugs.includes('--all-editorial')
const slugs = requestedSlugs.includes('--all-articles')
? archive.map((article) => article.slug)
: requestedSlugs.includes('--all-editorial')
? archive.filter((article) => article.slug.startsWith('editorial-')).map((article) => article.slug)
: requestedSlugs;
if (slugs.length === 0) {
throw new Error('Usage: node scripts/audit-quality-batch.mjs <article-slug> [...slug] | --all-editorial');
throw new Error('Usage: node scripts/audit-quality-batch.mjs <article-slug> [...slug] | --all-editorial | --all-articles');
}
const genericPhrases = [
'У этой модели нет магической силы',
@@ -77,7 +80,7 @@ for (const slug of slugs) {
continue;
}
const content = article.contentHtml;
const content = cleanReaderHtml(article.contentHtml);
const body = bodyText(content);
const imageSources = [...content.matchAll(/<img[^>]+src="([^"]+)"/g)].map((match) => match[1]);
const figures = [...content.matchAll(/<figure>([\s\S]*?)<\/figure>/g)].map((match) => match[1]);