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(/]+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('в тексте есть след генерации');
}