This commit is contained in:
@@ -82,7 +82,7 @@ for (const slug of slugs) {
|
||||
|
||||
const content = cleanReaderHtml(article.contentHtml);
|
||||
const body = bodyText(content);
|
||||
const imageSources = [...content.matchAll(/<img[^>]+src="([^"]+)"/g)].map((match) => match[1]);
|
||||
const imageSources = [...content.matchAll(/<img[^>]+\bsrc=(['"])(.*?)\1/gi)].map((match) => match[2]);
|
||||
const figures = [...content.matchAll(/<figure>([\s\S]*?)<\/figure>/g)].map((match) => match[1]);
|
||||
|
||||
if (article.readingMinutes < 8) issues.push('указано меньше 8 минут чтения');
|
||||
@@ -98,7 +98,7 @@ for (const slug of slugs) {
|
||||
if (count(content, /<table>/g) < 1 || count(content, /<thead>/g) < 1) issues.push('нет доступной таблицы');
|
||||
if (count(content, /<pre><code>/g) < 1) issues.push('нет воспроизводимого примера');
|
||||
if (count(content, /<ol>/g) < 1) issues.push('нет последовательности проверки или действий');
|
||||
if (count(content, /<a href="https?:\/\//g) < 2) issues.push('меньше двух внешних источников');
|
||||
if (count(content, /<a\b[^>]*\bhref=(['"])https?:\/\/[^'"]+\1/gi) < 2) issues.push('меньше двух внешних источников');
|
||||
if (!content.includes('<h2>Проверяемые источники</h2>')) issues.push('нет отдельного раздела с источниками');
|
||||
const proseWithoutCode = content
|
||||
.replace(/<pre><code>[\s\S]*?<\/code><\/pre>/g, '')
|
||||
@@ -114,8 +114,8 @@ for (const slug of slugs) {
|
||||
|
||||
for (const figure of figures) {
|
||||
const image = figure.match(/<img\b[^>]*>/);
|
||||
const alt = image?.[0].match(/\balt="([^"]*)"/);
|
||||
if (!image || !alt || alt[1].trim() === '') {
|
||||
const alt = image?.[0].match(/\balt=(['"])(.*?)\1/i);
|
||||
if (!image || !alt || alt[2].trim() === '') {
|
||||
issues.push('у рисунка нет содержательного alt-текста');
|
||||
break;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user