enforce editorial problem cost opening
Build and deploy / deploy (push) Successful in 16s

This commit is contained in:
2026-07-31 17:16:27 +03:00
parent 681651f9e5
commit a25aac619c
+7
View File
@@ -85,6 +85,10 @@ for (const revision of revisions) {
const issues = []; const issues = [];
const content = revision.contentHtml || ''; const content = revision.contentHtml || '';
const body = bodyText(content); const body = bodyText(content);
const openingParagraphs = [...content.matchAll(/<p>([\s\S]*?)<\/p>/g)]
.slice(0, 2)
.map((match) => plainText(match[1]))
.join(' ');
const figures = [...content.matchAll(/<figure>([\s\S]*?)<\/figure>/g)].map((match) => match[1]); const figures = [...content.matchAll(/<figure>([\s\S]*?)<\/figure>/g)].map((match) => match[1]);
const imageSources = [...content.matchAll(/<img[^>]+src="([^"]+)"/g)].map((match) => match[1]); const imageSources = [...content.matchAll(/<img[^>]+src="([^"]+)"/g)].map((match) => match[1]);
const proseWithoutCode = content const proseWithoutCode = content
@@ -110,6 +114,9 @@ for (const revision of revisions) {
if (!/(проблем|ошиб|симптом|сбой|задач)/i.test(body.slice(0, 800))) { if (!/(проблем|ошиб|симптом|сбой|задач)/i.test(body.slice(0, 800))) {
issues.push('проблема не названа в начале текста'); issues.push('проблема не названа в начале текста');
} }
if (!/(цен[аы]|стоимост|издержк|затрат|потер|дороже|\bcost\b)/i.test(openingParagraphs)) {
issues.push('цена ошибки не названа в первых двух абзацах');
}
if (proseWithoutCode.includes('undefined') || proseWithoutCode.includes('[object Object]')) { if (proseWithoutCode.includes('undefined') || proseWithoutCode.includes('[object Object]')) {
issues.push('в тексте есть след генерации'); issues.push('в тексте есть след генерации');
} }