typograf 6.15.0 → 7.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +447 -0
- package/LICENSE.md +1 -1
- package/README.md +1 -1
- package/dist/consts.d.ts +2 -0
- package/dist/data/be.d.ts +8 -0
- package/dist/data/bg.d.ts +8 -0
- package/dist/data/ca.d.ts +8 -0
- package/dist/data/common.d.ts +6 -0
- package/dist/data/cs.d.ts +8 -0
- package/dist/data/da.d.ts +8 -0
- package/dist/data/de.d.ts +8 -0
- package/dist/data/el.d.ts +8 -0
- package/dist/data/en-GB.d.ts +8 -0
- package/dist/data/en-US.d.ts +8 -0
- package/dist/data/eo.d.ts +8 -0
- package/dist/data/es.d.ts +8 -0
- package/dist/data/et.d.ts +8 -0
- package/dist/data/fi.d.ts +8 -0
- package/dist/data/fr.d.ts +9 -0
- package/dist/data/ga.d.ts +8 -0
- package/dist/data/hu.d.ts +8 -0
- package/dist/data/index.d.ts +1 -0
- package/dist/data/it.d.ts +8 -0
- package/dist/data/lv.d.ts +8 -0
- package/dist/data/nl.d.ts +8 -0
- package/dist/data/no.d.ts +8 -0
- package/dist/data/pl.d.ts +8 -0
- package/dist/data/ro.d.ts +8 -0
- package/dist/data/ru.d.ts +19 -0
- package/dist/data/sk.d.ts +8 -0
- package/dist/data/sl.d.ts +8 -0
- package/dist/data/sr.d.ts +8 -0
- package/dist/data/sv.d.ts +8 -0
- package/dist/data/tr.d.ts +8 -0
- package/dist/data/uk.d.ts +8 -0
- package/dist/data.d.ts +16 -0
- package/dist/groupIndexes.d.ts +1 -0
- package/dist/helpers/object.d.ts +4 -0
- package/dist/helpers/regExp.d.ts +4 -0
- package/dist/helpers/string.d.ts +6 -0
- package/dist/htmlEntities/index.d.ts +41 -0
- package/dist/htmlEntities/invisible.d.ts +2 -0
- package/dist/htmlEntities/visible.d.ts +2 -0
- package/dist/htmlTags/block.d.ts +1 -0
- package/dist/htmlTags/inline.d.ts +1 -0
- package/dist/locale.d.ts +5 -0
- package/dist/main.d.ts +130 -0
- package/dist/prefs.d.ts +6 -0
- package/dist/rule.d.ts +9 -0
- package/dist/rules/common/html/e-mail.d.ts +2 -0
- package/dist/rules/common/html/e-mail.test.d.ts +1 -0
- package/dist/rules/common/html/escape.d.ts +2 -0
- package/dist/rules/common/html/escape.test.d.ts +1 -0
- package/dist/rules/common/html/index.d.ts +1 -0
- package/dist/rules/common/html/nbr.d.ts +2 -0
- package/dist/rules/common/html/nbr.test.d.ts +1 -0
- package/dist/rules/common/html/p.d.ts +2 -0
- package/dist/rules/common/html/p.test.d.ts +1 -0
- package/dist/rules/common/html/processingAttrs.d.ts +4 -0
- package/dist/rules/common/html/quot.d.ts +2 -0
- package/dist/rules/common/html/quot.test.d.ts +1 -0
- package/dist/rules/common/html/stripTags.d.ts +2 -0
- package/dist/rules/common/html/stripTags.test.d.ts +1 -0
- package/dist/rules/common/html/url.d.ts +2 -0
- package/dist/rules/common/html/url.test.d.ts +1 -0
- package/dist/rules/common/index.d.ts +7 -0
- package/dist/rules/common/nbsp/afterNumber.d.ts +2 -0
- package/dist/rules/common/nbsp/afterNumber.test.d.ts +1 -0
- package/dist/rules/common/nbsp/afterParagraphMark.d.ts +2 -0
- package/dist/rules/common/nbsp/afterParagraphMark.test.d.ts +1 -0
- package/dist/rules/common/nbsp/afterSectionMark.d.ts +2 -0
- package/dist/rules/common/nbsp/afterSectionMark.test.d.ts +1 -0
- package/dist/rules/common/nbsp/afterShortWord.d.ts +4 -0
- package/dist/rules/common/nbsp/afterShortWord.test.d.ts +1 -0
- package/dist/rules/common/nbsp/beforeShortLastNumber.d.ts +4 -0
- package/dist/rules/common/nbsp/beforeShortLastNumber.test.d.ts +1 -0
- package/dist/rules/common/nbsp/beforeShortLastWord.d.ts +4 -0
- package/dist/rules/common/nbsp/beforeShortLastWord.test.d.ts +1 -0
- package/dist/rules/common/nbsp/dpi.d.ts +2 -0
- package/dist/rules/common/nbsp/dpi.test.d.ts +1 -0
- package/dist/rules/common/nbsp/index.d.ts +1 -0
- package/dist/rules/common/nbsp/nowrap.d.ts +2 -0
- package/dist/rules/common/nbsp/nowrap.test.d.ts +1 -0
- package/dist/rules/common/nbsp/replaceNbsp.d.ts +2 -0
- package/dist/rules/common/nbsp/replaceNbsp.test.d.ts +1 -0
- package/dist/rules/common/number/digitGrouping.d.ts +4 -0
- package/dist/rules/common/number/digitGrouping.test.d.ts +1 -0
- package/dist/rules/common/number/fraction.d.ts +2 -0
- package/dist/rules/common/number/fraction.test.d.ts +1 -0
- package/dist/rules/common/number/index.d.ts +1 -0
- package/dist/rules/common/number/mathSigns.d.ts +2 -0
- package/dist/rules/common/number/mathSigns.test.d.ts +1 -0
- package/dist/rules/common/number/times.d.ts +2 -0
- package/dist/rules/common/number/times.test.d.ts +1 -0
- package/dist/rules/common/other/delBOM.d.ts +2 -0
- package/dist/rules/common/other/delBOM.test.d.ts +1 -0
- package/dist/rules/common/other/index.d.ts +1 -0
- package/dist/rules/common/other/repeatWord.d.ts +4 -0
- package/dist/rules/common/other/repeatWord.test.d.ts +1 -0
- package/dist/rules/common/punctuation/apostrophe.d.ts +2 -0
- package/dist/rules/common/punctuation/apostrophe.test.d.ts +1 -0
- package/dist/rules/common/punctuation/delDoublePunctuation.d.ts +2 -0
- package/dist/rules/common/punctuation/delDoublePunctuation.test.d.ts +1 -0
- package/dist/rules/common/punctuation/hellip.d.ts +2 -0
- package/dist/rules/common/punctuation/hellip.en-US.test.d.ts +1 -0
- package/dist/rules/common/punctuation/hellip.ru.test.d.ts +1 -0
- package/dist/rules/common/punctuation/index.d.ts +1 -0
- package/dist/rules/common/punctuation/quote.d.ts +5 -0
- package/dist/rules/common/punctuation/quote.de.test.d.ts +1 -0
- package/dist/rules/common/punctuation/quote.en-GB.test.d.ts +1 -0
- package/dist/rules/common/punctuation/quote.en-US.test.d.ts +1 -0
- package/dist/rules/common/punctuation/quote.fi.test.d.ts +1 -0
- package/dist/rules/common/punctuation/quote.fr.test.d.ts +1 -0
- package/dist/rules/common/punctuation/quote.pl.test.d.ts +1 -0
- package/dist/rules/common/punctuation/quote.ru.test.d.ts +1 -0
- package/dist/rules/common/punctuation/quoteLink.d.ts +2 -0
- package/dist/rules/common/punctuation/quoteLink.test.d.ts +1 -0
- package/dist/rules/common/space/afterColon.d.ts +2 -0
- package/dist/rules/common/space/afterColon.test.d.ts +1 -0
- package/dist/rules/common/space/afterComma.d.ts +2 -0
- package/dist/rules/common/space/afterComma.test.d.ts +1 -0
- package/dist/rules/common/space/afterExclamationMark.d.ts +2 -0
- package/dist/rules/common/space/afterExclamationMark.test.d.ts +1 -0
- package/dist/rules/common/space/afterQuestionMark.d.ts +2 -0
- package/dist/rules/common/space/afterQuestionMark.test.d.ts +1 -0
- package/dist/rules/common/space/afterSemicolon.d.ts +2 -0
- package/dist/rules/common/space/afterSemicolon.test.d.ts +1 -0
- package/dist/rules/common/space/beforeBracket.d.ts +2 -0
- package/dist/rules/common/space/beforeBracket.test.d.ts +1 -0
- package/dist/rules/common/space/bracket.d.ts +2 -0
- package/dist/rules/common/space/bracket.test.d.ts +1 -0
- package/dist/rules/common/space/delBeforeDot.d.ts +2 -0
- package/dist/rules/common/space/delBeforeDot.test.d.ts +1 -0
- package/dist/rules/common/space/delBeforePercent.d.ts +2 -0
- package/dist/rules/common/space/delBeforePercent.test.d.ts +1 -0
- package/dist/rules/common/space/delBeforePunctuation.d.ts +2 -0
- package/dist/rules/common/space/delBeforePunctuation.test.d.ts +1 -0
- package/dist/rules/common/space/delBetweenExclamationMarks.d.ts +2 -0
- package/dist/rules/common/space/delBetweenExclamationMarks.test.d.ts +1 -0
- package/dist/rules/common/space/delLeadingBlanks.d.ts +2 -0
- package/dist/rules/common/space/delLeadingBlanks.test.d.ts +1 -0
- package/dist/rules/common/space/delRepeatN.d.ts +4 -0
- package/dist/rules/common/space/delRepeatN.test.d.ts +1 -0
- package/dist/rules/common/space/delRepeatSpace.d.ts +2 -0
- package/dist/rules/common/space/delRepeatSpace.test.d.ts +1 -0
- package/dist/rules/common/space/delTrailingBlanks.d.ts +2 -0
- package/dist/rules/common/space/delTrailingBlanks.test.d.ts +1 -0
- package/dist/rules/common/space/index.d.ts +1 -0
- package/dist/rules/common/space/insertFinalNewline.d.ts +2 -0
- package/dist/rules/common/space/insertFinalNewline.test.d.ts +1 -0
- package/dist/rules/common/space/replaceTab.d.ts +2 -0
- package/dist/rules/common/space/replaceTab.test.d.ts +1 -0
- package/dist/rules/common/space/squareBracket.d.ts +2 -0
- package/dist/rules/common/space/squareBracket.test.d.ts +1 -0
- package/dist/rules/common/space/trimLeft.d.ts +2 -0
- package/dist/rules/common/space/trimLeft.test.d.ts +1 -0
- package/dist/rules/common/space/trimRight.d.ts +2 -0
- package/dist/rules/common/space/trimRight.test.d.ts +1 -0
- package/dist/rules/common/symbols/arrow.d.ts +2 -0
- package/dist/rules/common/symbols/arrow.test.d.ts +1 -0
- package/dist/rules/common/symbols/cf.d.ts +2 -0
- package/dist/rules/common/symbols/cf.test.d.ts +1 -0
- package/dist/rules/common/symbols/copy.d.ts +2 -0
- package/dist/rules/common/symbols/copy.test.d.ts +1 -0
- package/dist/rules/common/symbols/index.d.ts +1 -0
- package/dist/rules/en-US/dash/index.d.ts +1 -0
- package/dist/rules/en-US/dash/main.d.ts +2 -0
- package/dist/rules/en-US/dash/main.test.d.ts +1 -0
- package/dist/rules/en-US/index.d.ts +1 -0
- package/dist/rules/index.d.ts +3 -0
- package/dist/rules/ru/dash/centuries.d.ts +4 -0
- package/dist/rules/ru/dash/centuries.test.d.ts +1 -0
- package/dist/rules/ru/dash/daysMonth.d.ts +4 -0
- package/dist/rules/ru/dash/daysMonth.test.d.ts +1 -0
- package/dist/rules/ru/dash/de.d.ts +2 -0
- package/dist/rules/ru/dash/de.test.d.ts +1 -0
- package/dist/rules/ru/dash/decade.d.ts +4 -0
- package/dist/rules/ru/dash/decade.test.d.ts +1 -0
- package/dist/rules/ru/dash/directSpeech.d.ts +2 -0
- package/dist/rules/ru/dash/directSpeech.test.d.ts +1 -0
- package/dist/rules/ru/dash/index.d.ts +1 -0
- package/dist/rules/ru/dash/izpod.d.ts +2 -0
- package/dist/rules/ru/dash/izpod.test.d.ts +1 -0
- package/dist/rules/ru/dash/izza.d.ts +2 -0
- package/dist/rules/ru/dash/izza.test.d.ts +1 -0
- package/dist/rules/ru/dash/ka.d.ts +2 -0
- package/dist/rules/ru/dash/ka.test.d.ts +1 -0
- package/dist/rules/ru/dash/kakto.d.ts +2 -0
- package/dist/rules/ru/dash/kakto.test.d.ts +1 -0
- package/dist/rules/ru/dash/koe.d.ts +2 -0
- package/dist/rules/ru/dash/koe.test.d.ts +1 -0
- package/dist/rules/ru/dash/main.d.ts +2 -0
- package/dist/rules/ru/dash/main.test.d.ts +1 -0
- package/dist/rules/ru/dash/month.d.ts +4 -0
- package/dist/rules/ru/dash/month.test.d.ts +1 -0
- package/dist/rules/ru/dash/surname.d.ts +2 -0
- package/dist/rules/ru/dash/surname.test.d.ts +1 -0
- package/dist/rules/ru/dash/taki.d.ts +2 -0
- package/dist/rules/ru/dash/taki.test.d.ts +1 -0
- package/dist/rules/ru/dash/time.d.ts +4 -0
- package/dist/rules/ru/dash/time.test.d.ts +1 -0
- package/dist/rules/ru/dash/to.d.ts +2 -0
- package/dist/rules/ru/dash/to.test.d.ts +1 -0
- package/dist/rules/ru/dash/weekday.d.ts +4 -0
- package/dist/rules/ru/dash/weekday.test.d.ts +1 -0
- package/dist/rules/ru/dash/years.d.ts +4 -0
- package/dist/rules/ru/dash/years.test.d.ts +1 -0
- package/dist/rules/ru/date/fromISO.d.ts +2 -0
- package/dist/rules/ru/date/fromISO.test.d.ts +1 -0
- package/dist/rules/ru/date/index.d.ts +1 -0
- package/dist/rules/ru/date/weekday.d.ts +2 -0
- package/dist/rules/ru/date/weekday.test.d.ts +1 -0
- package/dist/rules/ru/index.d.ts +11 -0
- package/dist/rules/ru/money/currency.d.ts +2 -0
- package/dist/rules/ru/money/currency.test.d.ts +1 -0
- package/dist/rules/ru/money/index.d.ts +1 -0
- package/dist/rules/ru/money/ruble.d.ts +2 -0
- package/dist/rules/ru/money/ruble.test.d.ts +1 -0
- package/dist/rules/ru/nbsp/abbr.d.ts +2 -0
- package/dist/rules/ru/nbsp/abbr.test.d.ts +1 -0
- package/dist/rules/ru/nbsp/addr.d.ts +2 -0
- package/dist/rules/ru/nbsp/addr.test.d.ts +1 -0
- package/dist/rules/ru/nbsp/afterNumberSign.d.ts +2 -0
- package/dist/rules/ru/nbsp/afterNumberSign.test.d.ts +1 -0
- package/dist/rules/ru/nbsp/beforeParticle.d.ts +2 -0
- package/dist/rules/ru/nbsp/beforeParticle.test.d.ts +1 -0
- package/dist/rules/ru/nbsp/centuries.d.ts +2 -0
- package/dist/rules/ru/nbsp/centuries.test.d.ts +1 -0
- package/dist/rules/ru/nbsp/dayMonth.d.ts +2 -0
- package/dist/rules/ru/nbsp/dayMonth.test.d.ts +1 -0
- package/dist/rules/ru/nbsp/index.d.ts +1 -0
- package/dist/rules/ru/nbsp/initials.d.ts +2 -0
- package/dist/rules/ru/nbsp/initials.test.d.ts +1 -0
- package/dist/rules/ru/nbsp/m.d.ts +2 -0
- package/dist/rules/ru/nbsp/m.test.d.ts +1 -0
- package/dist/rules/ru/nbsp/mln.d.ts +2 -0
- package/dist/rules/ru/nbsp/mln.test.d.ts +1 -0
- package/dist/rules/ru/nbsp/ooo.d.ts +2 -0
- package/dist/rules/ru/nbsp/ooo.test.d.ts +1 -0
- package/dist/rules/ru/nbsp/page.d.ts +2 -0
- package/dist/rules/ru/nbsp/page.test.d.ts +1 -0
- package/dist/rules/ru/nbsp/ps.d.ts +2 -0
- package/dist/rules/ru/nbsp/ps.test.d.ts +1 -0
- package/dist/rules/ru/nbsp/rubleKopek.d.ts +2 -0
- package/dist/rules/ru/nbsp/rubleKopek.test.d.ts +1 -0
- package/dist/rules/ru/nbsp/see.d.ts +2 -0
- package/dist/rules/ru/nbsp/see.test.d.ts +1 -0
- package/dist/rules/ru/nbsp/year.d.ts +2 -0
- package/dist/rules/ru/nbsp/year.test.d.ts +1 -0
- package/dist/rules/ru/nbsp/years.d.ts +2 -0
- package/dist/rules/ru/nbsp/years.test.d.ts +1 -0
- package/dist/rules/ru/number/comma.d.ts +2 -0
- package/dist/rules/ru/number/comma.test.d.ts +1 -0
- package/dist/rules/ru/number/index.d.ts +1 -0
- package/dist/rules/ru/number/ordinals.d.ts +2 -0
- package/dist/rules/ru/number/ordinals.test.d.ts +1 -0
- package/dist/rules/ru/optalign/bracket.d.ts +4 -0
- package/dist/rules/ru/optalign/bracket.test.d.ts +1 -0
- package/dist/rules/ru/optalign/comma.d.ts +4 -0
- package/dist/rules/ru/optalign/comma.test.d.ts +1 -0
- package/dist/rules/ru/optalign/helpers.d.ts +2 -0
- package/dist/rules/ru/optalign/index.d.ts +1 -0
- package/dist/rules/ru/optalign/quote.d.ts +4 -0
- package/dist/rules/ru/optalign/quote.test.d.ts +1 -0
- package/dist/rules/ru/other/accent.d.ts +2 -0
- package/dist/rules/ru/other/accent.test.d.ts +1 -0
- package/dist/rules/ru/other/index.d.ts +1 -0
- package/dist/rules/ru/other/phone-number.d.ts +2 -0
- package/dist/rules/ru/other/phone-number.test.d.ts +1 -0
- package/dist/rules/ru/punctuation/ano.d.ts +2 -0
- package/dist/rules/ru/punctuation/ano.test.d.ts +1 -0
- package/dist/rules/ru/punctuation/exclamation.d.ts +2 -0
- package/dist/rules/ru/punctuation/exclamation.test.d.ts +1 -0
- package/dist/rules/ru/punctuation/exclamationQuestion.d.ts +2 -0
- package/dist/rules/ru/punctuation/exclamationQuestion.test.d.ts +1 -0
- package/dist/rules/ru/punctuation/hellipQuestion.d.ts +2 -0
- package/dist/rules/ru/punctuation/hellipQuestion.test.d.ts +1 -0
- package/dist/rules/ru/punctuation/index.d.ts +1 -0
- package/dist/rules/ru/space/afterHellip.d.ts +2 -0
- package/dist/rules/ru/space/afterHellip.test.d.ts +1 -0
- package/dist/rules/ru/space/index.d.ts +1 -0
- package/dist/rules/ru/space/year.d.ts +2 -0
- package/dist/rules/ru/space/year.test.d.ts +1 -0
- package/dist/rules/ru/symbols/NN.d.ts +2 -0
- package/dist/rules/ru/symbols/NN.test.d.ts +1 -0
- package/dist/rules/ru/symbols/index.d.ts +1 -0
- package/dist/rules/ru/typo/index.d.ts +1 -0
- package/dist/rules/ru/typo/switchingKeyboardLayout.d.ts +2 -0
- package/dist/rules/ru/typo/switchingKeyboardLayout.test.d.ts +1 -0
- package/dist/safeTags.d.ts +42 -0
- package/dist/typograf.all.d.ts +2 -0
- package/dist/typograf.all.js +3274 -3543
- package/dist/typograf.all.min.js +2 -2
- package/dist/typograf.css +5 -5
- package/dist/typograf.d.ts +3 -0
- package/dist/typograf.es.mjs +3268 -0
- package/dist/typograf.js +3175 -3050
- package/dist/typograf.min.js +2 -2
- package/dist/typograf.titles.js +1 -409
- package/dist/typograf.titles.json +1 -409
- package/dist/version.d.ts +1 -0
- package/docs/RULES.en-US.md +105 -105
- package/docs/RULES.ru.md +105 -105
- package/docs/RULES_SORTED.en-US.md +105 -105
- package/docs/RULES_SORTED.ru.md +105 -105
- package/package.json +47 -31
- package/dist/typograf.es.js +0 -3143
- package/typograf.d.ts +0 -51
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
declare const _default: {
|
|
2
|
+
'ru/char': string;
|
|
3
|
+
'ru/dashBefore': string;
|
|
4
|
+
'ru/dashAfter': string;
|
|
5
|
+
'ru/dashAfterDe': string;
|
|
6
|
+
'ru/l': string;
|
|
7
|
+
'ru/L': string;
|
|
8
|
+
'ru/month': string;
|
|
9
|
+
'ru/monthGenCase': string;
|
|
10
|
+
'ru/monthPreCase': string;
|
|
11
|
+
'ru/quote': {
|
|
12
|
+
left: string;
|
|
13
|
+
right: string;
|
|
14
|
+
removeDuplicateQuotes: boolean;
|
|
15
|
+
};
|
|
16
|
+
'ru/shortMonth': string;
|
|
17
|
+
'ru/weekday': string;
|
|
18
|
+
};
|
|
19
|
+
export default _default;
|
package/dist/data.d.ts
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Get data for use in rules.
|
|
3
|
+
*/
|
|
4
|
+
export declare function getData(key: string): unknown;
|
|
5
|
+
/**
|
|
6
|
+
* Set data for use in rules.
|
|
7
|
+
*/
|
|
8
|
+
export declare function setData(newData: Record<string, unknown>): void;
|
|
9
|
+
export type DataChar = string;
|
|
10
|
+
export type DataCommonQuote = string;
|
|
11
|
+
export type DataQuote = {
|
|
12
|
+
left: string;
|
|
13
|
+
right: string;
|
|
14
|
+
spacing?: boolean;
|
|
15
|
+
removeDuplicateQuotes?: true;
|
|
16
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const groupIndexes: Record<string, number>;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export declare function repeat(symbol: string, count: number): string;
|
|
2
|
+
export declare function replaceNbsp(text: string): string;
|
|
3
|
+
export declare function replace(text: string, re: [RegExp, string][]): string;
|
|
4
|
+
export declare function isHTML(text: string): boolean;
|
|
5
|
+
export declare function removeCR(text: string): string;
|
|
6
|
+
export declare function fixLineEnding(text: string, type: 'CRLF' | 'CR' | 'LF'): string;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import type { TypografContext } from '../main';
|
|
2
|
+
export type Entity = [string, number];
|
|
3
|
+
export type TypografHtmlEntityType = 'name' | 'digit' | 'default';
|
|
4
|
+
interface HtmlEntityInfo {
|
|
5
|
+
name: string;
|
|
6
|
+
nameEntity: string;
|
|
7
|
+
digitEntity: string;
|
|
8
|
+
utf: string;
|
|
9
|
+
reName: RegExp;
|
|
10
|
+
reUtf: RegExp;
|
|
11
|
+
}
|
|
12
|
+
declare class HtmlEntities {
|
|
13
|
+
private entities;
|
|
14
|
+
private invisibleEntities;
|
|
15
|
+
private entitiesByName;
|
|
16
|
+
private entitiesByNameEntity;
|
|
17
|
+
private entitiesByDigitEntity;
|
|
18
|
+
private entitiesByUtf;
|
|
19
|
+
constructor();
|
|
20
|
+
/**
|
|
21
|
+
* Entities as name or digit to UTF-8.
|
|
22
|
+
*/
|
|
23
|
+
toUtf(context: TypografContext): void;
|
|
24
|
+
/**
|
|
25
|
+
* Entities in decimal or hexadecimal form to UTF-8.
|
|
26
|
+
*/
|
|
27
|
+
decHexToUtf(text: string): string;
|
|
28
|
+
/**
|
|
29
|
+
* Restore HTML entities in text.
|
|
30
|
+
*/
|
|
31
|
+
restore(context: TypografContext): void;
|
|
32
|
+
/**
|
|
33
|
+
* Get a entity by utf using the type.
|
|
34
|
+
*/
|
|
35
|
+
getByUtf(symbol: string, type?: TypografHtmlEntityType): HtmlEntityInfo | string | undefined;
|
|
36
|
+
private prepareEntities;
|
|
37
|
+
private prepareListParam;
|
|
38
|
+
private restoreEntitiesByIndex;
|
|
39
|
+
}
|
|
40
|
+
export declare const htmlEntities: HtmlEntities;
|
|
41
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const blockElements: string[];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const inlineElements: string[];
|
package/dist/locale.d.ts
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare function addLocale(locale: string): void;
|
|
2
|
+
export declare function getLocales(): string[];
|
|
3
|
+
export declare function hasLocale(locale: string): boolean;
|
|
4
|
+
export declare function prepareLocale(locale1?: string | string[], locale2?: string | string[]): string[];
|
|
5
|
+
export declare function checkLocales(locales: string[]): void;
|
package/dist/main.d.ts
ADDED
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
import { TypografHtmlEntityType } from './htmlEntities/index';
|
|
2
|
+
import { SafeTags } from './safeTags';
|
|
3
|
+
export type TypografLineEnding = 'LF' | 'CR' | 'CRLF';
|
|
4
|
+
export interface TypografHtmlEntity {
|
|
5
|
+
type: TypografHtmlEntityType;
|
|
6
|
+
onlyInvisible: boolean;
|
|
7
|
+
list?: string[];
|
|
8
|
+
}
|
|
9
|
+
export type TypofrafRuleFilter = (rule: TypografRuleInternal) => boolean;
|
|
10
|
+
export interface TypografPrefs {
|
|
11
|
+
locale: string | string[];
|
|
12
|
+
lineEnding?: TypografLineEnding;
|
|
13
|
+
htmlEntity?: Partial<TypografHtmlEntity>;
|
|
14
|
+
live?: boolean;
|
|
15
|
+
enableRule?: string | string[];
|
|
16
|
+
disableRule?: string | string[];
|
|
17
|
+
processingSeparateParts?: boolean;
|
|
18
|
+
ruleFilter?: TypofrafRuleFilter;
|
|
19
|
+
}
|
|
20
|
+
export interface TypografExecutePrefs {
|
|
21
|
+
locale?: string | string[];
|
|
22
|
+
lineEnding?: TypografLineEnding;
|
|
23
|
+
htmlEntity?: Partial<TypografHtmlEntity>;
|
|
24
|
+
processingSeparateParts?: boolean;
|
|
25
|
+
ruleFilter?: TypofrafRuleFilter;
|
|
26
|
+
}
|
|
27
|
+
export interface TypografPrefsInternal {
|
|
28
|
+
locale: string[];
|
|
29
|
+
lineEnding: TypografLineEnding;
|
|
30
|
+
htmlEntity: TypografHtmlEntity;
|
|
31
|
+
live: boolean;
|
|
32
|
+
enableRule: string | string[];
|
|
33
|
+
disableRule: string | string[];
|
|
34
|
+
processingSeparateParts: boolean;
|
|
35
|
+
ruleFilter: TypofrafRuleFilter;
|
|
36
|
+
}
|
|
37
|
+
export interface TypografContext {
|
|
38
|
+
text: string;
|
|
39
|
+
isHTML: boolean;
|
|
40
|
+
prefs: TypografPrefsInternal;
|
|
41
|
+
safeTags: SafeTags;
|
|
42
|
+
getData: (key: string) => unknown;
|
|
43
|
+
}
|
|
44
|
+
export interface TypografRule<T = Record<string, unknown>> {
|
|
45
|
+
name: string;
|
|
46
|
+
handler: (this: Typograf, text: string, settings: T, context: TypografContext) => string;
|
|
47
|
+
queue?: string;
|
|
48
|
+
index?: string | number;
|
|
49
|
+
disabled?: boolean;
|
|
50
|
+
live?: boolean;
|
|
51
|
+
settings?: T;
|
|
52
|
+
htmlAttrs?: boolean;
|
|
53
|
+
}
|
|
54
|
+
export interface TypografRuleInternal {
|
|
55
|
+
name: string;
|
|
56
|
+
handler: (text: string, settings: unknown, context: TypografContext) => string;
|
|
57
|
+
shortName: string;
|
|
58
|
+
locale: string;
|
|
59
|
+
group: string;
|
|
60
|
+
queue: string;
|
|
61
|
+
index: number;
|
|
62
|
+
enabled: boolean;
|
|
63
|
+
live: boolean;
|
|
64
|
+
settings: unknown;
|
|
65
|
+
htmlAttrs: boolean;
|
|
66
|
+
}
|
|
67
|
+
export declare class Typograf {
|
|
68
|
+
safeTags: SafeTags;
|
|
69
|
+
onBeforeRule?: (ruleName: string, context: TypografContext) => void;
|
|
70
|
+
onAfterRule?: (ruleName: string, context: TypografContext) => void;
|
|
71
|
+
private prefs;
|
|
72
|
+
private rules;
|
|
73
|
+
private innerRules;
|
|
74
|
+
private rulesByQueues;
|
|
75
|
+
private innerRulesByQueues;
|
|
76
|
+
private enabledRules;
|
|
77
|
+
private settings;
|
|
78
|
+
private separatePartsTags;
|
|
79
|
+
constructor(prefs: TypografPrefs);
|
|
80
|
+
static addRule(rule: TypografRule): void;
|
|
81
|
+
static addRules(rules: TypografRule[]): void;
|
|
82
|
+
/**
|
|
83
|
+
* Add internal rule.
|
|
84
|
+
* Internal rules are executed before main rules.
|
|
85
|
+
*/
|
|
86
|
+
static addInnerRule(rule: TypografRule): void;
|
|
87
|
+
static addInnerRules(rules: TypografRule[]): void;
|
|
88
|
+
static getRule(ruleName: string): TypografRuleInternal | null;
|
|
89
|
+
static getRules(): TypografRuleInternal[];
|
|
90
|
+
static getInnerRules(): TypografRuleInternal[];
|
|
91
|
+
static getLocales(): string[];
|
|
92
|
+
static addLocale(locale: string): void;
|
|
93
|
+
static hasLocale(locale: string): boolean;
|
|
94
|
+
static setData(data: Record<string, unknown>): void;
|
|
95
|
+
static getData(key: string): unknown;
|
|
96
|
+
static groups: {
|
|
97
|
+
name: string;
|
|
98
|
+
title: Record<string, string>;
|
|
99
|
+
}[];
|
|
100
|
+
static titles: Record<string, Record<string, string>>;
|
|
101
|
+
static version: string;
|
|
102
|
+
/**
|
|
103
|
+
* Execute typographical rules for text.
|
|
104
|
+
*/
|
|
105
|
+
execute(text: string | number, prefs?: TypografExecutePrefs): string;
|
|
106
|
+
getSetting(ruleName: string, setting: string): unknown;
|
|
107
|
+
setSetting(ruleName: string, setting: string, value: unknown): void;
|
|
108
|
+
isEnabledRule(ruleName: string): boolean;
|
|
109
|
+
isDisabledRule(ruleName: string): boolean;
|
|
110
|
+
enableRule(ruleName: string | string[]): void;
|
|
111
|
+
disableRule(ruleName: string | string[]): void;
|
|
112
|
+
/**
|
|
113
|
+
* Add safe tag.
|
|
114
|
+
*
|
|
115
|
+
* @example
|
|
116
|
+
* // const typograf = new Typograf({ locale: 'ru' });
|
|
117
|
+
* // typograf.addSafeTag('<mytag>', '</mytag>');
|
|
118
|
+
* // typograf.addSafeTag('<mytag>', '</mytag>', '.*?');
|
|
119
|
+
* // typograf.addSafeTag(/<mytag>.*?</mytag>/gi);
|
|
120
|
+
*/
|
|
121
|
+
addSafeTag(startTag: string | RegExp, endTag?: string, middle?: string): void;
|
|
122
|
+
private prepareContext;
|
|
123
|
+
private splitBySeparateParts;
|
|
124
|
+
private process;
|
|
125
|
+
private executeRules;
|
|
126
|
+
private ruleIterator;
|
|
127
|
+
private prepareRuleSettings;
|
|
128
|
+
private enable;
|
|
129
|
+
private enableByMask;
|
|
130
|
+
}
|
package/dist/prefs.d.ts
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { TypografLineEnding, TypografExecutePrefs, TypografPrefs, TypografPrefsInternal } from './main';
|
|
2
|
+
export declare function prepareHtmlEntity(htmlEntity?: Partial<TypografPrefsInternal['htmlEntity']>): TypografPrefsInternal['htmlEntity'];
|
|
3
|
+
export declare function prepareLineEnding(lineEnding?: TypografLineEnding): TypografLineEnding;
|
|
4
|
+
export declare function prepareProcessingSeparateParts(value?: boolean): boolean;
|
|
5
|
+
export declare function preparePrefs(prefs: TypografPrefs): TypografPrefsInternal;
|
|
6
|
+
export declare function prepareContextPrefs(prefs: TypografPrefsInternal, executePrefs?: TypografExecutePrefs): TypografPrefsInternal;
|
package/dist/rule.d.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { TypografRule, TypografRuleInternal } from './main';
|
|
2
|
+
export declare const DEFAULT_RULE_INDEX = 0;
|
|
3
|
+
export declare const DEFAULT_QUEUE_NAME = "default";
|
|
4
|
+
export declare function addInnerRule(rule: TypografRule): void;
|
|
5
|
+
export declare function addRule(rule: TypografRule): void;
|
|
6
|
+
export declare function sortRules(rules: TypografRuleInternal[]): void;
|
|
7
|
+
export declare function getRules(): TypografRuleInternal[];
|
|
8
|
+
export declare function getInnerRules(): TypografRuleInternal[];
|
|
9
|
+
export declare function prepareRule(rule: TypografRule): TypografRuleInternal;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|