Skip to content

Commit

Permalink
Добавить исключение: про то #83
Browse files Browse the repository at this point in the history
  • Loading branch information
hcodes committed Feb 12, 2015
1 parent d0aa51a commit db8222c
Show file tree
Hide file tree
Showing 16 changed files with 384 additions and 245 deletions.
34 changes: 26 additions & 8 deletions dist/typograf.js
Original file line number Diff line number Diff line change
Expand Up @@ -1120,17 +1120,23 @@ Typograf.rule({
}
});

Typograf.rule({
name: 'ru/dash/kade',
sortIndex: 31,
func: function(text) {
var re = new RegExp('([a-яё]+)( | ?- ?)(ка|де|кась)' + this.data('ru/dash').after, 'g');
return text.replace(re, '$1-$3$4');
}
});

Typograf.rule({
name: 'ru/dash/koe',
sortIndex: 38,
func: function(text) {
var ruDash = this.data('ru/dash'),
re = new RegExp(ruDash.before + '(К|к)ое\\s([а-яё]{3,})' + ruDash.after, 'g'),
re2 = new RegExp(ruDash.before + '(К|к)ой\\s([а-яё]{3,})' + ruDash.after, 'g');
re = new RegExp(ruDash.before + '([Кк]о[ей])\\s([а-яё]{3,})' + ruDash.after, 'g');

return text
.replace(re, '$1$2ое-$3$4')
.replace(re2, '$1$2ой-$3$4');
return text.replace(re, '$1$2-$3$4');
}
});

Expand Down Expand Up @@ -1170,22 +1176,34 @@ Typograf.rule({
name: 'ru/dash/taki',
sortIndex: 39,
func: function(text) {
var re = new RegExp('(верно|довольно|опять|прямо|так|всё|действительно|неужели)\\s(таки)' +
var re = new RegExp('(верно|довольно|опять|прямо|так|вс[её]|действительно|неужели)\\s(таки)' +
this.data('ru/dash').after, 'g');

return text.replace(re, '$1-$2$3');
}
});

(function() {

var words = [
'откуда', 'куда', 'где',
'когда', 'зачем', 'почему',
'как', 'како[ейм]', 'какая', 'каки[емх]', 'какими', 'какую',
'что', 'чего', 'че[йм]', 'чьим?',
'кто', 'кого', 'кому', 'кем'
];

Typograf.rule({
name: 'ru/dash/to',
sortIndex: 30,
func: function(text) {
var re = new RegExp('( | ?- ?)(то|либо|нибудь|ка|де|кась)' + this.data('ru/dash').after, 'g');
return text.replace(re, '-$2$3');
var re = new RegExp('(' + words.join('|') + ')( | ?- ?)(то|либо|нибудь)' + this.data('ru/dash').after, 'gi');
return text.replace(re, '$1-$3$4');
}
});

})();

Typograf.rule({
name: 'ru/dash/weekday',
sortIndex: 600,
Expand Down
2 changes: 1 addition & 1 deletion dist/typograf.min.js

Large diffs are not rendered by default.

182 changes: 113 additions & 69 deletions dist/typograf.titles.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,39 @@ Typograf.prototype.titles = {
"en": "Placement of links",
"ru": "Расстановка ссылок"
},
"common/number/fraction": {
"common": "1/2 → ½, 1/4 → ¼, 3/3 → ¾"
},
"common/number/plusMinus": {
"common": "+- → ±"
},
"common/number/times": {
"common": "x → × (10 x 5 → 10×5)"
},
"common/nbsp/afterNumber": {
"en": "Non-breaking space between number and word",
"ru": "Нераз. пробел между числом и словом"
},
"common/nbsp/afterPara": {
"en": "Non-breaking space after §",
"ru": "Нераз. пробел после §"
},
"common/nbsp/afterShortWord": {
"en": "Non-breaking space after short word",
"ru": "Нераз. пробел после короткого слова"
},
"common/nbsp/beforeShortLastWord": {
"en": "Non-breaking space before last short word in sentence",
"ru": "Нераз. пробел перед последним коротким словом в предложении"
},
"common/nbsp/dpi": {
"en": "Non-breaking space before lpi, dpi",
"ru": "Нераз. пробел перед lpi, dpi"
},
"common/nbsp/nowrap": {
"en": "Replace non-breaking space to normal space in tags nowrap and nobr",
"ru": "Заменять нераз. пробел на обычный пробел в тегах nowrap и nobr"
},
"common/other/repeatWord": {
"en": "Removing repeat words",
"ru": "Удаление повтора слова"
Expand All @@ -41,6 +74,46 @@ Typograf.prototype.titles = {
"en": "Three points on ellipsis",
"ru": "Три точки на троеточие"
},
"common/space/afterPunctuation": {
"en": "space after punctuation",
"ru": "Пробел после знаков пунктуации"
},
"common/space/delBeforePercent": {
"en": "Remove space before %, ‰ and ‱",
"ru": "Удаление пробела перед %, ‰ и ‱"
},
"common/space/delBeforePunctuation": {
"en": "Remove spaces before punctuation",
"ru": "Удаление пробелов перед знаками пунктуации"
},
"common/space/delLeadingBlanks": {
"en": "Remove spaces at start of line",
"ru": "Удаление пробелов в начале строки"
},
"common/space/delRepeatN": {
"en": "Remove duplicate line breaks (no more than two)",
"ru": "Удаление повторяющихся переносов строки (не более двух)"
},
"common/space/delRepeatSpace": {
"en": "Removing duplicate spaces between characters",
"ru": "Удаление повторяющихся пробелов между символами"
},
"common/space/delTrailingBlanks": {
"en": "Remove spaces at end of line",
"ru": "Удаление пробелов в конце строки"
},
"common/space/replaceTab": {
"en": "Replacement of tab to 4 spaces",
"ru": "Замена таба на 4 пробела"
},
"common/space/trimLeft": {
"en": "Remove spaces and line breaks in beginning of text",
"ru": "Удаление пробелов и переносов строк в начале текста"
},
"common/space/trimRight": {
"en": "Remove spaces and line breaks at end of text",
"ru": "Удаление пробелов и переносов строк в конце текста"
},
"common/sym/arrow": {
"common": "-> → →, <- → ←"
},
Expand All @@ -51,29 +124,45 @@ Typograf.prototype.titles = {
"common/sym/copy": {
"common": "(c) → ©, (tm) → ©, (r) → ™"
},
"common/nbsp/afterNumber": {
"en": "Non-breaking space between number and word",
"ru": "Нераз. пробел между числом и словом"
"common/space/afterPunctuation": {
"en": "space after punctuation",
"ru": "Пробел после знаков пунктуации"
},
"common/nbsp/afterPara": {
"en": "Non-breaking space after §",
"ru": "Нераз. пробел после §"
"common/space/delBeforePercent": {
"en": "Remove space before %, ‰ and ‱",
"ru": "Удаление пробела перед %, ‰ и ‱"
},
"common/nbsp/afterShortWord": {
"en": "Non-breaking space after short word",
"ru": "Нераз. пробел после короткого слова"
"common/space/delBeforePunctuation": {
"en": "Remove spaces before punctuation",
"ru": "Удаление пробелов перед знаками пунктуации"
},
"common/nbsp/beforeShortLastWord": {
"en": "Non-breaking space before last short word in sentence",
"ru": "Нераз. пробел перед последним коротким словом в предложении"
"common/space/delLeadingBlanks": {
"en": "Remove spaces at start of line",
"ru": "Удаление пробелов в начале строки"
},
"common/nbsp/dpi": {
"en": "Non-breaking space before lpi, dpi",
"ru": "Нераз. пробел перед lpi, dpi"
"common/space/delRepeatN": {
"en": "Remove duplicate line breaks (no more than two)",
"ru": "Удаление повторяющихся переносов строки (не более двух)"
},
"common/nbsp/nowrap": {
"en": "Replace non-breaking space to normal space in tags nowrap and nobr",
"ru": "Заменять нераз. пробел на обычный пробел в тегах nowrap и nobr"
"common/space/delRepeatSpace": {
"en": "Removing duplicate spaces between characters",
"ru": "Удаление повторяющихся пробелов между символами"
},
"common/space/delTrailingBlanks": {
"en": "Remove spaces at end of line",
"ru": "Удаление пробелов в конце строки"
},
"common/space/replaceTab": {
"en": "Replacement of tab to 4 spaces",
"ru": "Замена таба на 4 пробела"
},
"common/space/trimLeft": {
"en": "Remove spaces and line breaks in beginning of text",
"ru": "Удаление пробелов и переносов строк в начале текста"
},
"common/space/trimRight": {
"en": "Remove spaces and line breaks at end of text",
"ru": "Удаление пробелов и переносов строк в конце текста"
},
"ru/dash/izpod": {
"en": "Hyphen between “из-под”",
Expand All @@ -83,6 +172,10 @@ Typograf.prototype.titles = {
"en": "Hyphen between “из-за”",
"ru": "Дефис между из-за"
},
"ru/dash/kade": {
"en": "Hyphen before “ка, де, кась”",
"ru": "Дефис перед ка, де, кась"
},
"ru/dash/koe": {
"en": "Hyphen after “кое” and “кой”",
"ru": "Дефис после кое и кой"
Expand All @@ -100,8 +193,8 @@ Typograf.prototype.titles = {
"ru": "Дефис между верно-таки и т.д."
},
"ru/dash/to": {
"en": "Hyphen before “то, либо, нибудь, ка, де, кась”",
"ru": "Дефис перед то, либо, нибудь, ка, де, кась"
"en": "Hyphen before “то, либо, нибудь”",
"ru": "Дефис перед то, либо, нибудь"
},
"ru/dash/weekday": {
"en": "Dash between the days of the week",
Expand Down Expand Up @@ -185,54 +278,5 @@ Typograf.prototype.titles = {
"ru/punctuation/quot": {
"en": "Placement of quotation marks",
"ru": "Расстановка кавычек"
},
"common/number/fraction": {
"common": "1/2 → ½, 1/4 → ¼, 3/3 → ¾"
},
"common/number/plusMinus": {
"common": "+- → ±"
},
"common/number/times": {
"common": "x → × (10 x 5 → 10×5)"
},
"common/space/afterPunctuation": {
"en": "space after punctuation",
"ru": "Пробел после знаков пунктуации"
},
"common/space/delBeforePercent": {
"en": "Remove space before %, ‰ and ‱",
"ru": "Удаление пробела перед %, ‰ и ‱"
},
"common/space/delBeforePunctuation": {
"en": "Remove spaces before punctuation",
"ru": "Удаление пробелов перед знаками пунктуации"
},
"common/space/delLeadingBlanks": {
"en": "Remove spaces at start of line",
"ru": "Удаление пробелов в начале строки"
},
"common/space/delRepeatN": {
"en": "Remove duplicate line breaks (no more than two)",
"ru": "Удаление повторяющихся переносов строки (не более двух)"
},
"common/space/delRepeatSpace": {
"en": "Removing duplicate spaces between characters",
"ru": "Удаление повторяющихся пробелов между символами"
},
"common/space/delTrailingBlanks": {
"en": "Remove spaces at end of line",
"ru": "Удаление пробелов в конце строки"
},
"common/space/replaceTab": {
"en": "Replacement of tab to 4 spaces",
"ru": "Замена таба на 4 пробела"
},
"common/space/trimLeft": {
"en": "Remove spaces and line breaks in beginning of text",
"ru": "Удаление пробелов и переносов строк в начале текста"
},
"common/space/trimRight": {
"en": "Remove spaces and line breaks at end of text",
"ru": "Удаление пробелов и переносов строк в конце текста"
}
};
Loading

0 comments on commit db8222c

Please sign in to comment.