Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

typograf

Package Overview
Dependencies
Maintainers
1
Versions
101
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

typograf - npm Package Compare versions

Comparing version 2.8.0 to 2.8.1

633

dist/typograf.js

@@ -730,8 +730,92 @@ /*! Typograf | © 2014 Denis Seleznev | https://github.com/typograf/typograf/ */

Typograf.rule({
name: 'common/number/fraction',
sortIndex: 1120,
name: 'common/html/escape',
sortIndex: 110,
queue: 'end',
func: function(text) {
return text.replace(/(^|\D)1\/2(\D|$)/g, '$1½$2')
.replace(/(^|\D)1\/4(\D|$)/g, '$1¼$2')
.replace(/(^|\D)3\/4(\D|$)/g, '$1¾$2');
var entityMap = {
'&': '&',
'<': '&lt;',
'>': '&gt;',
'"': '&quot;',
'\'': '&#39;',
'/': '&#x2F;'
};
return text.replace(/[&<>"'\/]/g, function(s) {
return entityMap[s];
});
},
enabled: false
});
Typograf.rule({
name: 'common/html/mail',
sortIndex: 2000,
func: function(text) {
return text.replace(
/(^|[\s;(])([\w\-.]{2,})@([\w\-.]{2,})\.([a-z]{2,6})([)\s.,!?]|$)/gi,
'$1<a href="mailto:$2@$3.$4">$2@$3.$4</a>$5'
);
},
enabled: false
});
Typograf.rule({
name: 'common/html/nbr',
sortIndex: 2020,
func: function(text) {
return text.search(/<br/) === -1 ? text.replace(/\n/g, '<br/>\n') : text;
},
enabled: false
});
Typograf.rule({
name: 'common/html/pbr',
sortIndex: 2030,
func: function(text) {
if(text.search(/\n/) === -1) {
text = '<p>' + text + '</p>';
} else {
text = '<p>' + text.replace(/\n\n/g, '</p>\n<p>') + '<\/p>';
text = text.replace(/([^>])\n/g, '$1<br/>\n');
}
return text;
},
enabled: false
});
Typograf.rule({
name: 'common/html/stripTags',
sortIndex: 100,
queue: 'end',
func: function(text) {
return text.replace(/<\/?[^>]+>/g, '');
},
enabled: false
});
Typograf.rule({
name: 'common/html/url',
sortIndex: 2010,
func: function(text) {
var prefix = '(http|https|ftp|telnet|news|gopher|file|wais)://',
pureUrl = '([a-zA-Z0-9\/\\n+-=%&:_.~?]+[a-zA-Z0-9#+]*)',
re = new RegExp(prefix + pureUrl, 'g');
return text.replace(re, function($0, $1, $2) {
var url = $2,
fullUrl = $1 + '://' + $2,
firstPart = '<a href="' + fullUrl + '">';
if($1 === 'http') {
url = url
.replace(/^www\./, '')
.replace(/^([^\/]+)\/$/, '$1');
return firstPart + url + '</a>';
}
return firstPart + fullUrl + '</a>';
});
}

@@ -741,7 +825,10 @@ });

Typograf.rule({
name: 'common/number/plusMinus',
sortIndex: 1010,
name: 'common/nbsp/afterNumber',
sortIndex: 615,
func: function(text) {
var re = new RegExp('(^| |\\>|\u00A0)\\+-(\\d)', 'g');
return text.replace(re, '$1±$2').replace(/(^\s*)\+-(\s*$)/g, '$1±$2');
var re = '(^|\\D)(\\d{1,5}) ([' +
this.letters() +
']{2,})';
return text.replace(new RegExp(re, 'gi'), '$1$2\u00A0$3');
}

@@ -751,6 +838,6 @@ });

Typograf.rule({
name: 'common/number/times',
sortIndex: 1050,
name: 'common/nbsp/afterPara',
sortIndex: 610,
func: function(text) {
return text.replace(/(\d) ?(x|х) ?(\d)/g, '$1×$3');
return text.replace(/§ ?(\d|I|V|X)/g, '§\u00A0$1');
}

@@ -760,2 +847,61 @@ });

