From 5efe47029e65a39eddacb3343474afbc45a561b4 Mon Sep 17 00:00:00 2001 From: Denis Seleznev Date: Mon, 25 Oct 2021 10:48:29 +0300 Subject: [PATCH 1/2] =?UTF-8?q?=D0=94=D0=BE=D1=80=D0=B0=D0=B1=D0=BE=D1=82?= =?UTF-8?q?=D0=BA=D0=B8=20=D0=BF=D1=80=D0=B0=D0=B2=D0=B8=D0=BB=D0=B0=20ru/?= =?UTF-8?q?punctuation/ano?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/RULES.en-US.md | 2 +- docs/RULES.ru.md | 2 +- docs/RULES_SORTED.en-US.md | 2 +- docs/RULES_SORTED.ru.md | 2 +- src/rules/ru/punctuation/ano.js | 8 ++++---- src/rules/ru/punctuation/ano.test.js | 20 ++++++++++++++++++++ 6 files changed, 28 insertions(+), 8 deletions(-) diff --git a/docs/RULES.en-US.md b/docs/RULES.en-US.md index 563ea391..678ca43a 100644 --- a/docs/RULES.en-US.md +++ b/docs/RULES.en-US.md @@ -94,7 +94,7 @@ | 90. | [ru/optalign/quote](../src/rules/ru/optalign/quote.js) | for opening quotation marks | 1010 | | | | 91. | [ru/other/accent](../src/rules/ru/other/accent.js) | Replacement capital letters to lowercase with addition of accent | 910 | | | | 92. | [ru/other/phone-number](../src/rules/ru/other/phone-number.js) | Formatting phone numbers | 910 | | ✓ | -| 93. | [ru/punctuation/ano](../src/rules/ru/punctuation/ano.js) | Placement of commas before “а” and “но” | 410 | hide-safe-tags-html | ✓ | +| 93. | [ru/punctuation/ano](../src/rules/ru/punctuation/ano.js) | Placement of commas before “а” and “но” | 410 | | ✓ | | 94. | [ru/punctuation/exclamation](../src/rules/ru/punctuation/exclamation.js) | !! → ! | 410 | | ✓ | | 95. | [ru/punctuation/exclamationQuestion](../src/rules/ru/punctuation/exclamationQuestion.js) | !? → ?! | 415 | | ✓ | | 96. | [ru/punctuation/hellipQuestion](../src/rules/ru/punctuation/hellipQuestion.js) | «?…» → «?..», «!…» → «!..», «…,» → «…» | 410 | | ✓ | diff --git a/docs/RULES.ru.md b/docs/RULES.ru.md index cafa7577..a39e88e0 100644 --- a/docs/RULES.ru.md +++ b/docs/RULES.ru.md @@ -94,7 +94,7 @@ | 90. | [ru/optalign/quote](../src/rules/ru/optalign/quote.js) | для открывающей кавычки | 1010 | | | | 91. | [ru/other/accent](../src/rules/ru/other/accent.js) | Замена заглавной буквы на строчную с добавлением ударения | 910 | | | | 92. | [ru/other/phone-number](../src/rules/ru/other/phone-number.js) | Форматирование телефонных номеров | 910 | | ✓ | -| 93. | [ru/punctuation/ano](../src/rules/ru/punctuation/ano.js) | Расстановка запятых перед «а» и «но» | 410 | hide-safe-tags-html | ✓ | +| 93. | [ru/punctuation/ano](../src/rules/ru/punctuation/ano.js) | Расстановка запятых перед «а» и «но» | 410 | | ✓ | | 94. | [ru/punctuation/exclamation](../src/rules/ru/punctuation/exclamation.js) | !! → ! | 410 | | ✓ | | 95. | [ru/punctuation/exclamationQuestion](../src/rules/ru/punctuation/exclamationQuestion.js) | !? → ?! | 415 | | ✓ | | 96. | [ru/punctuation/hellipQuestion](../src/rules/ru/punctuation/hellipQuestion.js) | «?…» → «?..», «!…» → «!..», «…,» → «…» | 410 | | ✓ | diff --git a/docs/RULES_SORTED.en-US.md b/docs/RULES_SORTED.en-US.md index 32d4dcb9..129a667e 100644 --- a/docs/RULES_SORTED.en-US.md +++ b/docs/RULES_SORTED.en-US.md @@ -47,7 +47,7 @@ | 43. | [common/punctuation/delDoublePunctuation](../src/rules/common/punctuation/delDoublePunctuation.js) | Removing double punctuation | 410 | | ✓ | | 44. | [common/punctuation/hellip](../src/rules/common/punctuation/hellip.js) | Replacement of three points by ellipsis | 410 | | ✓ | | 45. | [common/punctuation/quote](../src/rules/common/punctuation/quote.js) | Placement of quotation marks in texts | 410 | | ✓ | -| 46. | [ru/punctuation/ano](../src/rules/ru/punctuation/ano.js) | Placement of commas before “а” and “но” | 410 | hide-safe-tags-html | ✓ | +| 46. | [ru/punctuation/ano](../src/rules/ru/punctuation/ano.js) | Placement of commas before “а” and “но” | 410 | | ✓ | | 47. | [ru/punctuation/exclamation](../src/rules/ru/punctuation/exclamation.js) | !! → ! | 410 | | ✓ | | 48. | [ru/punctuation/hellipQuestion](../src/rules/ru/punctuation/hellipQuestion.js) | «?…» → «?..», «!…» → «!..», «…,» → «…» | 410 | | ✓ | | 49. | [common/punctuation/quoteLink](../src/rules/common/punctuation/quoteLink.js) | Removal quotes outside a link | 415 | show-safe-tags-html | ✓ | diff --git a/docs/RULES_SORTED.ru.md b/docs/RULES_SORTED.ru.md index b20e473f..2648cfa2 100644 --- a/docs/RULES_SORTED.ru.md +++ b/docs/RULES_SORTED.ru.md @@ -47,7 +47,7 @@ | 43. | [common/punctuation/delDoublePunctuation](../src/rules/common/punctuation/delDoublePunctuation.js) | Удаление двойной пунктуации | 410 | | ✓ | | 44. | [common/punctuation/hellip](../src/rules/common/punctuation/hellip.js) | Замена трёх точек на многоточие | 410 | | ✓ | | 45. | [common/punctuation/quote](../src/rules/common/punctuation/quote.js) | Расстановка кавычек правильного вида | 410 | | ✓ | -| 46. | [ru/punctuation/ano](../src/rules/ru/punctuation/ano.js) | Расстановка запятых перед «а» и «но» | 410 | hide-safe-tags-html | ✓ | +| 46. | [ru/punctuation/ano](../src/rules/ru/punctuation/ano.js) | Расстановка запятых перед «а» и «но» | 410 | | ✓ | | 47. | [ru/punctuation/exclamation](../src/rules/ru/punctuation/exclamation.js) | !! → ! | 410 | | ✓ | | 48. | [ru/punctuation/hellipQuestion](../src/rules/ru/punctuation/hellipQuestion.js) | «?…» → «?..», «!…» → «!..», «…,» → «…» | 410 | | ✓ | | 49. | [common/punctuation/quoteLink](../src/rules/common/punctuation/quoteLink.js) | Вынос кавычек за пределы ссылки | 415 | show-safe-tags-html | ✓ | diff --git a/src/rules/ru/punctuation/ano.js b/src/rules/ru/punctuation/ano.js index 95c78079..4f6cc4f1 100644 --- a/src/rules/ru/punctuation/ano.js +++ b/src/rules/ru/punctuation/ano.js @@ -1,10 +1,10 @@ +import { privateLabel } from '../../../consts'; + export default { name: 'ru/punctuation/ano', handler(text) { - const re = new RegExp('([^«„[(!?,:;\\-‒–—\\s])(\\s+)(а|но)(?= |\u00A0|\\n)', 'g'); + const re = new RegExp('([^«„[(!?,:;\\-‒–—\\s' + privateLabel + '])(\\s+)(а|но)(?= |\u00A0|\\n)', 'g'); return text.replace(re, '$1,$2$3'); - }, - // Запятая может идти после ссылки. - queue: 'hide-safe-tags-html' + } }; diff --git a/src/rules/ru/punctuation/ano.test.js b/src/rules/ru/punctuation/ano.test.js index cb1becc9..cc0b06a1 100644 --- a/src/rules/ru/punctuation/ano.test.js +++ b/src/rules/ru/punctuation/ano.test.js @@ -28,5 +28,25 @@ typografRuleTest(['ru/punctuation/ano', [ [ 'никто не отнимет то, что у тебя в голове ( а там может быть умиротворение и счастье)', 'никто не отнимет то, что у тебя в голове ( а там может быть умиротворение и счастье)', + ], + [ + 'Я пошёл домой,
а он остался.', + 'Я пошёл домой,
а он остался.' + ], + [ + 'Я пошёл домой,
а он остался.', + 'Я пошёл домой,
а он остался.' + ], + [ + 'Я пошёл домой, а он остался.', + 'Я пошёл домой, а он остался.' + ], + [ + '

а когда ты вернёшься, мы продолжим вместе

', + '

а когда ты вернёшься, мы продолжим вместе

' + ], + [ + 'Ссылка, а не ссылка', + 'Ссылка, а не ссылка' ] ]]); From 88ab7c7ecfcb608aa8a9650459535adcd6285a22 Mon Sep 17 00:00:00 2001 From: Denis Seleznev Date: Mon, 25 Oct 2021 10:52:08 +0300 Subject: [PATCH 2/2] =?UTF-8?q?=D0=9F=D0=BE=D0=B4=D0=BD=D1=8F=D1=82=D0=B8?= =?UTF-8?q?=D0=B5=20=D0=B2=D0=B5=D1=80=D1=81=D0=B8=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 3 +++ package-lock.json | 4 ++-- package.json | 2 +- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f00f4347..3702ca13 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,8 @@ # Changelog +# v6.12.2 +Доработки правила `ru/punctuation/ano` #389. + # v6.12.1 Доработки в правилах: - `common/nbsp/afterNumber` diff --git a/package-lock.json b/package-lock.json index 187f6131..49439d6d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "typograf", - "version": "6.12.1", + "version": "6.12.2", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "typograf", - "version": "6.12.1", + "version": "6.12.2", "license": "MIT", "devDependencies": { "@babel/core": "^7.15.8", diff --git a/package.json b/package.json index 840d294e..a4fc03d8 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "typograf", "description": "The client and server typography", - "version": "6.12.1", + "version": "6.12.2", "author": { "name": "Denis Seleznev", "email": "hcodes@yandex.ru",