From a25aac619c142d4c50807e69d720ebe746cf4a43 Mon Sep 17 00:00:00 2001 From: "E.Gavrilov" Date: Fri, 31 Jul 2026 17:16:27 +0300 Subject: [PATCH] enforce editorial problem cost opening --- web/scripts/audit-editorial-draft.mjs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/web/scripts/audit-editorial-draft.mjs b/web/scripts/audit-editorial-draft.mjs index d3f929b..3ef2d32 100644 --- a/web/scripts/audit-editorial-draft.mjs +++ b/web/scripts/audit-editorial-draft.mjs @@ -85,6 +85,10 @@ for (const revision of revisions) { const issues = []; const content = revision.contentHtml || ''; const body = bodyText(content); + const openingParagraphs = [...content.matchAll(/

([\s\S]*?)<\/p>/g)] + .slice(0, 2) + .map((match) => plainText(match[1])) + .join(' '); const figures = [...content.matchAll(/

([\s\S]*?)<\/figure>/g)].map((match) => match[1]); const imageSources = [...content.matchAll(/]+src="([^"]+)"/g)].map((match) => match[1]); const proseWithoutCode = content @@ -110,6 +114,9 @@ for (const revision of revisions) { if (!/(проблем|ошиб|симптом|сбой|задач)/i.test(body.slice(0, 800))) { issues.push('проблема не названа в начале текста'); } + if (!/(цен[аы]|стоимост|издержк|затрат|потер|дороже|\bcost\b)/i.test(openingParagraphs)) { + issues.push('цена ошибки не названа в первых двух абзацах'); + } if (proseWithoutCode.includes('undefined') || proseWithoutCode.includes('[object Object]')) { issues.push('в тексте есть след генерации'); }