Typograf.rule({
name: 'common/nbsp/afterShortWord',
sortIndex: 590,
func: function(text, settings) {
var len = settings.lengthShortWord,
str = '(^| |\u00A0)([' +
this.letters() +
']{1,' + len + '})(\\.?) ',
re = new RegExp(str, 'gi');
return text
.replace(re, '$1$2$3\u00A0')
.replace(re, '$1$2$3\u00A0');
},
settings: {
lengthShortWord: 2
}
});
Typograf.rule({
name: 'common/nbsp/beforeShortLastWord',
sortIndex: 620,
func: function(text, settings) {
var len = settings.lengthLastWord,
re = new RegExp(' ([' + this.letters() + ']{1,' + len + '})(\\.|\\?|:|!|,)', 'gi');
return text.replace(re, '\u00A0$1$2');
},
settings: {
lengthLastWord: 3
}
});
Typograf.rule({
name: 'common/nbsp/dpi',
sortIndex: 1150,
func: function(text) {
return text.replace(/(\d) ?(lpi|dpi)(?!\w)/, '$1\u00A0$2');
}
});
(function() {
function replaceNbsp($0, $1, $2, $3) {
return $1 + $2.replace(/([^\u00A0])\u00A0([^\u00A0])/g, '$1 $2') + $3;
}
Typograf.rule({
name: 'common/nbsp/nowrap',
sortIndex: 1400,
func: function(text) {
return text
.replace(/(<nowrap>)(.*?)(<\/nowrap>)/g, replaceNbsp)
.replace(/(<nobr>)(.*?)(<\/nobr>)/g, replaceNbsp);
}
});
})();
Typograf.rule({
name: 'common/other/repeatWord',

@@ -774,2 +920,29 @@ sortIndex: 1200,

Typograf.rule({
name: 'common/number/fraction',
sortIndex: 1120,
func: function(text) {
return text.replace(/(^|\D)1\/2(\D|$)/g, '$1½$2')
.replace(/(^|\D)1\/4(\D|$)/g, '$1¼$2')
.replace(/(^|\D)3\/4(\D|$)/g, '$1¾$2');
}
});
Typograf.rule({
name: 'common/number/plusMinus',
sortIndex: 1010,
func: function(text) {
var re = new RegExp('(^| |\\>|\u00A0)\\+-(\\d)', 'g');
return text.replace(re, '$1±$2').replace(/(^\s*)\+-(\s*$)/g, '$1±$2');
}
});
Typograf.rule({
name: 'common/number/times',
sortIndex: 1050,
func: function(text) {
return text.replace(/(\d) ?(x|х) ?(\d)/g, '$1×$3');
}
});
Typograf.rule({
name: 'common/punctuation/delDoublePunctuation',

@@ -930,30 +1103,12 @@ sortIndex: 580,

Typograf.rule({
name: 'common/html/escape',
sortIndex: 110,
queue: 'end',
name: 'ru/money/dollar',
sortIndex: 1140,
func: function(text) {
var entityMap = {
'&': '&amp;',
'<': '&lt;',
'>': '&gt;',
'"': '&quot;',
'\'': '&#39;',
'/': '&#x2F;'
};
var re1 = new RegExp('(^|[\\D]{2,})\\$ ?([\\d.,]+)', 'g'),
re2 = new RegExp('(^|[\\D])([\\d.,]+) ?\\$', 'g'),
rep = '$1$2\u00A0$';
return text.replace(/[&<>"'\/]/g, function(s) {
return entityMap[s];
});
},
enabled: false
});
Typograf.rule({
name: 'common/html/mail',
sortIndex: 2000,
func: function(text) {
return text.replace(
/(^|[\s;(])([\w\-.]{2,})@([\w\-.]{2,})\.([a-z]{2,6})([)\s.,!?]|$)/gi,
'$1<a href="mailto:$2@$3.$4">$2@$3.$4</a>$5'
);
return text
.replace(re1, rep)
.replace(re2, rep);
}

@@ -963,32 +1118,24 @@ });

Typograf.rule({
name: 'common/html/nbr',
sortIndex: 2020,
name: 'ru/money/euro',
sortIndex: 1140,
func: function(text) {
return text.search(/<br/) === -1 ? text.replace(/\n/g, '<br/>\n') : text;
},
enabled: false
});
var re1 = new RegExp('(^|[\\D]{2,})€ ?([\\d.]+)', 'g'),
re2 = new RegExp('(^|[\\D])([\\d.,]+) ?€', 'g'),
rep = '$1$2\u00A0€';
Typograf.rule({
name: 'common/html/pbr',
sortIndex: 2030,
func: function(text) {
if(text.search(/\n/) === -1) {
text = '<p>' + text + '</p>';
} else {
text = '<p>' + text.replace(/\n\n/g, '</p>\n<p>') + '<\/p>';
text = text.replace(/([^>])\n/g, '$1<br/>\n');
}
return text;
},
enabled: false
return text
.replace(re1, rep)
.replace(re2, rep);
}
});
Typograf.rule({
name: 'common/html/stripTags',
sortIndex: 100,
queue: 'end',
name: 'ru/money/ruble',
sortIndex: 1145,
func: function(text) {
return text.replace(/<\/?[^>]+>/g, '');
var rep = '$1\u00A0₽';
return text
.replace(/^(\d+)( |\u00A0)?(р|руб)\.$/, rep)
.replace(/(\d+)( |\u00A0)?(р|руб)\.(?=[!?,:;])/g, rep)
.replace(/(\d+)( |\u00A0)?(р|руб)\.(?=\s+[A-ЯЁ])/g, rep + '.');
},

@@ -999,28 +1146,2 @@ enabled: false

Typograf.rule({
name: 'common/html/url',
sortIndex: 2010,
func: function(text) {
var prefix = '(http|https|ftp|telnet|news|gopher|file|wais)://',
pureUrl = '([a-zA-Z0-9\/\\n+-=%&:_.~?]+[a-zA-Z0-9#+]*)',
re = new RegExp(prefix + pureUrl, 'g');
return text.replace(re, function($0, $1, $2) {
var url = $2,
fullUrl = $1 + '://' + $2,
firstPart = '<a href="' + fullUrl + '">';
if($1 === 'http') {
url = url
.replace(/^www\./, '')
.replace(/^([^\/]+)\/$/, '$1');
return firstPart + url + '</a>';
}
return firstPart + fullUrl + '</a>';
});
}
});
Typograf.rule({
name: 'ru/date/main',

@@ -1057,12 +1178,14 @@ sortIndex: 1300,

Typograf.rule({
name: 'ru/money/dollar',
sortIndex: 1140,
name: 'ru/number/ordinals',
sortIndex: 1300,
func: function(text) {
var re1 = new RegExp('(^|[\\D]{2,})\\$ ?([\\d.,]+)', 'g'),
re2 = new RegExp('(^|[\\D])([\\d.,]+) ?\\$', 'g'),
rep = '$1$2\u00A0$';
return text
.replace(re1, rep)
.replace(re2, rep);
.replace(/(\d)-(ый|ой)([^а-яё]|$)/g, '$1-й$3')
.replace(/(\d)-ая([^а-яё]|$)/g, '$1-я$2')
.replace(/(\d)-(ое|ые)([^а-яё]|$)/g, '$1-е$3')
.replace(/(\d)-(ым|ом)([^а-яё]|$)/g, '$1-м$3')
.replace(/(\d)-ых([^а-яё]|$)/g, '$1-х$2')
.replace(/(\d)-ого([^а-яё]|$)/g, '$1-го$2')
.replace(/(\d)-ому([^а-яё]|$)/g, '$1-му$2')
.replace(/(\d)-ыми([^а-яё]|$)/g, '$1-ми$2');
}

@@ -1072,29 +1195,2 @@ });

Typograf.rule({
name: 'ru/money/euro',
sortIndex: 1140,
func: function(text) {
var re1 = new RegExp('(^|[\\D]{2,})€ ?([\\d.]+)', 'g'),
re2 = new RegExp('(^|[\\D])([\\d.,]+) ?€', 'g'),
rep = '$1$2\u00A0€';
return text
.replace(re1, rep)
.replace(re2, rep);
}
});
Typograf.rule({
name: 'ru/money/ruble',
sortIndex: 1145,
func: function(text) {
var rep = '$1\u00A0₽';
return text
.replace(/^(\d+)( |\u00A0)?(р|руб)\.$/, rep)
.replace(/(\d+)( |\u00A0)?(р|руб)\.(?=[!?,:;])/g, rep)
.replace(/(\d+)( |\u00A0)?(р|руб)\.(?=\s+[A-ЯЁ])/g, rep + '.');
},
enabled: false
});
Typograf.rule({
name: 'ru/nbsp/afterNumberSign',

@@ -1189,145 +1285,2 @@ sortIndex: 610,

Typograf.rule({
name: 'ru/number/ordinals',
sortIndex: 1300,
func: function(text) {
return text
.replace(/(\d)-(ый|ой)([^а-яё]|$)/g, '$1-й$3')
.replace(/(\d)-ая([^а-яё]|$)/g, '$1-я$2')
.replace(/(\d)-(ое|ые)([^а-яё]|$)/g, '$1-е$3')
.replace(/(\d)-(ым|ом)([^а-яё]|$)/g, '$1-м$3')
.replace(/(\d)-ых([^а-яё]|$)/g, '$1-х$2')
.replace(/(\d)-ого([^а-яё]|$)/g, '$1-го$2')
.replace(/(\d)-ому([^а-яё]|$)/g, '$1-му$2')
.replace(/(\d)-ыми([^а-яё]|$)/g, '$1-ми$2');
}
});
/*jshint maxlen:1000 */
Typograf.rule({
name: 'ru/optalign/bracket',
sortIndex: 1001,
func: function(text, settings) {
return text
.replace(/( |\u00A0)\(/g, '<span class="typograf-oa-sp-lbracket">$1</span><span class="typograf-oa-lbracket">(</span>')
.replace(/(^|\n)\(/g, '$1<span class="typograf-oa-n-lbracket">(</span>');
},
enabled: false
})
.innerRule({
name: 'ru/optalign/bracket',
func: function(text) {
// Зачистка HTML-тегов от висячей пунктуации для скобки
return text.replace(/<span class="typograf-oa-(sp-lbracket|lbracket|n-lbracket)">(.*?)<\/span>/g, '$2');
}
});
/*jshint maxlen:1000 */
Typograf.rule({
name: 'ru/optalign/comma',
sortIndex: 1002,
func: function(text, settings) {
var re = new RegExp('([' + this.letters() + '0-9\u0301]+), ', 'gi');
return text.replace(re, '$1<span class="typograf-oa-comma">,</span><span class="typograf-oa-comma-sp"> </span>');
},
enabled: false
})
.innerRule({
name: 'ru/optalign/comma',
func: function(text) {
// Зачистка HTML-тегов от висячей пунктуации для запятой
return text.replace(/<span class="typograf-oa-(comma|comma-sp)">(.*?)<\/span>/g, '$2');
}
});
/*jshint maxlen:1000 */
Typograf.rule({
name: 'ru/optalign/quot',
sortIndex: 1000,
func: function(text) {
var lquotes = '(["' +
this.setting('ru/punctuation/quot', 'lquot') +
this.setting('ru/punctuation/quot', 'lquot2') +
'])',
re = new RegExp('([' + this.letters() + '\\-\u0301!?.:;,]+)( |\u00A0)(' + lquotes + ')', 'gi'),
re2 = new RegExp('(^|\n|\uDBFF)' + lquotes, 'g'); // \uDBFF - часть внутренней метки HTML-тега
return text
.replace(re, '$1<span class="typograf-oa-sp-lquot">$2</span><span class="typograf-oa-lquot">$3</span>')
.replace(re2, '$1<span class="typograf-oa-n-lquot">$2</span>');
},
enabled: false
})
.innerRule({
name: 'ru/optalign/quot',
func: function(text) {
// Зачистка HTML-тегов от висячей пунктуации для кавычки
return text.replace(/<span class="typograf-oa-(sp-lquot|lquot|n-lquot)">(.*?)<\/span>/g, '$2');
}
});
Typograf.rule({
name: 'ru/other/accent',
sortIndex: 560,
enabled: false,
func: function(text) {
return text.replace(/([а-яё])([АЕЁИОУЫЭЮЯ])([^А-ЯЁ\w]|$)/g, function($0, $1, $2, $3) {
return $1 + $2.toLowerCase() + '\u0301' + $3;
});
}
});
Typograf.rule({
name: 'ru/punctuation/quot',
sortIndex: 700,
func: function(text, settings) {
var letters = '\\d' + this.letters() + '\u0301',
lquot = settings.lquot,
rquot = settings.rquot,
lquot2 = settings.lquot2,
rquot2 = settings.rquot2,
phrase = '[' + letters + ')!?.:;#*,' + ']*?',
reL = new RegExp('[«„“"]' + '([…' + letters + '\\n])', 'gi'),
reR = new RegExp('(' + phrase + ')' + '[»”“"]' + '(' + phrase + ')', 'gi'),
reL1 = new RegExp(rquot2 + '([^' + lquot2 + rquot2 + ']*?)' + rquot2, 'g'),
reR1 = new RegExp(lquot2 + '([^' + lquot2 + rquot2 + ']*?)' + lquot2, 'g'),
reL2 = new RegExp(lquot2, 'g'),
reR2 = new RegExp(rquot2, 'g');
text = text
.replace(reL, lquot2 + '$1') // Открывающая кавычка
.replace(reR, '$1' + rquot2 + '$2') // Закрывающая кавычка
.replace(new RegExp('(^|\\w|\\s)' + rquot2 + lquot2, 'g'),
'$1' + lquot2 + lquot2); // фикс для случая »« в начале текста
if(lquot === lquot2 && rquot === rquot2) {
text = text
.replace(reL2, lquot)
.replace(reR2, rquot)
// ««Энергия» Синергия» -> «Энергия» Синергия»
.replace(new RegExp(lquot + lquot, 'g'), lquot)
// «Энергия «Синергия»» -> «Энергия «Синергия»
.replace(new RegExp(rquot + rquot, 'g'), rquot);
} else {
text = text
.replace(reL1, rquot2 + '$1' + rquot)
.replace(reR1, lquot + '$1' + lquot2);
if(text.search(new RegExp(lquot + '|' + rquot)) === -1) {
text = text
.replace(reL2, lquot)
.replace(reR2, rquot);
}
}
return text;
},
settings: {
lquot: '«',
rquot: '»',
lquot2: '„',
rquot2: '“'
}
});
Typograf.data('ru/dash', {

@@ -1456,51 +1409,72 @@ before: '(^| |\\n)',

Typograf.rule({
name: 'common/nbsp/afterNumber',
sortIndex: 615,
name: 'ru/other/accent',
sortIndex: 560,
enabled: false,
func: function(text) {
var re = '(^|\\D)(\\d{1,5}) ([' +
this.letters() +
']{2,})';
return text.replace(new RegExp(re, 'gi'), '$1$2\u00A0$3');
return text.replace(/([а-яё])([АЕЁИОУЫЭЮЯ])([^А-ЯЁ\w]|$)/g, function($0, $1, $2, $3) {
return $1 + $2.toLowerCase() + '\u0301' + $3;
});
}
});
/*jshint maxlen:1000 */
Typograf.rule({
name: 'common/nbsp/afterPara',
sortIndex: 610,
name: 'ru/optalign/bracket',
sortIndex: 1001,
func: function(text, settings) {
return text
.replace(/( |\u00A0)\(/g, '<span class="typograf-oa-sp-lbracket">$1</span><span class="typograf-oa-lbracket">(</span>')
.replace(/(^|\n)\(/g, '$1<span class="typograf-oa-n-lbracket">(</span>');
},
enabled: false
})
.innerRule({
name: 'ru/optalign/bracket',
func: function(text) {
return text.replace(/§ ?(\d|I|V|X)/g, '§\u00A0$1');
// Зачистка HTML-тегов от висячей пунктуации для скобки
return text.replace(/<span class="typograf-oa-(sp-lbracket|lbracket|n-lbracket)">(.*?)<\/span>/g, '$2');
}
});
/*jshint maxlen:1000 */
Typograf.rule({
name: 'common/nbsp/afterShortWord',
sortIndex: 590,
name: 'ru/optalign/comma',
sortIndex: 1002,
func: function(text, settings) {
var len = settings.lengthShortWord,
str = '(^| |\u00A0)([' +
this.letters() +
']{1,' + len + '})(\\.?) ',
re = new RegExp(str, 'gi');
return text
.replace(re, '$1$2$3\u00A0')
.replace(re, '$1$2$3\u00A0');
var re = new RegExp('([' + this.letters() + '0-9\u0301]+), ', 'gi');
return text.replace(re, '$1<span class="typograf-oa-comma">,</span><span class="typograf-oa-comma-sp"> </span>');
},
settings: {
lengthShortWord: 2
enabled: false
})
.innerRule({
name: 'ru/optalign/comma',
func: function(text) {
// Зачистка HTML-тегов от висячей пунктуации для запятой
return text.replace(/<span class="typograf-oa-(comma|comma-sp)">(.*?)<\/span>/g, '$2');
}
});
/*jshint maxlen:1000 */
Typograf.rule({
name: 'common/nbsp/beforeShortLastWord',
sortIndex: 620,
func: function(text, settings) {
var len = settings.lengthLastWord,
re = new RegExp(' ([' + this.letters() + ']{1,' + len + '})(\\.|\\?|:|!|,)', 'gi');
name: 'ru/optalign/quot',
sortIndex: 1000,
func: function(text) {
var lquotes = '(["' +
this.setting('ru/punctuation/quot', 'lquot') +
this.setting('ru/punctuation/quot', 'lquot2') +
'])',
re = new RegExp('([' + this.letters() + '\\-\u0301!?.:;,]+)( |\u00A0)(' + lquotes + ')', 'gi'),
re2 = new RegExp('(^|\n|\uDBFF)' + lquotes, 'g'); // \uDBFF - часть внутренней метки HTML-тега
return text.replace(re, '\u00A0$1$2');
return text
.replace(re, '$1<span class="typograf-oa-sp-lquot">$2</span><span class="typograf-oa-lquot">$3</span>')
.replace(re2, '$1<span class="typograf-oa-n-lquot">$2</span>');
},
settings: {
lengthLastWord: 3
enabled: false
})
.innerRule({
name: 'ru/optalign/quot',
func: function(text) {
// Зачистка HTML-тегов от висячей пунктуации для кавычки
return text.replace(/<span class="typograf-oa-(sp-lquot|lquot|n-lquot)">(.*?)<\/span>/g, '$2');
}

@@ -1510,28 +1484,55 @@ });

Typograf.rule({
name: 'common/nbsp/dpi',
sortIndex: 1150,
func: function(text) {
return text.replace(/(\d) ?(lpi|dpi)(?!\w)/, '$1\u00A0$2');
}
});
name: 'ru/punctuation/quot',
sortIndex: 700,
func: function(text, settings) {
var letters = '\\d' + this.letters() + '\u0301',
lquot = settings.lquot,
rquot = settings.rquot,
lquot2 = settings.lquot2,
rquot2 = settings.rquot2,
phrase = '[' + letters + ')!?.:;#*,' + ']*?',
reL = new RegExp('[«„“"]' + '([…' + letters + '\\n])', 'gi'),
reR = new RegExp('(' + phrase + ')' + '[»”“"]' + '(' + phrase + ')', 'gi'),
reL1 = new RegExp(rquot2 + '([^' + lquot2 + rquot2 + ']*?)' + rquot2, 'g'),
reR1 = new RegExp(lquot2 + '([^' + lquot2 + rquot2 + ']*?)' + lquot2, 'g'),
reL2 = new RegExp(lquot2, 'g'),
reR2 = new RegExp(rquot2, 'g');
(function() {
text = text
.replace(reL, lquot2 + '$1') // Открывающая кавычка
.replace(reR, '$1' + rquot2 + '$2') // Закрывающая кавычка
.replace(new RegExp('(^|\\w|\\s)' + rquot2 + lquot2, 'g'),
'$1' + lquot2 + lquot2); // фикс для случая »« в начале текста
function replaceNbsp($0, $1, $2, $3) {
return $1 + $2.replace(/([^\u00A0])\u00A0([^\u00A0])/g, '$1 $2') + $3;
}
if(lquot === lquot2 && rquot === rquot2) {
text = text
.replace(reL2, lquot)
.replace(reR2, rquot)
// ««Энергия» Синергия» -> «Энергия» Синергия»
.replace(new RegExp(lquot + lquot, 'g'), lquot)
// «Энергия «Синергия»» -> «Энергия «Синергия»
.replace(new RegExp(rquot + rquot, 'g'), rquot);
} else {
text = text
.replace(reL1, rquot2 + '$1' + rquot)
.replace(reR1, lquot + '$1' + lquot2);
if(text.search(new RegExp(lquot + '|' + rquot)) === -1) {
text = text
.replace(reL2, lquot)
.replace(reR2, rquot);
}
}
Typograf.rule({
name: 'common/nbsp/nowrap',
sortIndex: 1400,
func: function(text) {
return text
.replace(/(<nowrap>)(.*?)(<\/nowrap>)/g, replaceNbsp)
.replace(/(<nobr>)(.*?)(<\/nobr>)/g, replaceNbsp);
return text;
},
settings: {
lquot: '«',
rquot: '»',
lquot2: '„',
rquot2: '“'
}
});
})();
Typograf._sortRules();
Typograf._needSortRules = true;
/*! Typograf | © 2014 Denis Seleznev | https://github.com/typograf/typograf/ */
function Typograf(e){this._prefs="object"==typeof e?e:{},this._settings={},this._enabledRules={},this._initSafeTags(),this._rules.forEach(this._prepareRule,this)}Typograf.rule=function(e){return e.enabled=e.enabled===!1?!1:!0,e._lang=e.name.split("/")[0],e.sortIndex=e.sortIndex||0,Typograf.prototype._rules.push(e),Typograf._needSortRules&&this._sortRules(),this},Typograf.innerRule=function(e){return Typograf.prototype._innerRules.push(e),e._lang=e.name.split("/")[0],e.sortIndex=e.sortIndex||0,Typograf._needSortRules&&this._sortInnerRules(),this},Typograf.data=function(e,r){Typograf.prototype._data[e]=r},Typograf._sortRules=function(){Typograf.prototype._rules.sort(function(e,r){return e.sortIndex>r.sortIndex?1:-1})},Typograf._sortInnerRules=function(){Typograf.prototype._innerRules.sort(function(e,r){return e.sortIndex>r.sortIndex?1:-1})},Typograf.prototype={constructor:Typograf,execute:function(e,r){r=r||{};var n=this,a=r.lang||this._prefs.lang||"common",t={},o={},u="undefined"==typeof r.mode?this._prefs.mode:r.mode,s=function(r){var n=r._lang;"common"!==n&&n!==a||!this.enabled(r.name)||(this._onBeforeRule&&this._onBeforeRule(e),e=r.func.call(this,e,this._settings[r.name]),this._onAfterRule&&this._onAfterRule(e))},c=function(e){o[e]&&o[e].forEach(s,n),t[e]&&t[e].forEach(s,n)};if(this._lang=a,e=""+e,!e)return"";e=this._fixLineEnd(e),this._innerRules.forEach(function(e){var r=e.queue;o[r]=o[r]||[],o[r].push(e)},this),this._rules.forEach(function(e){var r=e.queue;t[r]=t[r]||[],t[r].push(e)},this),c("start");var i=-1!==e.search(/<[a-z!]/i);return i&&(e=this._hideSafeTags(e)),e=this._utfication(e),c(),e=this._modification(e,u),i&&(e=this._showSafeTags(e)),c("end"),this._lang=null,e},setting:function(e,r,n){return arguments.length<=2?this._settings[e]&&this._settings[e][r]:(this._settings[e]=this._settings[e]||{},this._settings[e][r]=n,this)},enabled:function(e){return this._enabledRules[e]},disabled:function(e){return!this._enabledRules[e]},enable:function(e){return this._enable(e,!0)},disable:function(e){return this._enable(e,!1)},addSafeTag:function(e,r){this._safeTags.push([e,r])},letters:function(){var e=this._lang||this._prefs.lang,r=this.data("common/letter"),n=this.data(e+"/letter");return r!==n&&e?r+n:r},data:function(e){return this._data[e]},_data:{},_fixLineEnd:function(e){return e.replace(/\r\n/g,"\n").replace(/\r/g,"\n")},_prepareRule:function(e){var r=e.name;this._settings[r]=e.settings||{},this._enabledRules[r]=e.enabled},_enable:function(e,r){return Array.isArray(e)?e.forEach(function(e){this._enableByMask(e,r)},this):this._enableByMask(e,r),this},_enableByMask:function(e,r){var n;-1!==e.search(/\*/)?(n=new RegExp(e.replace(/\//g,"\\/").replace(/\*/g,".*")),this._rules.forEach(function(e){var a=e.name;n.test(a)&&(this._enabledRules[a]=r)},this)):this._enabledRules[e]=r},_rules:[],_innerRules:[],_initSafeTags:function(){this._safeTags=[["<!--","-->"],["<!ENTITY",">"],["<!DOCTYPE",">"],["<\\?xml","\\?>"],["<!\\[CDATA\\[","\\]\\]>"]],["code","kbd","object","pre","samp","script","style","var"].forEach(function(e){this._safeTags.push(["<"+e+"(\\s[^>]*?)?>","</"+e+">"])},this)},_hideSafeTags:function(e){return this._hiddenSafeTags={},this._iLabel=0,this._safeTags.forEach(function(r){var n=new RegExp(r[0]+"[^]*?"+r[1],"gi");e=e.replace(n,this._pasteLabel.bind(this))},this),this._hideHTMLTags(e)},_getPrivateLabel:function(e){return"\udbfftf"+e+"\udbff"},_pasteLabel:function(e){var r=this._getPrivateLabel(this._iLabel);return this._hiddenSafeTags[r]=e,this._iLabel++,r},_replaceLabel:function(e){return this._hiddenSafeTags[e]},_hideHTMLTags:function(e){return e.replace(/<[a-z\/][^]*?>/gi,this._pasteLabel.bind(this))},_showSafeTags:function(e){for(var r=0;r<this._safeTags.length&&(e=e.replace(/\uDBFFtf\d+\uDBFF/g,this._replaceLabel.bind(this)),-1!==e.search(/\uDBFFtf\d/));r++);return delete this._hiddenSafeTags,e},_utfication:function(e){return-1!==e.search(/&#/)&&(e=this._decHexToUtf(e)),-1!==e.search(/&[a-z]/i)&&this.entities.forEach(function(r){e=e.replace(r[3],r[2])}),e},_decHexToUtf:function(e){return e.replace(/&#(\d{1,6});/gi,function(e,r){return String.fromCharCode(parseInt(r,10))}).replace(/&#x([\da-f]{1,6});/gi,function(e,r){return String.fromCharCode(parseInt(r,16))})},_modification:function(e,r){if("name"===r||"digit"===r){var n="name"===r?0:1;this.entities.forEach(function(r){r[n]&&(e=e.replace(r[4],r[n]))})}return e}},"object"==typeof exports&&(module.exports=Typograf),Typograf.prototype.entities=[],[["nbsp",160],["iexcl",161],["cent",162],["pound",163],["curren",164],["yen",165],["brvbar",166],["sect",167],["uml",168],["copy",169],["ordf",170],["laquo",171],["not",172],["shy",173],["reg",174],["macr",175],["deg",176],["plusmn",177],["sup2",178],["sup3",179],["acute",180],["micro",181],["para",182],["middot",183],["cedil",184],["sup1",185],["ordm",186],["raquo",187],["frac14",188],["frac12",189],["frac34",190],["iquest",191],["Agrave",192],["Aacute",193],["Acirc",194],["Atilde",195],["Auml",196],["Aring",197],["AElig",198],["Ccedil",199],["Egrave",200],["Eacute",201],["Ecirc",202],["Euml",203],["Igrave",204],["Iacute",205],["Icirc",206],["Iuml",207],["ETH",208],["Ntilde",209],["Ograve",210],["Oacute",211],["Ocirc",212],["Otilde",213],["Ouml",214],["times",215],["Oslash",216],["Ugrave",217],["Uacute",218],["Ucirc",219],["Uuml",220],["Yacute",221],["THORN",222],["szlig",223],["agrave",224],["aacute",225],["acirc",226],["atilde",227],["auml",228],["aring",229],["aelig",230],["ccedil",231],["egrave",232],["eacute",233],["ecirc",234],["euml",235],["igrave",236],["iacute",237],["icirc",238],["iuml",239],["eth",240],["ntilde",241],["ograve",242],["oacute",243],["ocirc",244],["otilde",245],["ouml",246],["divide",247],["oslash",248],["ugrave",249],["uacute",250],["ucirc",251],["uuml",252],["yacute",253],["thorn",254],["yuml",255],["fnof",402],["Alpha",913],["Beta",914],["Gamma",915],["Delta",916],["Epsilon",917],["Zeta",918],["Eta",919],["Theta",920],["Iota",921],["Kappa",922],["Lambda",923],["Mu",924],["Nu",925],["Xi",926],["Omicron",927],["Pi",928],["Rho",929],["Sigma",931],["Tau",932],["Upsilon",933],["Phi",934],["Chi",935],["Psi",936],["Omega",937],["alpha",945],["beta",946],["gamma",947],["delta",948],["epsilon",949],["zeta",950],["eta",951],["theta",952],["iota",953],["kappa",954],["lambda",955],["mu",956],["nu",957],["xi",958],["omicron",959],["pi",960],["rho",961],["sigmaf",962],["sigma",963],["tau",964],["upsilon",965],["phi",966],["chi",967],["psi",968],["omega",969],["thetasym",977],["upsih",978],["piv",982],["bull",8226],["hellip",8230],["prime",8242],["Prime",8243],["oline",8254],["frasl",8260],["weierp",8472],["image",8465],["real",8476],["trade",8482],["alefsym",8501],["larr",8592],["uarr",8593],["rarr",8594],["darr",8595],["harr",8596],["crarr",8629],["lArr",8656],["uArr",8657],["rArr",8658],["dArr",8659],["hArr",8660],["forall",8704],["part",8706],["exist",8707],["empty",8709],["nabla",8711],["isin",8712],["notin",8713],["ni",8715],["prod",8719],["sum",8721],["minus",8722],["lowast",8727],["radic",8730],["prop",8733],["infin",8734],["ang",8736],["and",8743],["or",8744],["cap",8745],["cup",8746],["int",8747],["there4",8756],["sim",8764],["cong",8773],["asymp",8776],["ne",8800],["equiv",8801],["le",8804],["ge",8805],["sub",8834],["sup",8835],["nsub",8836],["sube",8838],["supe",8839],["oplus",8853],["otimes",8855],["perp",8869],["sdot",8901],["lceil",8968],["rceil",8969],["lfloor",8970],["rfloor",8971],["lang",9001],["rang",9002],["spades",9824],["clubs",9827],["hearts",9829],["diams",9830],["loz",9674],["OElig",338],["oelig",339],["Scaron",352],["scaron",353],["Yuml",376],["circ",710],["tilde",732],["ensp",8194],["emsp",8195],["thinsp",8201],["zwnj",8204],["zwj",8205],["lrm",8206],["rlm",8207],["ndash",8211],["mdash",8212],["lsquo",8216],["rsquo",8217],["sbquo",8218],["ldquo",8220],["rdquo",8221],["bdquo",8222],["dagger",8224],["Dagger",8225],["permil",8240],["lsaquo",8249],["rsaquo",8250],["euro",8364]].forEach(function(e){var r=e[0],n=e[1],a=String.fromCharCode(n),t=["&"+r+";","&#"+n+";",a,new RegExp("&"+r+";","g"),new RegExp(a,"g")];Typograf.prototype.entities.push(t)},this),Typograf.data("common/dash","--?|\u2012|\u2013|\u2014"),Typograf.data("common/letter","a-z"),Typograf.data("common/quot","\xab\u2039\xbb\u203a\u201e\u201a\u201c\u201f\u2018\u201b\u201d\u2019\"'"),Typograf.data("en/letter","a-z"),Typograf.data("ru/letter","\u0430-\u044f\u0451"),Typograf.data("ru/month",["\u044f\u043d\u0432\u0430\u0440\u044c","\u0444\u0435\u0432\u0440\u0430\u043b\u044c","\u043c\u0430\u0440\u0442","\u0430\u043f\u0440\u0435\u043b\u044c","\u043c\u0430\u0439","\u0438\u044e\u043d\u044c","\u0438\u044e\u043b\u044c","\u0430\u0432\u0433\u0443\u0441\u0442","\u0441\u0435\u043d\u0442\u044f\u0431\u0440\u044c","\u043e\u043a\u0442\u044f\u0431\u0440\u044c","\u043d\u043e\u044f\u0431\u0440\u044c","\u0434\u0435\u043a\u0430\u0431\u0440\u044c"]),Typograf.data("ru/monthCase",["\u044f\u043d\u0432\u0430\u0440\u044f","\u0444\u0435\u0432\u0440\u0430\u043b\u044f","\u043c\u0430\u0440\u0442\u0430","\u0430\u043f\u0440\u0435\u043b\u044f","\u043c\u0430\u044f","\u0438\u044e\u043d\u044f","\u0438\u044e\u043b\u044f","\u0430\u0432\u0433\u0443\u0441\u0442\u0430","\u0441\u0435\u043d\u0442\u044f\u0431\u0440\u044f","\u043e\u043a\u0442\u044f\u0431\u0440\u044f","\u043d\u043e\u044f\u0431\u0440\u044f","\u0434\u0435\u043a\u0430\u0431\u0440\u044f"]),Typograf.data("ru/shortMonth",["\u044f\u043d\u0432","\u0444\u0435\u0432","\u043c\u0430\u0440","\u0430\u043f\u0440","\u043c\u0430[\u0435\u0439\u044f]","\u0438\u044e\u043d","\u0438\u044e\u043b","\u0430\u0432\u0433","\u0441\u0435\u043d","\u043e\u043a\u0442","\u043d\u043e\u044f","\u0434\u0435\u043a"]),Typograf.data("ru/weekday",["\u043f\u043e\u043d\u0435\u0434\u0435\u043b\u044c\u043d\u0438\u043a","\u0432\u0442\u043e\u0440\u043d\u0438\u043a","\u0441\u0440\u0435\u0434\u0430","\u0447\u0435\u0442\u0432\u0435\u0440\u0433","\u043f\u044f\u0442\u043d\u0438\u0446\u0430","\u0441\u0443\u0431\u0431\u043e\u0442\u0430","\u0432\u043e\u0441\u043a\u0440\u0435\u0441\u0435\u043d\u044c\u0435"]),Typograf.rule({name:"common/number/fraction",sortIndex:1120,func:function(e){return e.replace(/(^|\D)1\/2(\D|$)/g,"$1\xbd$2").replace(/(^|\D)1\/4(\D|$)/g,"$1\xbc$2").replace(/(^|\D)3\/4(\D|$)/g,"$1\xbe$2")}}),Typograf.rule({name:"common/number/plusMinus",sortIndex:1010,func:function(e){var r=new RegExp("(^| |\\>|\xa0)\\+-(\\d)","g");return e.replace(r,"$1\xb1$2").replace(/(^\s*)\+-(\s*$)/g,"$1\xb1$2")}}),Typograf.rule({name:"common/number/times",sortIndex:1050,func:function(e){return e.replace(/(\d) ?(x|\u0445) ?(\d)/g,"$1\xd7$3")}}),Typograf.rule({name:"common/other/repeatWord",sortIndex:1200,func:function(e){var r="(["+this.letters()+"\u0301]+) \\1([;:,.?! \n])";return e.replace(new RegExp(r,"gi"),"$1$2")},enabled:!1}),Typograf.rule({name:"common/punctuation/delDoublePunctuation",sortIndex:580,func:function(e){return e.replace(/(,|:|;|\?){2,}/g,"$1")}}),Typograf.rule({name:"common/punctuation/exclamation",sortIndex:1150,func:function(e){return e.replace(/(^|[^!])!{2}($|[^!])/,"$1!$2").replace(/(^|[^!])!{4}($|[^!])/,"$1!!!$2")}}),Typograf.rule({name:"common/punctuation/exclamationQuestion",sortIndex:1140,func:function(e){var r=new RegExp("(^|[^!])!\\?([^?]|$)","g");return e.replace(r,"$1?!$2")}}),Typograf.rule({name:"common/punctuation/hellip",sortIndex:20,func:function(e){return e.replace(/(^|[^.])\.{3,4}([^.]|$)/g,"$1\u2026$2")}}),Typograf.rule({name:"common/space/afterPunctuation",sortIndex:560,func:function(e){var r=new RegExp("(!|;|\\?)([^ \udbff\n !;?"+this.data("common/quot")+"[])","g");return e.replace(r,"$1 $2").replace(/(\D)(,|:)([^ \uDBFF\n\t,.?:])/g,"$1$2 $3")}}),Typograf.rule({name:"common/space/delBeforePercent",sortIndex:600,func:function(e){return e.replace(/(\d)( |\u00A0)(%|\u2030|\u2031)/g,"$1$3")}}),Typograf.rule({name:"common/space/delBeforePunctuation",sortIndex:550,func:function(e){return e.replace(/ (!|;|,|\?|\.|:)/g,"$1").replace(/\( /g,"(").replace(/([^ ])\(/g,"$1 (").replace(/ \)/g,")").replace(/\)([^!;,\?\.:])/g,") $1")}}),Typograf.rule({name:"common/space/delLeadingBlanks",sortIndex:504,func:function(e){return e.replace(/\n[ \t]+/g,"\n")},enabled:!1}),Typograf.rule({name:"common/space/delRepeatN",sortIndex:545,func:function(e){return e.replace(/\n{3,}/g,"\n\n")}}),Typograf.rule({name:"common/space/delRepeatSpace",sortIndex:540,func:function(e){return e.replace(/([^\n \t])( |\t){2,}([^\n \t])/g,"$1$2$3")}}),Typograf.rule({name:"common/space/delTrailingBlanks",sortIndex:505,func:function(e){return e.replace(/[ \t]+\n/g,"\n")}}),Typograf.rule({name:"common/space/replaceTab",sortIndex:510,func:function(e){return e.replace(/\t/g," ")}}),Typograf.rule({name:"common/space/trimLeft",sortIndex:530,func:String.prototype.trimLeft?function(e){return e.trimLeft()}:function(e){return e.replace(/^[\s\uFEFF\xA0]+/g,"")}}),Typograf.rule({name:"common/space/trimRight",sortIndex:535,func:String.prototype.trimRight?function(e){return e.trimRight()}:function(e){return e.replace(/[\s\uFEFF\xA0]+$/g,"")}}),Typograf.rule({name:"common/sym/arrow",sortIndex:1130,func:function(e){return e.replace(/(^|[^-])->(?!>)/g,"$1\u2192").replace(/(^|[^<])<-(?!-)/g,"$1\u2190")}}),Typograf.rule({name:"common/sym/cf",sortIndex:1020,func:function(e){var r=new RegExp('(\\d+)( |\xa0)?(C|F)([\\W \\.,:!\\?"\\]\\)]|$)',"g");return e.replace(r,"$1\u2009\xb0$3$4")}}),Typograf.rule({name:"common/sym/copy",sortIndex:10,func:function(e){return e.replace(/\(r\)/gi,"\xae").replace(/(copyright )?\((c|\u0441)\)/gi,"\xa9").replace(/\(tm\)/gi,"\u2122")}}),Typograf.rule({name:"common/html/escape",sortIndex:110,queue:"end",func:function(e){var r={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;","/":"&#x2F;"};return e.replace(/[&<>"'\/]/g,function(e){return r[e]})},enabled:!1}),Typograf.rule({name:"common/html/mail",sortIndex:2e3,func:function(e){return e.replace(/(^|[\s;(])([\w\-.]{2,})@([\w\-.]{2,})\.([a-z]{2,6})([)\s.,!?]|$)/gi,'$1<a href="mailto:$2@$3.$4">$2@$3.$4</a>$5')}}),Typograf.rule({name:"common/html/nbr",sortIndex:2020,func:function(e){return-1===e.search(/<br/)?e.replace(/\n/g,"<br/>\n"):e},enabled:!1}),Typograf.rule({name:"common/html/pbr",sortIndex:2030,func:function(e){return-1===e.search(/\n/)?e="<p>"+e+"</p>":(e="<p>"+e.replace(/\n\n/g,"</p>\n<p>")+"</p>",e=e.replace(/([^>])\n/g,"$1<br/>\n")),e},enabled:!1}),Typograf.rule({name:"common/html/stripTags",sortIndex:100,queue:"end",func:function(e){return e.replace(/<\/?[^>]+>/g,"")},enabled:!1}),Typograf.rule({name:"common/html/url",sortIndex:2010,func:function(e){var r="(http|https|ftp|telnet|news|gopher|file|wais)://",n="([a-zA-Z0-9/\\n+-=%&:_.~?]+[a-zA-Z0-9#+]*)",a=new RegExp(r+n,"g");return e.replace(a,function(e,r,n){var a=n,t=r+"://"+n,o='<a href="'+t+'">';return"http"===r?(a=a.replace(/^www\./,"").replace(/^([^\/]+)\/$/,"$1"),o+a+"</a>"):o+t+"</a>"})}}),Typograf.rule({name:"ru/date/main",sortIndex:1300,func:function(e){var r="(-|\\.|\\/)",n="(-|\\/)",a=new RegExp("(^|\\D)(\\d{4})"+r+"(\\d{2})"+r+"(\\d{2})(\\D|$)","gi"),t=new RegExp("(^|\\D)(\\d{2})"+n+"(\\d{2})"+n+"(\\d{4})(\\D|$)","gi");return e.replace(a,"$1$6.$4.$2$7").replace(t,"$1$4.$2.$6$7")}}),Typograf.rule({name:"ru/date/weekday",sortIndex:1310,func:function(e){var r="( |\xa0)",n=this.data("ru/monthCase").join("|"),a=this.data("ru/weekday").join("|"),t=new RegExp("(\\d)"+r+"("+n+"),"+r+"("+a+")","gi");return e.replace(t,function(){var e=arguments;return e[1]+e[2]+e[3].toLowerCase()+","+e[4]+e[5].toLowerCase()})}}),Typograf.rule({name:"ru/money/dollar",sortIndex:1140,func:function(e){var r=new RegExp("(^|[\\D]{2,})\\$ ?([\\d.,]+)","g"),n=new RegExp("(^|[\\D])([\\d.,]+) ?\\$","g"),a="$1$2\xa0$";return e.replace(r,a).replace(n,a)}}),Typograf.rule({name:"ru/money/euro",sortIndex:1140,func:function(e){var r=new RegExp("(^|[\\D]{2,})\u20ac ?([\\d.]+)","g"),n=new RegExp("(^|[\\D])([\\d.,]+) ?\u20ac","g"),a="$1$2\xa0\u20ac";return e.replace(r,a).replace(n,a)}}),Typograf.rule({name:"ru/money/ruble",sortIndex:1145,func:function(e){var r="$1\xa0\u20bd";return e.replace(/^(\d+)( |\u00A0)?(\u0440|\u0440\u0443\u0431)\.$/,r).replace(/(\d+)( |\u00A0)?(\u0440|\u0440\u0443\u0431)\.(?=[!?,:;])/g,r).replace(/(\d+)( |\u00A0)?(\u0440|\u0440\u0443\u0431)\.(?=\s+[A-\u042f\u0401])/g,r+".")},enabled:!1}),Typograf.rule({name:"ru/nbsp/afterNumberSign",sortIndex:610,func:function(e){return e.replace(/\u2116 ?(\d|\u043f\/\u043f)/g,"\u2116\xa0$1")}}),Typograf.rule({name:"ru/nbsp/beforeParticle",sortIndex:570,func:function(e){return e.replace(/ (\u043b\u0438|\u043b\u044c|\u0436\u0435|\u0436|\u0431\u044b|\u0431)([^\u0430-\u044f\u0451\u0410-\u042f\u0401])/g,"\xa0$1$2")}}),Typograf.rule({name:"ru/nbsp/but",sortIndex:1110,func:function(e){var r=new RegExp(",?( |\xa0|\n)(\u0430|\u043d\u043e)( |\xa0|\n)","g");return e.replace(r,",$1$2$3")}}),Typograf.rule({name:"ru/nbsp/cc",sortIndex:1090,func:function(e){return e=e.replace(/(^|\d|V|I|X) ?\u0432(\u0432)?( |,|;|\n|$)/g,"$1\xa0\u0432$2.$3"),e.replace(/(^|\d|[IVX]) ?\u0432\.? ?\u0432\./g,"$1\xa0\u0432\u0432.")}}),Typograf.rule({name:"ru/nbsp/dayMonth",sortIndex:1105,func:function(e){var r=new RegExp("(\\d{1,2}) ("+this.data("ru/shortMonth").join("|")+")","gi");return e.replace(r,"$1\xa0$2")}}),Typograf.rule({name:"ru/nbsp/m",sortIndex:1030,func:function(e){var r="(\u043a\u043c|\u043c|\u0434\u043c|\u0441\u043c|\u043c\u043c)",n=new RegExp("(^|\\D)(\\d+) ?"+r+"2(\\D|$)","g"),a=new RegExp("(^|\\D)(\\d+) ?"+r+"3(\\D|$)","g");return e.replace(n,"$1$2\xa0$3\xb2$4").replace(a,"$1$2\xa0$3\xb3$4")}}),Typograf.rule({name:"ru/nbsp/ooo",sortIndex:1100,func:function(e){return e.replace(/(^|[^a-\u044f\u0451A-\u042f\u0401])(\u041e\u041e\u041e|\u041e\u0410\u041e|\u0417\u0410\u041e|\u041d\u0418\u0418|\u041f\u0411\u041e\u042e\u041b) /g,"$1$2\xa0")}}),Typograf.rule({name:"ru/nbsp/page",sortIndex:610,func:function(e){return e.replace(/ (\u0441\u0442\u0440|\u0433\u043b|\u0440\u0438\u0441|\u0438\u043b\u043b)\./g,"\xa0$1.")}}),Typograf.rule({name:"ru/nbsp/xxxx",sortIndex:1060,func:function(e){return e.replace(/(^|\D)(\d{1,4}) ?\u0433(\u043e\u0434| |,|;|\.|\n|$)/g,"$1$2\xa0\u0433$3")}}),Typograf.rule({name:"ru/nbsp/yy",sortIndex:1080,func:function(e){return e.replace(/(^|\d) ?\u0433\. ?\u0433\./g,"$1\xa0\u0433\u0433.")}}),Typograf.rule({name:"ru/number/ordinals",sortIndex:1300,func:function(e){return e.replace(/(\d)-(\u044b\u0439|\u043e\u0439)([^\u0430-\u044f\u0451]|$)/g,"$1-\u0439$3").replace(/(\d)-\u0430\u044f([^\u0430-\u044f\u0451]|$)/g,"$1-\u044f$2").replace(/(\d)-(\u043e\u0435|\u044b\u0435)([^\u0430-\u044f\u0451]|$)/g,"$1-\u0435$3").replace(/(\d)-(\u044b\u043c|\u043e\u043c)([^\u0430-\u044f\u0451]|$)/g,"$1-\u043c$3").replace(/(\d)-\u044b\u0445([^\u0430-\u044f\u0451]|$)/g,"$1-\u0445$2").replace(/(\d)-\u043e\u0433\u043e([^\u0430-\u044f\u0451]|$)/g,"$1-\u0433\u043e$2").replace(/(\d)-\u043e\u043c\u0443([^\u0430-\u044f\u0451]|$)/g,"$1-\u043c\u0443$2").replace(/(\d)-\u044b\u043c\u0438([^\u0430-\u044f\u0451]|$)/g,"$1-\u043c\u0438$2")}}),Typograf.rule({name:"ru/optalign/bracket",sortIndex:1001,func:function(e){return e.replace(/( |\u00A0)\(/g,'<span class="typograf-oa-sp-lbracket">$1</span><span class="typograf-oa-lbracket">(</span>').replace(/(^|\n)\(/g,'$1<span class="typograf-oa-n-lbracket">(</span>')},enabled:!1}).innerRule({name:"ru/optalign/bracket",func:function(e){return e.replace(/<span class="typograf-oa-(sp-lbracket|lbracket|n-lbracket)">(.*?)<\/span>/g,"$2")}}),Typograf.rule({name:"ru/optalign/comma",sortIndex:1002,func:function(e){var r=new RegExp("(["+this.letters()+"0-9\u0301]+), ","gi");return e.replace(r,'$1<span class="typograf-oa-comma">,</span><span class="typograf-oa-comma-sp"> </span>')},enabled:!1}).innerRule({name:"ru/optalign/comma",func:function(e){return e.replace(/<span class="typograf-oa-(comma|comma-sp)">(.*?)<\/span>/g,"$2")}}),Typograf.rule({name:"ru/optalign/quot",sortIndex:1e3,func:function(e){var r='(["'+this.setting("ru/punctuation/quot","lquot")+this.setting("ru/punctuation/quot","lquot2")+"])",n=new RegExp("(["+this.letters()+"\\-\u0301!?.:;,]+)( |\xa0)("+r+")","gi"),a=new RegExp("(^|\n|\udbff)"+r,"g");return e.replace(n,'$1<span class="typograf-oa-sp-lquot">$2</span><span class="typograf-oa-lquot">$3</span>').replace(a,'$1<span class="typograf-oa-n-lquot">$2</span>')},enabled:!1}).innerRule({name:"ru/optalign/quot",func:function(e){return e.replace(/<span class="typograf-oa-(sp-lquot|lquot|n-lquot)">(.*?)<\/span>/g,"$2")}}),Typograf.rule({name:"ru/other/accent",sortIndex:560,enabled:!1,func:function(e){return e.replace(/([\u0430-\u044f\u0451])([\u0410\u0415\u0401\u0418\u041e\u0423\u042b\u042d\u042e\u042f])([^\u0410-\u042f\u0401\w]|$)/g,function(e,r,n,a){return r+n.toLowerCase()+"\u0301"+a})}}),Typograf.rule({name:"ru/punctuation/quot",sortIndex:700,func:function(e,r){var n="\\d"+this.letters()+"\u0301",a=r.lquot,t=r.rquot,o=r.lquot2,u=r.rquot2,s="["+n+")!?.:;#*,]*?",c=new RegExp('[\xab\u201e\u201c"]([\u2026'+n+"\\n])","gi"),i=new RegExp("("+s+')[\xbb\u201d\u201c"]('+s+")","gi"),p=new RegExp(u+"([^"+o+u+"]*?)"+u,"g"),l=new RegExp(o+"([^"+o+u+"]*?)"+o,"g"),f=new RegExp(o,"g"),g=new RegExp(u,"g");return e=e.replace(c,o+"$1").replace(i,"$1"+u+"$2").replace(new RegExp("(^|\\w|\\s)"+u+o,"g"),"$1"+o+o),a===o&&t===u?e=e.replace(f,a).replace(g,t).replace(new RegExp(a+a,"g"),a).replace(new RegExp(t+t,"g"),t):(e=e.replace(p,u+"$1"+t).replace(l,a+"$1"+o),-1===e.search(new RegExp(a+"|"+t))&&(e=e.replace(f,a).replace(g,t))),e},settings:{lquot:"\xab",rquot:"\xbb",lquot2:"\u201e",rquot2:"\u201c"}}),Typograf.data("ru/dash",{before:"(^| |\\n)",after:"( |,|\\.|\\?|:|!|$)"}),Typograf.rule({name:"ru/dash/izpod",sortIndex:35,func:function(e){var r=this.data("ru/dash"),n=new RegExp(r.before+"(\u0418|\u0438)\u0437 \u043f\u043e\u0434"+r.after,"g");return e.replace(n,"$1$2\u0437-\u043f\u043e\u0434$3")}}),Typograf.rule({name:"ru/dash/izza",sortIndex:33,func:function(e){var r=this.data("ru/dash"),n=new RegExp(r.before+"(\u0418|\u0438)\u0437 \u0437\u0430"+r.after,"g");return e.replace(n,"$1$2\u0437-\u0437\u0430$3")}}),Typograf.rule({name:"ru/dash/kade",sortIndex:31,func:function(e){var r=new RegExp("([a-\u044f\u0451]+)( | ?- ?)(\u043a\u0430|\u0434\u0435|\u043a\u0430\u0441\u044c)"+this.data("ru/dash").after,"g");return e.replace(r,"$1-$3$4")}}),Typograf.rule({name:"ru/dash/koe",sortIndex:38,func:function(e){var r=this.data("ru/dash"),n=new RegExp(r.before+"([\u041a\u043a]\u043e[\u0435\u0439])\\s([\u0430-\u044f\u0451]{3,})"+r.after,"g");return e.replace(n,"$1$2-$3$4")}}),Typograf.rule({name:"ru/dash/main",sortIndex:620,func:function(e){var r="ru/dash/main",n="("+this.data("common/dash")+")",a=new RegExp("( |\xa0)"+n+"( |\\n)","g"),t=new RegExp("(^|\n)"+n+"( |\xa0)","g"),o=new RegExp("(X|I|V)(?: |\xa0)?"+n+"(?: |\xa0)?(X|I|V)","g");return e.replace(a,"\xa0"+this.setting(r,"dash")+"$3").replace(t,"$1"+this.setting(r,"dash")+"\xa0").replace(o,"$1"+this.setting(r,"dashInterval")+"$3")},settings:{dash:"\u2014",dashInterval:"\u2014"}}),Typograf.rule({name:"ru/dash/month",sortIndex:610,func:function(e){var r="("+this.data("ru/month").join("|")+")",n=new RegExp(r+" ?("+this.data("common/dash")+") ?"+r,"gi");return e.replace(n,"$1"+this.setting("ru/dash/main","dashInterval")+"$3")}}),Typograf.rule({name:"ru/dash/taki",sortIndex:39,func:function(e){var r=new RegExp("(\u0432\u0435\u0440\u043d\u043e|\u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e|\u043e\u043f\u044f\u0442\u044c|\u043f\u0440\u044f\u043c\u043e|\u0442\u0430\u043a|\u0432\u0441[\u0435\u0451]|\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e|\u043d\u0435\u0443\u0436\u0435\u043b\u0438)\\s(\u0442\u0430\u043a\u0438)"+this.data("ru/dash").after,"g");return e.replace(r,"$1-$2$3")}}),function(){var e=["\u043e\u0442\u043a\u0443\u0434\u0430","\u043a\u0443\u0434\u0430","\u0433\u0434\u0435","\u043a\u043e\u0433\u0434\u0430","\u0437\u0430\u0447\u0435\u043c","\u043f\u043e\u0447\u0435\u043c\u0443","\u043a\u0430\u043a","\u043a\u0430\u043a\u043e[\u0435\u0439\u043c]","\u043a\u0430\u043a\u0430\u044f","\u043a\u0430\u043a\u0438[\u0435\u043c\u0445]","\u043a\u0430\u043a\u0438\u043c\u0438","\u043a\u0430\u043a\u0443\u044e","\u0447\u0442\u043e","\u0447\u0435\u0433\u043e","\u0447\u0435[\u0439\u043c]","\u0447\u044c\u0438\u043c?","\u043a\u0442\u043e","\u043a\u043e\u0433\u043e","\u043a\u043e\u043c\u0443","\u043a\u0435\u043c"];Typograf.rule({name:"ru/dash/to",sortIndex:30,func:function(r){var n=new RegExp("("+e.join("|")+")( | ?- ?)(\u0442\u043e|\u043b\u0438\u0431\u043e|\u043d\u0438\u0431\u0443\u0434\u044c)"+this.data("ru/dash").after,"gi");return r.replace(n,"$1-$3$4")}})}(),Typograf.rule({name:"ru/dash/weekday",sortIndex:600,func:function(e){var r="("+this.data("ru/weekday").join("|")+")",n=new RegExp(r+" ?("+this.data("common/dash")+") ?"+r,"gi");return e.replace(n,"$1"+this.setting("ru/dash/main","dashInterval")+"$3")}}),Typograf.rule({name:"common/nbsp/afterNumber",sortIndex:615,func:function(e){var r="(^|\\D)(\\d{1,5}) (["+this.letters()+"]{2,})";return e.replace(new RegExp(r,"gi"),"$1$2\xa0$3")}}),Typograf.rule({name:"common/nbsp/afterPara",sortIndex:610,func:function(e){return e.replace(/\xa7 ?(\d|I|V|X)/g,"\xa7\xa0$1")}}),Typograf.rule({name:"common/nbsp/afterShortWord",sortIndex:590,func:function(e,r){var n=r.lengthShortWord,a="(^| |\xa0)(["+this.letters()+"]{1,"+n+"})(\\.?) ",t=new RegExp(a,"gi");return e.replace(t,"$1$2$3\xa0").replace(t,"$1$2$3\xa0")},settings:{lengthShortWord:2}}),Typograf.rule({name:"common/nbsp/beforeShortLastWord",sortIndex:620,func:function(e,r){var n=r.lengthLastWord,a=new RegExp(" (["+this.letters()+"]{1,"+n+"})(\\.|\\?|:|!|,)","gi");return e.replace(a,"\xa0$1$2")},settings:{lengthLastWord:3}}),Typograf.rule({name:"common/nbsp/dpi",sortIndex:1150,func:function(e){return e.replace(/(\d) ?(lpi|dpi)(?!\w)/,"$1\xa0$2")}}),function(){function e(e,r,n,a){return r+n.replace(/([^\u00A0])\u00A0([^\u00A0])/g,"$1 $2")+a}Typograf.rule({name:"common/nbsp/nowrap",sortIndex:1400,func:function(r){return r.replace(/(<nowrap>)(.*?)(<\/nowrap>)/g,e).replace(/(<nobr>)(.*?)(<\/nobr>)/g,e)}})}(),Typograf._sortRules(),Typograf._needSortRules=!0;
function Typograf(e){this._prefs="object"==typeof e?e:{},this._settings={},this._enabledRules={},this._initSafeTags(),this._rules.forEach(this._prepareRule,this)}Typograf.rule=function(e){return e.enabled=e.enabled===!1?!1:!0,e._lang=e.name.split("/")[0],e.sortIndex=e.sortIndex||0,Typograf.prototype._rules.push(e),Typograf._needSortRules&&this._sortRules(),this},Typograf.innerRule=function(e){return Typograf.prototype._innerRules.push(e),e._lang=e.name.split("/")[0],e.sortIndex=e.sortIndex||0,Typograf._needSortRules&&this._sortInnerRules(),this},Typograf.data=function(e,r){Typograf.prototype._data[e]=r},Typograf._sortRules=function(){Typograf.prototype._rules.sort(function(e,r){return e.sortIndex>r.sortIndex?1:-1})},Typograf._sortInnerRules=function(){Typograf.prototype._innerRules.sort(function(e,r){return e.sortIndex>r.sortIndex?1:-1})},Typograf.prototype={constructor:Typograf,execute:function(e,r){r=r||{};var n=this,a=r.lang||this._prefs.lang||"common",t={},o={},u="undefined"==typeof r.mode?this._prefs.mode:r.mode,s=function(r){var n=r._lang;"common"!==n&&n!==a||!this.enabled(r.name)||(this._onBeforeRule&&this._onBeforeRule(e),e=r.func.call(this,e,this._settings[r.name]),this._onAfterRule&&this._onAfterRule(e))},c=function(e){o[e]&&o[e].forEach(s,n),t[e]&&t[e].forEach(s,n)};if(this._lang=a,e=""+e,!e)return"";e=this._fixLineEnd(e),this._innerRules.forEach(function(e){var r=e.queue;o[r]=o[r]||[],o[r].push(e)},this),this._rules.forEach(function(e){var r=e.queue;t[r]=t[r]||[],t[r].push(e)},this),c("start");var i=-1!==e.search(/<[a-z!]/i);return i&&(e=this._hideSafeTags(e)),e=this._utfication(e),c(),e=this._modification(e,u),i&&(e=this._showSafeTags(e)),c("end"),this._lang=null,e},setting:function(e,r,n){return arguments.length<=2?this._settings[e]&&this._settings[e][r]:(this._settings[e]=this._settings[e]||{},this._settings[e][r]=n,this)},enabled:function(e){return this._enabledRules[e]},disabled:function(e){return!this._enabledRules[e]},enable:function(e){return this._enable(e,!0)},disable:function(e){return this._enable(e,!1)},addSafeTag:function(e,r){this._safeTags.push([e,r])},letters:function(){var e=this._lang||this._prefs.lang,r=this.data("common/letter"),n=this.data(e+"/letter");return r!==n&&e?r+n:r},data:function(e){return this._data[e]},_data:{},_fixLineEnd:function(e){return e.replace(/\r\n/g,"\n").replace(/\r/g,"\n")},_prepareRule:function(e){var r=e.name;this._settings[r]=e.settings||{},this._enabledRules[r]=e.enabled},_enable:function(e,r){return Array.isArray(e)?e.forEach(function(e){this._enableByMask(e,r)},this):this._enableByMask(e,r),this},_enableByMask:function(e,r){var n;-1!==e.search(/\*/)?(n=new RegExp(e.replace(/\//g,"\\/").replace(/\*/g,".*")),this._rules.forEach(function(e){var a=e.name;n.test(a)&&(this._enabledRules[a]=r)},this)):this._enabledRules[e]=r},_rules:[],_innerRules:[],_initSafeTags:function(){this._safeTags=[["<!--","-->"],["<!ENTITY",">"],["<!DOCTYPE",">"],["<\\?xml","\\?>"],["<!\\[CDATA\\[","\\]\\]>"]],["code","kbd","object","pre","samp","script","style","var"].forEach(function(e){this._safeTags.push(["<"+e+"(\\s[^>]*?)?>","</"+e+">"])},this)},_hideSafeTags:function(e){return this._hiddenSafeTags={},this._iLabel=0,this._safeTags.forEach(function(r){var n=new RegExp(r[0]+"[^]*?"+r[1],"gi");e=e.replace(n,this._pasteLabel.bind(this))},this),this._hideHTMLTags(e)},_getPrivateLabel:function(e){return"\udbfftf"+e+"\udbff"},_pasteLabel:function(e){var r=this._getPrivateLabel(this._iLabel);return this._hiddenSafeTags[r]=e,this._iLabel++,r},_replaceLabel:function(e){return this._hiddenSafeTags[e]},_hideHTMLTags:function(e){return e.replace(/<[a-z\/][^]*?>/gi,this._pasteLabel.bind(this))},_showSafeTags:function(e){for(var r=0;r<this._safeTags.length&&(e=e.replace(/\uDBFFtf\d+\uDBFF/g,this._replaceLabel.bind(this)),-1!==e.search(/\uDBFFtf\d/));r++);return delete this._hiddenSafeTags,e},_utfication:function(e){return-1!==e.search(/&#/)&&(e=this._decHexToUtf(e)),-1!==e.search(/&[a-z]/i)&&this.entities.forEach(function(r){e=e.replace(r[3],r[2])}),e},_decHexToUtf:function(e){return e.replace(/&#(\d{1,6});/gi,function(e,r){return String.fromCharCode(parseInt(r,10))}).replace(/&#x([\da-f]{1,6});/gi,function(e,r){return String.fromCharCode(parseInt(r,16))})},_modification:function(e,r){if("name"===r||"digit"===r){var n="name"===r?0:1;this.entities.forEach(function(r){r[n]&&(e=e.replace(r[4],r[n]))})}return e}},"object"==typeof exports&&(module.exports=Typograf),Typograf.prototype.entities=[],[["nbsp",160],["iexcl",161],["cent",162],["pound",163],["curren",164],["yen",165],["brvbar",166],["sect",167],["uml",168],["copy",169],["ordf",170],["laquo",171],["not",172],["shy",173],["reg",174],["macr",175],["deg",176],["plusmn",177],["sup2",178],["sup3",179],["acute",180],["micro",181],["para",182],["middot",183],["cedil",184],["sup1",185],["ordm",186],["raquo",187],["frac14",188],["frac12",189],["frac34",190],["iquest",191],["Agrave",192],["Aacute",193],["Acirc",194],["Atilde",195],["Auml",196],["Aring",197],["AElig",198],["Ccedil",199],["Egrave",200],["Eacute",201],["Ecirc",202],["Euml",203],["Igrave",204],["Iacute",205],["Icirc",206],["Iuml",207],["ETH",208],["Ntilde",209],["Ograve",210],["Oacute",211],["Ocirc",212],["Otilde",213],["Ouml",214],["times",215],["Oslash",216],["Ugrave",217],["Uacute",218],["Ucirc",219],["Uuml",220],["Yacute",221],["THORN",222],["szlig",223],["agrave",224],["aacute",225],["acirc",226],["atilde",227],["auml",228],["aring",229],["aelig",230],["ccedil",231],["egrave",232],["eacute",233],["ecirc",234],["euml",235],["igrave",236],["iacute",237],["icirc",238],["iuml",239],["eth",240],["ntilde",241],["ograve",242],["oacute",243],["ocirc",244],["otilde",245],["ouml",246],["divide",247],["oslash",248],["ugrave",249],["uacute",250],["ucirc",251],["uuml",252],["yacute",253],["thorn",254],["yuml",255],["fnof",402],["Alpha",913],["Beta",914],["Gamma",915],["Delta",916],["Epsilon",917],["Zeta",918],["Eta",919],["Theta",920],["Iota",921],["Kappa",922],["Lambda",923],["Mu",924],["Nu",925],["Xi",926],["Omicron",927],["Pi",928],["Rho",929],["Sigma",931],["Tau",932],["Upsilon",933],["Phi",934],["Chi",935],["Psi",936],["Omega",937],["alpha",945],["beta",946],["gamma",947],["delta",948],["epsilon",949],["zeta",950],["eta",951],["theta",952],["iota",953],["kappa",954],["lambda",955],["mu",956],["nu",957],["xi",958],["omicron",959],["pi",960],["rho",961],["sigmaf",962],["sigma",963],["tau",964],["upsilon",965],["phi",966],["chi",967],["psi",968],["omega",969],["thetasym",977],["upsih",978],["piv",982],["bull",8226],["hellip",8230],["prime",8242],["Prime",8243],["oline",8254],["frasl",8260],["weierp",8472],["image",8465],["real",8476],["trade",8482],["alefsym",8501],["larr",8592],["uarr",8593],["rarr",8594],["darr",8595],["harr",8596],["crarr",8629],["lArr",8656],["uArr",8657],["rArr",8658],["dArr",8659],["hArr",8660],["forall",8704],["part",8706],["exist",8707],["empty",8709],["nabla",8711],["isin",8712],["notin",8713],["ni",8715],["prod",8719],["sum",8721],["minus",8722],["lowast",8727],["radic",8730],["prop",8733],["infin",8734],["ang",8736],["and",8743],["or",8744],["cap",8745],["cup",8746],["int",8747],["there4",8756],["sim",8764],["cong",8773],["asymp",8776],["ne",8800],["equiv",8801],["le",8804],["ge",8805],["sub",8834],["sup",8835],["nsub",8836],["sube",8838],["supe",8839],["oplus",8853],["otimes",8855],["perp",8869],["sdot",8901],["lceil",8968],["rceil",8969],["lfloor",8970],["rfloor",8971],["lang",9001],["rang",9002],["spades",9824],["clubs",9827],["hearts",9829],["diams",9830],["loz",9674],["OElig",338],["oelig",339],["Scaron",352],["scaron",353],["Yuml",376],["circ",710],["tilde",732],["ensp",8194],["emsp",8195],["thinsp",8201],["zwnj",8204],["zwj",8205],["lrm",8206],["rlm",8207],["ndash",8211],["mdash",8212],["lsquo",8216],["rsquo",8217],["sbquo",8218],["ldquo",8220],["rdquo",8221],["bdquo",8222],["dagger",8224],["Dagger",8225],["permil",8240],["lsaquo",8249],["rsaquo",8250],["euro",8364]].forEach(function(e){var r=e[0],n=e[1],a=String.fromCharCode(n),t=["&"+r+";","&#"+n+";",a,new RegExp("&"+r+";","g"),new RegExp(a,"g")];Typograf.prototype.entities.push(t)},this),Typograf.data("common/dash","--?|\u2012|\u2013|\u2014"),Typograf.data("common/letter","a-z"),Typograf.data("common/quot","\xab\u2039\xbb\u203a\u201e\u201a\u201c\u201f\u2018\u201b\u201d\u2019\"'"),Typograf.data("en/letter","a-z"),Typograf.data("ru/letter","\u0430-\u044f\u0451"),Typograf.data("ru/month",["\u044f\u043d\u0432\u0430\u0440\u044c","\u0444\u0435\u0432\u0440\u0430\u043b\u044c","\u043c\u0430\u0440\u0442","\u0430\u043f\u0440\u0435\u043b\u044c","\u043c\u0430\u0439","\u0438\u044e\u043d\u044c","\u0438\u044e\u043b\u044c","\u0430\u0432\u0433\u0443\u0441\u0442","\u0441\u0435\u043d\u0442\u044f\u0431\u0440\u044c","\u043e\u043a\u0442\u044f\u0431\u0440\u044c","\u043d\u043e\u044f\u0431\u0440\u044c","\u0434\u0435\u043a\u0430\u0431\u0440\u044c"]),Typograf.data("ru/monthCase",["\u044f\u043d\u0432\u0430\u0440\u044f","\u0444\u0435\u0432\u0440\u0430\u043b\u044f","\u043c\u0430\u0440\u0442\u0430","\u0430\u043f\u0440\u0435\u043b\u044f","\u043c\u0430\u044f","\u0438\u044e\u043d\u044f","\u0438\u044e\u043b\u044f","\u0430\u0432\u0433\u0443\u0441\u0442\u0430","\u0441\u0435\u043d\u0442\u044f\u0431\u0440\u044f","\u043e\u043a\u0442\u044f\u0431\u0440\u044f","\u043d\u043e\u044f\u0431\u0440\u044f","\u0434\u0435\u043a\u0430\u0431\u0440\u044f"]),Typograf.data("ru/shortMonth",["\u044f\u043d\u0432","\u0444\u0435\u0432","\u043c\u0430\u0440","\u0430\u043f\u0440","\u043c\u0430[\u0435\u0439\u044f]","\u0438\u044e\u043d","\u0438\u044e\u043b","\u0430\u0432\u0433","\u0441\u0435\u043d","\u043e\u043a\u0442","\u043d\u043e\u044f","\u0434\u0435\u043a"]),Typograf.data("ru/weekday",["\u043f\u043e\u043d\u0435\u0434\u0435\u043b\u044c\u043d\u0438\u043a","\u0432\u0442\u043e\u0440\u043d\u0438\u043a","\u0441\u0440\u0435\u0434\u0430","\u0447\u0435\u0442\u0432\u0435\u0440\u0433","\u043f\u044f\u0442\u043d\u0438\u0446\u0430","\u0441\u0443\u0431\u0431\u043e\u0442\u0430","\u0432\u043e\u0441\u043a\u0440\u0435\u0441\u0435\u043d\u044c\u0435"]),Typograf.rule({name:"common/html/escape",sortIndex:110,queue:"end",func:function(e){var r={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;","/":"&#x2F;"};return e.replace(/[&<>"'\/]/g,function(e){return r[e]})},enabled:!1}),Typograf.rule({name:"common/html/mail",sortIndex:2e3,func:function(e){return e.replace(/(^|[\s;(])([\w\-.]{2,})@([\w\-.]{2,})\.([a-z]{2,6})([)\s.,!?]|$)/gi,'$1<a href="mailto:$2@$3.$4">$2@$3.$4</a>$5')},enabled:!1}),Typograf.rule({name:"common/html/nbr",sortIndex:2020,func:function(e){return-1===e.search(/<br/)?e.replace(/\n/g,"<br/>\n"):e},enabled:!1}),Typograf.rule({name:"common/html/pbr",sortIndex:2030,func:function(e){return-1===e.search(/\n/)?e="<p>"+e+"</p>":(e="<p>"+e.replace(/\n\n/g,"</p>\n<p>")+"</p>",e=e.replace(/([^>])\n/g,"$1<br/>\n")),e},enabled:!1}),Typograf.rule({name:"common/html/stripTags",sortIndex:100,queue:"end",func:function(e){return e.replace(/<\/?[^>]+>/g,"")},enabled:!1}),Typograf.rule({name:"common/html/url",sortIndex:2010,func:function(e){var r="(http|https|ftp|telnet|news|gopher|file|wais)://",n="([a-zA-Z0-9/\\n+-=%&:_.~?]+[a-zA-Z0-9#+]*)",a=new RegExp(r+n,"g");return e.replace(a,function(e,r,n){var a=n,t=r+"://"+n,o='<a href="'+t+'">';return"http"===r?(a=a.replace(/^www\./,"").replace(/^([^\/]+)\/$/,"$1"),o+a+"</a>"):o+t+"</a>"})}}),Typograf.rule({name:"common/nbsp/afterNumber",sortIndex:615,func:function(e){var r="(^|\\D)(\\d{1,5}) (["+this.letters()+"]{2,})";return e.replace(new RegExp(r,"gi"),"$1$2\xa0$3")}}),Typograf.rule({name:"common/nbsp/afterPara",sortIndex:610,func:function(e){return e.replace(/\xa7 ?(\d|I|V|X)/g,"\xa7\xa0$1")}}),Typograf.rule({name:"common/nbsp/afterShortWord",sortIndex:590,func:function(e,r){var n=r.lengthShortWord,a="(^| |\xa0)(["+this.letters()+"]{1,"+n+"})(\\.?) ",t=new RegExp(a,"gi");return e.replace(t,"$1$2$3\xa0").replace(t,"$1$2$3\xa0")},settings:{lengthShortWord:2}}),Typograf.rule({name:"common/nbsp/beforeShortLastWord",sortIndex:620,func:function(e,r){var n=r.lengthLastWord,a=new RegExp(" (["+this.letters()+"]{1,"+n+"})(\\.|\\?|:|!|,)","gi");return e.replace(a,"\xa0$1$2")},settings:{lengthLastWord:3}}),Typograf.rule({name:"common/nbsp/dpi",sortIndex:1150,func:function(e){return e.replace(/(\d) ?(lpi|dpi)(?!\w)/,"$1\xa0$2")}}),function(){function e(e,r,n,a){return r+n.replace(/([^\u00A0])\u00A0([^\u00A0])/g,"$1 $2")+a}Typograf.rule({name:"common/nbsp/nowrap",sortIndex:1400,func:function(r){return r.replace(/(<nowrap>)(.*?)(<\/nowrap>)/g,e).replace(/(<nobr>)(.*?)(<\/nobr>)/g,e)}})}(),Typograf.rule({name:"common/other/repeatWord",sortIndex:1200,func:function(e){var r="(["+this.letters()+"\u0301]+) \\1([;:,.?! \n])";return e.replace(new RegExp(r,"gi"),"$1$2")},enabled:!1}),Typograf.rule({name:"common/number/fraction",sortIndex:1120,func:function(e){return e.replace(/(^|\D)1\/2(\D|$)/g,"$1\xbd$2").replace(/(^|\D)1\/4(\D|$)/g,"$1\xbc$2").replace(/(^|\D)3\/4(\D|$)/g,"$1\xbe$2")}}),Typograf.rule({name:"common/number/plusMinus",sortIndex:1010,func:function(e){var r=new RegExp("(^| |\\>|\xa0)\\+-(\\d)","g");return e.replace(r,"$1\xb1$2").replace(/(^\s*)\+-(\s*$)/g,"$1\xb1$2")}}),Typograf.rule({name:"common/number/times",sortIndex:1050,func:function(e){return e.replace(/(\d) ?(x|\u0445) ?(\d)/g,"$1\xd7$3")}}),Typograf.rule({name:"common/punctuation/delDoublePunctuation",sortIndex:580,func:function(e){return e.replace(/(,|:|;|\?){2,}/g,"$1")}}),Typograf.rule({name:"common/punctuation/exclamation",sortIndex:1150,func:function(e){return e.replace(/(^|[^!])!{2}($|[^!])/,"$1!$2").replace(/(^|[^!])!{4}($|[^!])/,"$1!!!$2")}}),Typograf.rule({name:"common/punctuation/exclamationQuestion",sortIndex:1140,func:function(e){var r=new RegExp("(^|[^!])!\\?([^?]|$)","g");return e.replace(r,"$1?!$2")}}),Typograf.rule({name:"common/punctuation/hellip",sortIndex:20,func:function(e){return e.replace(/(^|[^.])\.{3,4}([^.]|$)/g,"$1\u2026$2")}}),Typograf.rule({name:"common/space/afterPunctuation",sortIndex:560,func:function(e){var r=new RegExp("(!|;|\\?)([^ \udbff\n !;?"+this.data("common/quot")+"[])","g");return e.replace(r,"$1 $2").replace(/(\D)(,|:)([^ \uDBFF\n\t,.?:])/g,"$1$2 $3")}}),Typograf.rule({name:"common/space/delBeforePercent",sortIndex:600,func:function(e){return e.replace(/(\d)( |\u00A0)(%|\u2030|\u2031)/g,"$1$3")}}),Typograf.rule({name:"common/space/delBeforePunctuation",sortIndex:550,func:function(e){return e.replace(/ (!|;|,|\?|\.|:)/g,"$1").replace(/\( /g,"(").replace(/([^ ])\(/g,"$1 (").replace(/ \)/g,")").replace(/\)([^!;,\?\.:])/g,") $1")}}),Typograf.rule({name:"common/space/delLeadingBlanks",sortIndex:504,func:function(e){return e.replace(/\n[ \t]+/g,"\n")},enabled:!1}),Typograf.rule({name:"common/space/delRepeatN",sortIndex:545,func:function(e){return e.replace(/\n{3,}/g,"\n\n")}}),Typograf.rule({name:"common/space/delRepeatSpace",sortIndex:540,func:function(e){return e.replace(/([^\n \t])( |\t){2,}([^\n \t])/g,"$1$2$3")}}),Typograf.rule({name:"common/space/delTrailingBlanks",sortIndex:505,func:function(e){return e.replace(/[ \t]+\n/g,"\n")}}),Typograf.rule({name:"common/space/replaceTab",sortIndex:510,func:function(e){return e.replace(/\t/g," ")}}),Typograf.rule({name:"common/space/trimLeft",sortIndex:530,func:String.prototype.trimLeft?function(e){return e.trimLeft()}:function(e){return e.replace(/^[\s\uFEFF\xA0]+/g,"")}}),Typograf.rule({name:"common/space/trimRight",sortIndex:535,func:String.prototype.trimRight?function(e){return e.trimRight()}:function(e){return e.replace(/[\s\uFEFF\xA0]+$/g,"")}}),Typograf.rule({name:"common/sym/arrow",sortIndex:1130,func:function(e){return e.replace(/(^|[^-])->(?!>)/g,"$1\u2192").replace(/(^|[^<])<-(?!-)/g,"$1\u2190")}}),Typograf.rule({name:"common/sym/cf",sortIndex:1020,func:function(e){var r=new RegExp('(\\d+)( |\xa0)?(C|F)([\\W \\.,:!\\?"\\]\\)]|$)',"g");return e.replace(r,"$1\u2009\xb0$3$4")}}),Typograf.rule({name:"common/sym/copy",sortIndex:10,func:function(e){return e.replace(/\(r\)/gi,"\xae").replace(/(copyright )?\((c|\u0441)\)/gi,"\xa9").replace(/\(tm\)/gi,"\u2122")}}),Typograf.rule({name:"ru/money/dollar",sortIndex:1140,func:function(e){var r=new RegExp("(^|[\\D]{2,})\\$ ?([\\d.,]+)","g"),n=new RegExp("(^|[\\D])([\\d.,]+) ?\\$","g"),a="$1$2\xa0$";return e.replace(r,a).replace(n,a)}}),Typograf.rule({name:"ru/money/euro",sortIndex:1140,func:function(e){var r=new RegExp("(^|[\\D]{2,})\u20ac ?([\\d.]+)","g"),n=new RegExp("(^|[\\D])([\\d.,]+) ?\u20ac","g"),a="$1$2\xa0\u20ac";return e.replace(r,a).replace(n,a)}}),Typograf.rule({name:"ru/money/ruble",sortIndex:1145,func:function(e){var r="$1\xa0\u20bd";return e.replace(/^(\d+)( |\u00A0)?(\u0440|\u0440\u0443\u0431)\.$/,r).replace(/(\d+)( |\u00A0)?(\u0440|\u0440\u0443\u0431)\.(?=[!?,:;])/g,r).replace(/(\d+)( |\u00A0)?(\u0440|\u0440\u0443\u0431)\.(?=\s+[A-\u042f\u0401])/g,r+".")},enabled:!1}),Typograf.rule({name:"ru/date/main",sortIndex:1300,func:function(e){var r="(-|\\.|\\/)",n="(-|\\/)",a=new RegExp("(^|\\D)(\\d{4})"+r+"(\\d{2})"+r+"(\\d{2})(\\D|$)","gi"),t=new RegExp("(^|\\D)(\\d{2})"+n+"(\\d{2})"+n+"(\\d{4})(\\D|$)","gi");return e.replace(a,"$1$6.$4.$2$7").replace(t,"$1$4.$2.$6$7")}}),Typograf.rule({name:"ru/date/weekday",sortIndex:1310,func:function(e){var r="( |\xa0)",n=this.data("ru/monthCase").join("|"),a=this.data("ru/weekday").join("|"),t=new RegExp("(\\d)"+r+"("+n+"),"+r+"("+a+")","gi");return e.replace(t,function(){var e=arguments;return e[1]+e[2]+e[3].toLowerCase()+","+e[4]+e[5].toLowerCase()})}}),Typograf.rule({name:"ru/number/ordinals",sortIndex:1300,func:function(e){return e.replace(/(\d)-(\u044b\u0439|\u043e\u0439)([^\u0430-\u044f\u0451]|$)/g,"$1-\u0439$3").replace(/(\d)-\u0430\u044f([^\u0430-\u044f\u0451]|$)/g,"$1-\u044f$2").replace(/(\d)-(\u043e\u0435|\u044b\u0435)([^\u0430-\u044f\u0451]|$)/g,"$1-\u0435$3").replace(/(\d)-(\u044b\u043c|\u043e\u043c)([^\u0430-\u044f\u0451]|$)/g,"$1-\u043c$3").replace(/(\d)-\u044b\u0445([^\u0430-\u044f\u0451]|$)/g,"$1-\u0445$2").replace(/(\d)-\u043e\u0433\u043e([^\u0430-\u044f\u0451]|$)/g,"$1-\u0433\u043e$2").replace(/(\d)-\u043e\u043c\u0443([^\u0430-\u044f\u0451]|$)/g,"$1-\u043c\u0443$2").replace(/(\d)-\u044b\u043c\u0438([^\u0430-\u044f\u0451]|$)/g,"$1-\u043c\u0438$2")}}),Typograf.rule({name:"ru/nbsp/afterNumberSign",sortIndex:610,func:function(e){return e.replace(/\u2116 ?(\d|\u043f\/\u043f)/g,"\u2116\xa0$1")}}),Typograf.rule({name:"ru/nbsp/beforeParticle",sortIndex:570,func:function(e){return e.replace(/ (\u043b\u0438|\u043b\u044c|\u0436\u0435|\u0436|\u0431\u044b|\u0431)([^\u0430-\u044f\u0451\u0410-\u042f\u0401])/g,"\xa0$1$2")}}),Typograf.rule({name:"ru/nbsp/but",sortIndex:1110,func:function(e){var r=new RegExp(",?( |\xa0|\n)(\u0430|\u043d\u043e)( |\xa0|\n)","g");return e.replace(r,",$1$2$3")}}),Typograf.rule({name:"ru/nbsp/cc",sortIndex:1090,func:function(e){return e=e.replace(/(^|\d|V|I|X) ?\u0432(\u0432)?( |,|;|\n|$)/g,"$1\xa0\u0432$2.$3"),e.replace(/(^|\d|[IVX]) ?\u0432\.? ?\u0432\./g,"$1\xa0\u0432\u0432.")}}),Typograf.rule({name:"ru/nbsp/dayMonth",sortIndex:1105,func:function(e){var r=new RegExp("(\\d{1,2}) ("+this.data("ru/shortMonth").join("|")+")","gi");return e.replace(r,"$1\xa0$2")}}),Typograf.rule({name:"ru/nbsp/m",sortIndex:1030,func:function(e){var r="(\u043a\u043c|\u043c|\u0434\u043c|\u0441\u043c|\u043c\u043c)",n=new RegExp("(^|\\D)(\\d+) ?"+r+"2(\\D|$)","g"),a=new RegExp("(^|\\D)(\\d+) ?"+r+"3(\\D|$)","g");return e.replace(n,"$1$2\xa0$3\xb2$4").replace(a,"$1$2\xa0$3\xb3$4")}}),Typograf.rule({name:"ru/nbsp/ooo",sortIndex:1100,func:function(e){return e.replace(/(^|[^a-\u044f\u0451A-\u042f\u0401])(\u041e\u041e\u041e|\u041e\u0410\u041e|\u0417\u0410\u041e|\u041d\u0418\u0418|\u041f\u0411\u041e\u042e\u041b) /g,"$1$2\xa0")}}),Typograf.rule({name:"ru/nbsp/page",sortIndex:610,func:function(e){return e.replace(/ (\u0441\u0442\u0440|\u0433\u043b|\u0440\u0438\u0441|\u0438\u043b\u043b)\./g,"\xa0$1.")}}),Typograf.rule({name:"ru/nbsp/xxxx",sortIndex:1060,func:function(e){return e.replace(/(^|\D)(\d{1,4}) ?\u0433(\u043e\u0434| |,|;|\.|\n|$)/g,"$1$2\xa0\u0433$3")}}),Typograf.rule({name:"ru/nbsp/yy",sortIndex:1080,func:function(e){return e.replace(/(^|\d) ?\u0433\. ?\u0433\./g,"$1\xa0\u0433\u0433.")}}),Typograf.data("ru/dash",{before:"(^| |\\n)",after:"( |,|\\.|\\?|:|!|$)"}),Typograf.rule({name:"ru/dash/izpod",sortIndex:35,func:function(e){var r=this.data("ru/dash"),n=new RegExp(r.before+"(\u0418|\u0438)\u0437 \u043f\u043e\u0434"+r.after,"g");return e.replace(n,"$1$2\u0437-\u043f\u043e\u0434$3")}}),Typograf.rule({name:"ru/dash/izza",sortIndex:33,func:function(e){var r=this.data("ru/dash"),n=new RegExp(r.before+"(\u0418|\u0438)\u0437 \u0437\u0430"+r.after,"g");return e.replace(n,"$1$2\u0437-\u0437\u0430$3")}}),Typograf.rule({name:"ru/dash/kade",sortIndex:31,func:function(e){var r=new RegExp("([a-\u044f\u0451]+)( | ?- ?)(\u043a\u0430|\u0434\u0435|\u043a\u0430\u0441\u044c)"+this.data("ru/dash").after,"g");return e.replace(r,"$1-$3$4")}}),Typograf.rule({name:"ru/dash/koe",sortIndex:38,func:function(e){var r=this.data("ru/dash"),n=new RegExp(r.before+"([\u041a\u043a]\u043e[\u0435\u0439])\\s([\u0430-\u044f\u0451]{3,})"+r.after,"g");return e.replace(n,"$1$2-$3$4")}}),Typograf.rule({name:"ru/dash/main",sortIndex:620,func:function(e){var r="ru/dash/main",n="("+this.data("common/dash")+")",a=new RegExp("( |\xa0)"+n+"( |\\n)","g"),t=new RegExp("(^|\n)"+n+"( |\xa0)","g"),o=new RegExp("(X|I|V)(?: |\xa0)?"+n+"(?: |\xa0)?(X|I|V)","g");return e.replace(a,"\xa0"+this.setting(r,"dash")+"$3").replace(t,"$1"+this.setting(r,"dash")+"\xa0").replace(o,"$1"+this.setting(r,"dashInterval")+"$3")},settings:{dash:"\u2014",dashInterval:"\u2014"}}),Typograf.rule({name:"ru/dash/month",sortIndex:610,func:function(e){var r="("+this.data("ru/month").join("|")+")",n=new RegExp(r+" ?("+this.data("common/dash")+") ?"+r,"gi");return e.replace(n,"$1"+this.setting("ru/dash/main","dashInterval")+"$3")}}),Typograf.rule({name:"ru/dash/taki",sortIndex:39,func:function(e){var r=new RegExp("(\u0432\u0435\u0440\u043d\u043e|\u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e|\u043e\u043f\u044f\u0442\u044c|\u043f\u0440\u044f\u043c\u043e|\u0442\u0430\u043a|\u0432\u0441[\u0435\u0451]|\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e|\u043d\u0435\u0443\u0436\u0435\u043b\u0438)\\s(\u0442\u0430\u043a\u0438)"+this.data("ru/dash").after,"g");return e.replace(r,"$1-$2$3")}}),function(){var e=["\u043e\u0442\u043a\u0443\u0434\u0430","\u043a\u0443\u0434\u0430","\u0433\u0434\u0435","\u043a\u043e\u0433\u0434\u0430","\u0437\u0430\u0447\u0435\u043c","\u043f\u043e\u0447\u0435\u043c\u0443","\u043a\u0430\u043a","\u043a\u0430\u043a\u043e[\u0435\u0439\u043c]","\u043a\u0430\u043a\u0430\u044f","\u043a\u0430\u043a\u0438[\u0435\u043c\u0445]","\u043a\u0430\u043a\u0438\u043c\u0438","\u043a\u0430\u043a\u0443\u044e","\u0447\u0442\u043e","\u0447\u0435\u0433\u043e","\u0447\u0435[\u0439\u043c]","\u0447\u044c\u0438\u043c?","\u043a\u0442\u043e","\u043a\u043e\u0433\u043e","\u043a\u043e\u043c\u0443","\u043a\u0435\u043c"];Typograf.rule({name:"ru/dash/to",sortIndex:30,func:function(r){var n=new RegExp("("+e.join("|")+")( | ?- ?)(\u0442\u043e|\u043b\u0438\u0431\u043e|\u043d\u0438\u0431\u0443\u0434\u044c)"+this.data("ru/dash").after,"gi");return r.replace(n,"$1-$3$4")}})}(),Typograf.rule({name:"ru/dash/weekday",sortIndex:600,func:function(e){var r="("+this.data("ru/weekday").join("|")+")",n=new RegExp(r+" ?("+this.data("common/dash")+") ?"+r,"gi");return e.replace(n,"$1"+this.setting("ru/dash/main","dashInterval")+"$3")}}),Typograf.rule({name:"ru/other/accent",sortIndex:560,enabled:!1,func:function(e){return e.replace(/([\u0430-\u044f\u0451])([\u0410\u0415\u0401\u0418\u041e\u0423\u042b\u042d\u042e\u042f])([^\u0410-\u042f\u0401\w]|$)/g,function(e,r,n,a){return r+n.toLowerCase()+"\u0301"+a})}}),Typograf.rule({name:"ru/optalign/bracket",sortIndex:1001,func:function(e){return e.replace(/( |\u00A0)\(/g,'<span class="typograf-oa-sp-lbracket">$1</span><span class="typograf-oa-lbracket">(</span>').replace(/(^|\n)\(/g,'$1<span class="typograf-oa-n-lbracket">(</span>')},enabled:!1}).innerRule({name:"ru/optalign/bracket",func:function(e){return e.replace(/<span class="typograf-oa-(sp-lbracket|lbracket|n-lbracket)">(.*?)<\/span>/g,"$2")}}),Typograf.rule({name:"ru/optalign/comma",sortIndex:1002,func:function(e){var r=new RegExp("(["+this.letters()+"0-9\u0301]+), ","gi");return e.replace(r,'$1<span class="typograf-oa-comma">,</span><span class="typograf-oa-comma-sp"> </span>')},enabled:!1}).innerRule({name:"ru/optalign/comma",func:function(e){return e.replace(/<span class="typograf-oa-(comma|comma-sp)">(.*?)<\/span>/g,"$2")}}),Typograf.rule({name:"ru/optalign/quot",sortIndex:1e3,func:function(e){var r='(["'+this.setting("ru/punctuation/quot","lquot")+this.setting("ru/punctuation/quot","lquot2")+"])",n=new RegExp("(["+this.letters()+"\\-\u0301!?.:;,]+)( |\xa0)("+r+")","gi"),a=new RegExp("(^|\n|\udbff)"+r,"g");return e.replace(n,'$1<span class="typograf-oa-sp-lquot">$2</span><span class="typograf-oa-lquot">$3</span>').replace(a,'$1<span class="typograf-oa-n-lquot">$2</span>')},enabled:!1}).innerRule({name:"ru/optalign/quot",func:function(e){return e.replace(/<span class="typograf-oa-(sp-lquot|lquot|n-lquot)">(.*?)<\/span>/g,"$2")}}),Typograf.rule({name:"ru/punctuation/quot",sortIndex:700,func:function(e,r){var n="\\d"+this.letters()+"\u0301",a=r.lquot,t=r.rquot,o=r.lquot2,u=r.rquot2,s="["+n+")!?.:;#*,]*?",c=new RegExp('[\xab\u201e\u201c"]([\u2026'+n+"\\n])","gi"),i=new RegExp("("+s+')[\xbb\u201d\u201c"]('+s+")","gi"),p=new RegExp(u+"([^"+o+u+"]*?)"+u,"g"),l=new RegExp(o+"([^"+o+u+"]*?)"+o,"g"),f=new RegExp(o,"g"),g=new RegExp(u,"g");return e=e.replace(c,o+"$1").replace(i,"$1"+u+"$2").replace(new RegExp("(^|\\w|\\s)"+u+o,"g"),"$1"+o+o),a===o&&t===u?e=e.replace(f,a).replace(g,t).replace(new RegExp(a+a,"g"),a).replace(new RegExp(t+t,"g"),t):(e=e.replace(p,u+"$1"+t).replace(l,a+"$1"+o),-1===e.search(new RegExp(a+"|"+t))&&(e=e.replace(f,a).replace(g,t))),e},settings:{lquot:"\xab",rquot:"\xbb",lquot2:"\u201e",rquot2:"\u201c"}}),Typograf._sortRules(),Typograf._needSortRules=!0;
Typograf.prototype.titles = {
"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/html/escape": {

@@ -26,26 +50,2 @@ "en": "Escaping HTML",

},
"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/number/fraction": {

@@ -128,2 +128,18 @@ "common": "1/2 → ½, 1/4 → ¼, 3/3 → ¾"

},
"ru/money/dollar": {
"common": "$100 → 100 $"
},
"ru/money/euro": {
"common": "€100 → 100 €"
},
"ru/money/ruble": {
"common": "1 руб. → 1 ₽"
},
"ru/date/main": {
"en": "Converting dates YYYY-MM-DD type DD.MM.YYYY",
"ru": "Преобразование дат YYYY-MM-DD к виду DD.MM.YYYY"
},
"ru/date/weekday": {
"common": "2 Мая, Понедельник → 2 мая, понедельник"
},
"ru/dash/izpod": {

@@ -165,18 +181,5 @@ "en": "Hyphen between “из-под”",

},
"ru/date/main": {
"en": "Converting dates YYYY-MM-DD type DD.MM.YYYY",
"ru": "Преобразование дат YYYY-MM-DD к виду DD.MM.YYYY"
"ru/number/ordinals": {
"common": "N-ый, -ой, -ая, -ое, -ые, -ым, -ом, -ых → N-й, -я, -е, -м, -х (25-й)"
},
"ru/date/weekday": {
"common": "2 Мая, Понедельник → 2 мая, понедельник"
},
"ru/money/dollar": {
"common": "$100 → 100 $"
},
"ru/money/euro": {
"common": "€100 → 100 €"
},
"ru/money/ruble": {
"common": "1 руб. → 1 ₽"
},
"ru/nbsp/afterNumberSign": {

@@ -222,5 +225,2 @@ "en": "Non-breaking space after №",

},
"ru/number/ordinals": {
"common": "N-ый, -ой, -ая, -ое, -ые, -ым, -ом, -ых → N-й, -я, -е, -м, -х (25-й)"
},
"ru/optalign/bracket": {

@@ -227,0 +227,0 @@ "en": "for opening bracket",

{
"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/html/escape": {

@@ -26,26 +50,2 @@ "en": "Escaping HTML",

},
"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/number/fraction": {

@@ -128,2 +128,18 @@ "common": "1/2 → ½, 1/4 → ¼, 3/3 → ¾"

},
"ru/money/dollar": {
"common": "$100 → 100 $"
},
"ru/money/euro": {
"common": "€100 → 100 €"
},
"ru/money/ruble": {
"common": "1 руб. → 1 ₽"
},
"ru/date/main": {
"en": "Converting dates YYYY-MM-DD type DD.MM.YYYY",
"ru": "Преобразование дат YYYY-MM-DD к виду DD.MM.YYYY"
},
"ru/date/weekday": {
"common": "2 Мая, Понедельник → 2 мая, понедельник"
},
"ru/dash/izpod": {

@@ -165,18 +181,5 @@ "en": "Hyphen between “из-под”",

},
"ru/date/main": {
"en": "Converting dates YYYY-MM-DD type DD.MM.YYYY",
"ru": "Преобразование дат YYYY-MM-DD к виду DD.MM.YYYY"
"ru/number/ordinals": {
"common": "N-ый, -ой, -ая, -ое, -ые, -ым, -ом, -ых → N-й, -я, -е, -м, -х (25-й)"
},
"ru/date/weekday": {
"common": "2 Мая, Понедельник → 2 мая, понедельник"
},
"ru/money/dollar": {
"common": "$100 → 100 $"
},
"ru/money/euro": {
"common": "€100 → 100 €"
},
"ru/money/ruble": {
"common": "1 руб. → 1 ₽"
},
"ru/nbsp/afterNumberSign": {

@@ -222,5 +225,2 @@ "en": "Non-breaking space after №",

},
"ru/number/ordinals": {
"common": "N-ый, -ой, -ая, -ое, -ые, -ым, -ом, -ых → N-й, -я, -е, -м, -х (25-й)"
},
"ru/optalign/bracket": {

@@ -227,0 +227,0 @@ "en": "for opening bracket",

@@ -62,3 +62,3 @@ ## Правила типографа по порядку выполнения

| 57. | [common/nbsp/nowrap](../src/rules/common/nbsp/nowrap.js) | Заменять нераз. пробел на обычный пробел в тегах nowrap и nobr | 1400 | | ✓ |
| 58. | [common/html/mail](../src/rules/common/html/mail.js) | Расстановка ссылок для эл. почты | 2000 | | ✓ |
| 58. | [common/html/mail](../src/rules/common/html/mail.js) | Расстановка ссылок для эл. почты | 2000 | | |
| 59. | [common/html/url](../src/rules/common/html/url.js) | Расстановка ссылок | 2010 | | ✓ |

@@ -65,0 +65,0 @@ | 60. | [common/html/nbr](../src/rules/common/html/nbr.js) | Замена перевода строки на тег br | 2020 | | |

@@ -6,3 +6,3 @@ ## Правила типографа

| 1. | [common/html/escape](../src/rules/common/html/escape.js) | Экранирование HTML | 110 | end | |
| 2. | [common/html/mail](../src/rules/common/html/mail.js) | Расстановка ссылок для эл. почты | 2000 | | ✓ |
| 2. | [common/html/mail](../src/rules/common/html/mail.js) | Расстановка ссылок для эл. почты | 2000 | | |
| 3. | [common/html/nbr](../src/rules/common/html/nbr.js) | Замена перевода строки на тег br | 2020 | | |

@@ -9,0 +9,0 @@ | 4. | [common/html/pbr](../src/rules/common/html/pbr.js) | Расстановка тегов p и br | 2030 | | |

{
"name": "typograf",
"description": "The client and server typographer",
"version": "2.8.0",
"version": "2.8.1",
"author": {

@@ -11,2 +11,5 @@ "name": "Denis Seleznev",

"main": "dist/typograf.js",
"bin": {
"typograf": "./bin/cli.js"
},
"homepage": "https://github.com/typograf",

@@ -44,5 +47,5 @@ "licenses": [

"devDependencies": {
"chai": "~1.10.0",
"chai": "~2.0.0",
"gulp": "~3.8.10",
"gulp-concat": "~2.4.3",
"gulp-concat": "~2.5.0",
"gulp-filter": "~2.0.0",

@@ -60,3 +63,3 @@ "gulp-jscs": "~1.4.0",

"through": "~2.3.6",
"yaspeller": "1.0.0"
"yaspeller": "~1.0.0"
},

@@ -63,0 +66,0 @@ "scripts": {

@@ -98,2 +98,9 @@ Типограф на JavaScript

### Изменить настройку у правила
```JavaScript
var tp = new Typograf({lang: 'ru'});
// Название правила, название настройки, значение
tp.setting('common/nbsp/beforeShortLast', 'lengthLastWord', 5);
```
### Добавить правило

@@ -115,3 +122,2 @@ ```JavaScript

### Режим работы

@@ -118,0 +124,0 @@ ```JavaScript

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc