Skip to content

Commit

Permalink
Merge 88ab7c7 into b665a8f
Browse files Browse the repository at this point in the history
  • Loading branch information
hcodes committed Oct 25, 2021
2 parents b665a8f + 88ab7c7 commit fcac39d
Show file tree
Hide file tree
Showing 9 changed files with 34 additions and 11 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
@@ -1,5 +1,8 @@
# Changelog

# v6.12.2
Доработки правила `ru/punctuation/ano` #389.

# v6.12.1
Доработки в правилах:
- `common/nbsp/afterNumber`
Expand Down
2 changes: 1 addition & 1 deletion docs/RULES.en-US.md
Expand Up @@ -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 | ||
Expand Down
2 changes: 1 addition & 1 deletion docs/RULES.ru.md
Expand Up @@ -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 | ||
Expand Down
2 changes: 1 addition & 1 deletion docs/RULES_SORTED.en-US.md
Expand Up @@ -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 ||
Expand Down
2 changes: 1 addition & 1 deletion docs/RULES_SORTED.ru.md
Expand Up @@ -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 ||
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion 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",
Expand Down
8 changes: 4 additions & 4 deletions 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'
}
};
20 changes: 20 additions & 0 deletions src/rules/ru/punctuation/ano.test.js
Expand Up @@ -28,5 +28,25 @@ typografRuleTest(['ru/punctuation/ano', [
[
'никто не отнимет то, что у тебя в голове ( а там может быть умиротворение и счастье)',
'никто не отнимет то, что у тебя в голове ( а там может быть умиротворение и счастье)',
],
[
'Я пошёл домой,<br> а он остался.',
'Я пошёл домой,<br> а он остался.'
],
[
'Я пошёл домой,<br>а он остался.',
'Я пошёл домой,<br>а он остался.'
],
[
'<em>Я пошёл домой,</em> а он остался.',
'<em>Я пошёл домой,</em> а он остался.'
],
[
'<p> а когда ты вернёшься, мы продолжим вместе</p>',
'<p> а когда ты вернёшься, мы продолжим вместе</p>'
],
[
'<a href="./">Ссылка</a>, а не ссылка',
'<a href="./">Ссылка</a>, а не ссылка'
]
]]);

0 comments on commit fcac39d

Please sign in to comment.