taraskevizer 7.1.2 → 8.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/README.md +1 -93
- package/dist/bin.js +5 -12
- package/dist/index.cjs +194 -142
- package/dist/index.d.ts +295 -109
- package/dist/index.js +193 -139
- package/package.json +4 -2
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
declare const cyrillic: {
|
|
2
|
+
readonly lower: readonly [];
|
|
3
|
+
readonly upper: readonly [];
|
|
4
|
+
};
|
|
5
|
+
|
|
6
|
+
declare const latin: {
|
|
7
|
+
lower: (readonly [RegExp, string])[];
|
|
8
|
+
upper: (readonly [RegExp, string])[];
|
|
9
|
+
};
|
|
10
|
+
declare const latinJi: {
|
|
11
|
+
lower: (readonly [RegExp, string])[];
|
|
12
|
+
upper: (readonly [RegExp, string])[];
|
|
13
|
+
};
|
|
14
|
+
|
|
1
15
|
declare const gobj: {
|
|
2
16
|
readonly г: "ґ";
|
|
3
17
|
readonly Г: "Ґ";
|
|
@@ -5,142 +19,239 @@ declare const gobj: {
|
|
|
5
19
|
readonly Ґ: "Г";
|
|
6
20
|
};
|
|
7
21
|
|
|
8
|
-
declare const wordlist: (readonly [RegExp, string])[];
|
|
9
|
-
|
|
10
22
|
type Dict<T = RegExp> = readonly (readonly [T, string])[];
|
|
23
|
+
/**
|
|
24
|
+
* Useful if you want to modify the dictionary.
|
|
25
|
+
*
|
|
26
|
+
* Consider converting it to the type {@link Dict}
|
|
27
|
+
* if you no longer need to modify it.
|
|
28
|
+
*/
|
|
11
29
|
type WritableDict<T = RegExp> = [T, string][];
|
|
30
|
+
/**
|
|
31
|
+
* useful if you use variables in patterns.
|
|
32
|
+
*
|
|
33
|
+
* Don't forget to convert it to the type {@link Dict},
|
|
34
|
+
* {@link lib.dictFrom} can help you with this.
|
|
35
|
+
*/
|
|
12
36
|
type RawDict = WritableDict<string | RegExp>;
|
|
13
37
|
|
|
38
|
+
declare const wordlist: Dict;
|
|
39
|
+
|
|
14
40
|
declare const noSoften: Dict;
|
|
15
41
|
declare const softeners: Dict;
|
|
16
42
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
declare const
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
lower: (readonly [RegExp, string])[];
|
|
28
|
-
upper: (readonly [RegExp, string])[];
|
|
29
|
-
};
|
|
43
|
+
type index$3_Dict<T = RegExp> = Dict<T>;
|
|
44
|
+
type index$3_RawDict = RawDict;
|
|
45
|
+
type index$3_WritableDict<T = RegExp> = WritableDict<T>;
|
|
46
|
+
declare const index$3_gobj: typeof gobj;
|
|
47
|
+
declare const index$3_noSoften: typeof noSoften;
|
|
48
|
+
declare const index$3_softeners: typeof softeners;
|
|
49
|
+
declare const index$3_wordlist: typeof wordlist;
|
|
50
|
+
declare namespace index$3 {
|
|
51
|
+
export { type index$3_Dict as Dict, type index$3_RawDict as RawDict, type index$3_WritableDict as WritableDict, index$2 as alphabets, index$3_gobj as gobj, index$3_noSoften as noSoften, index$3_softeners as softeners, index$3_wordlist as wordlist };
|
|
52
|
+
}
|
|
30
53
|
|
|
31
54
|
declare const arabic: {
|
|
32
55
|
lower: Dict;
|
|
33
56
|
};
|
|
34
57
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
}
|
|
42
|
-
|
|
58
|
+
/**
|
|
59
|
+
* If {@link Alphabet.upper} in not defined,
|
|
60
|
+
* it is assumed that the alphabet is case-insensitive,
|
|
61
|
+
* so {@link Alphabet.lower} should replace both
|
|
62
|
+
* upper and lower case letters.
|
|
63
|
+
*/
|
|
43
64
|
type Alphabet = {
|
|
44
65
|
lower: Dict;
|
|
45
66
|
upper?: Dict;
|
|
46
67
|
};
|
|
47
68
|
|
|
48
69
|
type index$2_Alphabet = Alphabet;
|
|
49
|
-
declare const index$
|
|
50
|
-
declare const index$
|
|
51
|
-
declare const index$
|
|
52
|
-
declare const index$
|
|
70
|
+
declare const index$2_arabic: typeof arabic;
|
|
71
|
+
declare const index$2_cyrillic: typeof cyrillic;
|
|
72
|
+
declare const index$2_latin: typeof latin;
|
|
73
|
+
declare const index$2_latinJi: typeof latinJi;
|
|
53
74
|
declare namespace index$2 {
|
|
54
|
-
export { type index$2_Alphabet as Alphabet, index$
|
|
75
|
+
export { type index$2_Alphabet as Alphabet, index$2_arabic as arabic, index$2_cyrillic as cyrillic, index$2_latin as latin, index$2_latinJi as latinJi };
|
|
55
76
|
}
|
|
56
77
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
readonly
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
78
|
+
declare const REPLACE_J: {
|
|
79
|
+
readonly NEVER: 0;
|
|
80
|
+
readonly RANDOM: 1;
|
|
81
|
+
readonly ALWAYS: 2;
|
|
82
|
+
};
|
|
83
|
+
declare const VARIATION: {
|
|
84
|
+
readonly NO: 0;
|
|
85
|
+
readonly FIRST: 1;
|
|
86
|
+
readonly ALL: 2;
|
|
87
|
+
};
|
|
88
|
+
type ValueOf<T> = T[keyof T];
|
|
89
|
+
type OptionJ = ValueOf<typeof REPLACE_J>;
|
|
90
|
+
type Variation = ValueOf<typeof VARIATION>;
|
|
91
|
+
|
|
92
|
+
type PartialReadonly<T> = {
|
|
93
|
+
readonly [P in keyof T]?: T[P];
|
|
94
|
+
};
|
|
63
95
|
type TaraskOptions = {
|
|
64
|
-
|
|
96
|
+
/**
|
|
97
|
+
* Any object that implements the {@link Alphabet} interface.
|
|
98
|
+
*
|
|
99
|
+
* The set of defined alphabets can be found in {@link dicts.alphabets}.
|
|
100
|
+
*
|
|
101
|
+
* @default alphabets.cyrillic
|
|
102
|
+
*/
|
|
65
103
|
abc: Alphabet;
|
|
104
|
+
/**
|
|
105
|
+
* | Value | When to replace `і`(`i`) by `й`(`j`) after vowels | Example |
|
|
106
|
+
* | ----- | ------------------------------------------------- | ------------------------ |
|
|
107
|
+
* | | | `яна і ён` |
|
|
108
|
+
* | 0 | never | `яна і ён` |
|
|
109
|
+
* | 1 | random | `яна і ён` or `яна й ён` |
|
|
110
|
+
* | 2 | always | `яна й ён` |
|
|
111
|
+
*
|
|
112
|
+
* Has no effect with abc set to {@link dicts.alphabets.latinJi}.
|
|
113
|
+
*
|
|
114
|
+
* @default REPLACE_J.NEVER
|
|
115
|
+
*/
|
|
66
116
|
j: OptionJ;
|
|
117
|
+
/**
|
|
118
|
+
* If set to false, may cause unwanted changes in acronyms.
|
|
119
|
+
*
|
|
120
|
+
* @default true
|
|
121
|
+
*/
|
|
122
|
+
doEscapeCapitalized: boolean;
|
|
67
123
|
};
|
|
68
124
|
type NonHtmlOptions = {
|
|
125
|
+
/** @default false */
|
|
69
126
|
ansiColors: boolean;
|
|
127
|
+
/**
|
|
128
|
+
* Do replace ґ(g) by г(h) in cyrillic alphabet?
|
|
129
|
+
*
|
|
130
|
+
* | Value | Example |
|
|
131
|
+
* | ----- | ----------- |
|
|
132
|
+
* | true | Ґвалт ґвалт |
|
|
133
|
+
* | false | Гвалт гвалт |
|
|
134
|
+
*
|
|
135
|
+
* @default false
|
|
136
|
+
*/
|
|
70
137
|
h: boolean;
|
|
138
|
+
/**
|
|
139
|
+
* | Value | Which variation is used if a part of word is variable | Example |
|
|
140
|
+
* | ----- | ----------------------------------------------------- | ----------------- |
|
|
141
|
+
* | | | Гродна |
|
|
142
|
+
* | 0 | main | Гродна |
|
|
143
|
+
* | 1 | first | Горадня |
|
|
144
|
+
* | 2 | all | (Гродна\|Горадня) |
|
|
145
|
+
*
|
|
146
|
+
* @default VARIATION.ALL
|
|
147
|
+
*/
|
|
71
148
|
variations: Variation;
|
|
72
149
|
};
|
|
73
150
|
type HtmlOptions = {
|
|
151
|
+
/**
|
|
152
|
+
* Do replace `г`(`h`) by `ґ`(`g`) in cyrillic alphabet?
|
|
153
|
+
*
|
|
154
|
+
* | Value | Example |
|
|
155
|
+
* | ----- | --------------------------------------- |
|
|
156
|
+
* | true | `<tarH>г</tarH>валт <tarH>Г</tarH>валт` |
|
|
157
|
+
* | false | `<tarH>ґ</tarH>валт <tarH>Ґ</tarH>валт` |
|
|
158
|
+
*
|
|
159
|
+
* @default false
|
|
160
|
+
*/
|
|
74
161
|
g: boolean;
|
|
75
162
|
};
|
|
76
|
-
type ExtendedDict = readonly (readonly [
|
|
77
|
-
RegExp,
|
|
78
|
-
string | ((...substrings: string[]) => string)
|
|
79
|
-
])[];
|
|
80
163
|
|
|
81
164
|
declare class TaraskConfig {
|
|
82
|
-
constructor(options?:
|
|
83
|
-
general: TaraskOptions
|
|
84
|
-
html: HtmlOptions
|
|
85
|
-
nonHtml: NonHtmlOptions
|
|
165
|
+
constructor(options?: PartialReadonly<{
|
|
166
|
+
general: PartialReadonly<TaraskOptions>;
|
|
167
|
+
html: PartialReadonly<HtmlOptions>;
|
|
168
|
+
nonHtml: PartialReadonly<NonHtmlOptions>;
|
|
86
169
|
}>);
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
g: boolean;
|
|
94
|
-
};
|
|
95
|
-
nonHtml: {
|
|
96
|
-
h: boolean;
|
|
97
|
-
ansiColors: boolean;
|
|
98
|
-
variations: Variation;
|
|
99
|
-
};
|
|
170
|
+
/** @see {@link TaraskOptions} */
|
|
171
|
+
general: TaraskOptions;
|
|
172
|
+
/** @see {@link HtmlOptions} */
|
|
173
|
+
html: HtmlOptions;
|
|
174
|
+
/** @see {@link NonHtmlOptions} */
|
|
175
|
+
nonHtml: NonHtmlOptions;
|
|
100
176
|
}
|
|
101
|
-
declare const REPLACE_J: {
|
|
102
|
-
readonly NEVER: 0;
|
|
103
|
-
readonly RANDOM: 1;
|
|
104
|
-
readonly ALWAYS: 2;
|
|
105
|
-
};
|
|
106
|
-
declare const VARIATION: {
|
|
107
|
-
readonly NO: 0;
|
|
108
|
-
readonly FIRST: 1;
|
|
109
|
-
readonly ALL: 2;
|
|
110
|
-
};
|
|
111
177
|
|
|
112
|
-
type TaraskStep<Storage = {}> = (
|
|
178
|
+
type TaraskStep<Storage = {}> = (args: {
|
|
179
|
+
text: string;
|
|
113
180
|
storage: Storage;
|
|
114
181
|
cfg: TaraskConfig;
|
|
115
|
-
}) =>
|
|
182
|
+
}) => void;
|
|
116
183
|
type SplittedTextStorage = {
|
|
117
|
-
|
|
118
|
-
|
|
184
|
+
textArr: string[];
|
|
185
|
+
origArr: readonly string[];
|
|
119
186
|
};
|
|
120
187
|
|
|
121
188
|
declare const convertAlphabet: TaraskStep;
|
|
122
189
|
declare const convertAlphabetLowerCase: TaraskStep;
|
|
123
190
|
|
|
191
|
+
/**
|
|
192
|
+
* Uses {@link highlightDiff}
|
|
193
|
+
*/
|
|
124
194
|
declare const highlightDiffStep: (highlight: (content: string) => string) => TaraskStep<SplittedTextStorage>;
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
declare const
|
|
195
|
+
/**
|
|
196
|
+
* Uses {@link highlightDiff}
|
|
197
|
+
*/
|
|
198
|
+
declare const highlightDiffStepNonHtml: TaraskStep<SplittedTextStorage>;
|
|
129
199
|
|
|
130
200
|
declare const replaceIbyJ: TaraskStep;
|
|
131
201
|
|
|
132
202
|
declare const joinSplittedText: TaraskStep<SplittedTextStorage>;
|
|
133
203
|
|
|
134
|
-
declare const
|
|
135
|
-
declare const
|
|
204
|
+
declare const applyGHtml: TaraskStep;
|
|
205
|
+
declare const applyGNonHtml: TaraskStep;
|
|
206
|
+
|
|
207
|
+
/**
|
|
208
|
+
* @param callback - A function that takes an
|
|
209
|
+
* array of variable parts and returns a string.
|
|
210
|
+
*
|
|
211
|
+
* The step replaces strings like `"(a|b|c)"`
|
|
212
|
+
* with the result of the callback.
|
|
213
|
+
*
|
|
214
|
+
* @see {@link applyVariationsHtml}
|
|
215
|
+
* @see {@link applyVariationsNonHtml}
|
|
216
|
+
*/
|
|
217
|
+
declare const applyVariableParts: (callback: (arr: string[]) => string) => TaraskStep;
|
|
218
|
+
/**
|
|
219
|
+
* Uses {@link applyVariableParts}
|
|
220
|
+
*
|
|
221
|
+
* @example
|
|
222
|
+
* applyVariationsHtml({text: "a(b|c)d"});
|
|
223
|
+
* // {text: "a<tarL data-l='c'>b</tarL>d"}
|
|
224
|
+
*/
|
|
225
|
+
declare const applyVariationsHtml: TaraskStep;
|
|
226
|
+
/**
|
|
227
|
+
* Uses {@link applyVariableParts}
|
|
228
|
+
*/
|
|
229
|
+
declare const applyVariationsNonHtml: TaraskStep;
|
|
136
230
|
|
|
137
231
|
declare const prepare: TaraskStep;
|
|
138
232
|
|
|
139
|
-
|
|
140
|
-
|
|
233
|
+
/**
|
|
234
|
+
* Created in {@link resolveSpecialSyntax}.
|
|
235
|
+
*
|
|
236
|
+
* Emptied in {@link applyNoFix}.
|
|
237
|
+
*/
|
|
141
238
|
type SpecialSyntaxStorage = {
|
|
142
239
|
noFixArr: string[];
|
|
143
240
|
};
|
|
241
|
+
/**
|
|
242
|
+
* Brings parts from {@link SpecialSyntaxStorage} back to the text.
|
|
243
|
+
*
|
|
244
|
+
* Empties {@link SpecialSyntaxStorage.noFixArr}.
|
|
245
|
+
*/
|
|
246
|
+
declare const applyNoFix: TaraskStep<SpecialSyntaxStorage>;
|
|
247
|
+
/**
|
|
248
|
+
* Captures noFix parts and stores them in {@link SpecialSyntaxStorage.noFixArr}.
|
|
249
|
+
* Places a special character `" \ue0fe "` in their place.
|
|
250
|
+
*
|
|
251
|
+
* Use {@link applyNoFix} to bring the parts back to the text.
|
|
252
|
+
*
|
|
253
|
+
* Creates storage: {@link SpecialSyntaxStorage}.
|
|
254
|
+
*/
|
|
144
255
|
declare const resolveSpecialSyntax: (leftAngleBracket: string) => TaraskStep<SpecialSyntaxStorage>;
|
|
145
256
|
|
|
146
257
|
declare const restoreCaseStep: TaraskStep<SplittedTextStorage>;
|
|
@@ -151,63 +262,131 @@ declare const storeSplittedText: TaraskStep<SplittedTextStorage>;
|
|
|
151
262
|
|
|
152
263
|
declare const taraskevize: TaraskStep;
|
|
153
264
|
|
|
265
|
+
/**
|
|
266
|
+
* Created in {@link whitespacesToSpaces}.
|
|
267
|
+
*
|
|
268
|
+
* Emptied in {@link restoreWhitespaces}.
|
|
269
|
+
*/
|
|
154
270
|
type WhiteSpaceStorage = {
|
|
155
271
|
spaces: string[];
|
|
156
272
|
};
|
|
273
|
+
/**
|
|
274
|
+
* Captures all whitespaces and replaces them with a single space.
|
|
275
|
+
*
|
|
276
|
+
* Creates storage: {@link WhiteSpaceStorage}.
|
|
277
|
+
*/
|
|
157
278
|
declare const whitespacesToSpaces: TaraskStep<WhiteSpaceStorage>;
|
|
279
|
+
/**
|
|
280
|
+
* Brings original whitespaces back to the text.
|
|
281
|
+
*
|
|
282
|
+
* Empties {@link WhiteSpaceStorage.spaces}.
|
|
283
|
+
*/
|
|
158
284
|
declare const restoreWhitespaces: TaraskStep<WhiteSpaceStorage>;
|
|
159
285
|
|
|
160
286
|
declare const trim: TaraskStep;
|
|
161
287
|
|
|
288
|
+
declare const restoreParentheses: TaraskStep;
|
|
289
|
+
declare const afterJoin: TaraskStep;
|
|
290
|
+
declare const finalize: (newLine: string) => TaraskStep;
|
|
291
|
+
declare const toLowerCase: TaraskStep;
|
|
292
|
+
|
|
293
|
+
/**
|
|
294
|
+
* This module exports all the steps
|
|
295
|
+
* that are used in builtin pipelines.
|
|
296
|
+
*
|
|
297
|
+
* A step implements the {@link TaraskStep} type.
|
|
298
|
+
*
|
|
299
|
+
* Some steps are configurable, they take
|
|
300
|
+
* additional arguments and return a {@link TaraskStep},
|
|
301
|
+
* for example {@link resolveSpecialSyntax}.
|
|
302
|
+
*
|
|
303
|
+
* @module
|
|
304
|
+
*/
|
|
305
|
+
|
|
306
|
+
type index$1_SpecialSyntaxStorage = SpecialSyntaxStorage;
|
|
162
307
|
type index$1_SplittedTextStorage = SplittedTextStorage;
|
|
163
308
|
type index$1_TaraskStep<Storage = {}> = TaraskStep<Storage>;
|
|
164
|
-
|
|
165
|
-
declare const index$
|
|
309
|
+
type index$1_WhiteSpaceStorage = WhiteSpaceStorage;
|
|
310
|
+
declare const index$1_afterJoin: typeof afterJoin;
|
|
311
|
+
declare const index$1_applyGHtml: typeof applyGHtml;
|
|
312
|
+
declare const index$1_applyGNonHtml: typeof applyGNonHtml;
|
|
166
313
|
declare const index$1_applyNoFix: typeof applyNoFix;
|
|
167
|
-
declare const index$1_applyNonHtmlG: typeof applyNonHtmlG;
|
|
168
|
-
declare const index$1_applyNonHtmlVariations: typeof applyNonHtmlVariations;
|
|
169
314
|
declare const index$1_applyVariableParts: typeof applyVariableParts;
|
|
315
|
+
declare const index$1_applyVariationsHtml: typeof applyVariationsHtml;
|
|
316
|
+
declare const index$1_applyVariationsNonHtml: typeof applyVariationsNonHtml;
|
|
170
317
|
declare const index$1_convertAlphabet: typeof convertAlphabet;
|
|
171
318
|
declare const index$1_convertAlphabetLowerCase: typeof convertAlphabetLowerCase;
|
|
172
|
-
declare const index$
|
|
319
|
+
declare const index$1_finalize: typeof finalize;
|
|
173
320
|
declare const index$1_highlightDiffStep: typeof highlightDiffStep;
|
|
321
|
+
declare const index$1_highlightDiffStepNonHtml: typeof highlightDiffStepNonHtml;
|
|
174
322
|
declare const index$1_joinSplittedText: typeof joinSplittedText;
|
|
175
323
|
declare const index$1_prepare: typeof prepare;
|
|
176
324
|
declare const index$1_replaceIbyJ: typeof replaceIbyJ;
|
|
177
325
|
declare const index$1_resolveSpecialSyntax: typeof resolveSpecialSyntax;
|
|
178
326
|
declare const index$1_restoreCaseStep: typeof restoreCaseStep;
|
|
327
|
+
declare const index$1_restoreParentheses: typeof restoreParentheses;
|
|
179
328
|
declare const index$1_restoreWhitespaces: typeof restoreWhitespaces;
|
|
180
329
|
declare const index$1_storeSplittedAbcConvertedOrig: typeof storeSplittedAbcConvertedOrig;
|
|
181
330
|
declare const index$1_storeSplittedText: typeof storeSplittedText;
|
|
182
331
|
declare const index$1_taraskevize: typeof taraskevize;
|
|
332
|
+
declare const index$1_toLowerCase: typeof toLowerCase;
|
|
183
333
|
declare const index$1_trim: typeof trim;
|
|
184
334
|
declare const index$1_whitespacesToSpaces: typeof whitespacesToSpaces;
|
|
185
335
|
declare namespace index$1 {
|
|
186
|
-
export { type index$1_SplittedTextStorage as SplittedTextStorage, type index$1_TaraskStep as TaraskStep, index$
|
|
336
|
+
export { type index$1_SpecialSyntaxStorage as SpecialSyntaxStorage, type index$1_SplittedTextStorage as SplittedTextStorage, type index$1_TaraskStep as TaraskStep, type index$1_WhiteSpaceStorage as WhiteSpaceStorage, index$1_afterJoin as afterJoin, index$1_applyGHtml as applyGHtml, index$1_applyGNonHtml as applyGNonHtml, index$1_applyNoFix as applyNoFix, index$1_applyVariableParts as applyVariableParts, index$1_applyVariationsHtml as applyVariationsHtml, index$1_applyVariationsNonHtml as applyVariationsNonHtml, index$1_convertAlphabet as convertAlphabet, index$1_convertAlphabetLowerCase as convertAlphabetLowerCase, index$1_finalize as finalize, index$1_highlightDiffStep as highlightDiffStep, index$1_highlightDiffStepNonHtml as highlightDiffStepNonHtml, index$1_joinSplittedText as joinSplittedText, index$1_prepare as prepare, index$1_replaceIbyJ as replaceIbyJ, index$1_resolveSpecialSyntax as resolveSpecialSyntax, index$1_restoreCaseStep as restoreCaseStep, index$1_restoreParentheses as restoreParentheses, index$1_restoreWhitespaces as restoreWhitespaces, index$1_storeSplittedAbcConvertedOrig as storeSplittedAbcConvertedOrig, index$1_storeSplittedText as storeSplittedText, index$1_taraskevize as taraskevize, index$1_toLowerCase as toLowerCase, index$1_trim as trim, index$1_whitespacesToSpaces as whitespacesToSpaces };
|
|
187
337
|
}
|
|
188
338
|
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
339
|
+
/**
|
|
340
|
+
* @returns converted text
|
|
341
|
+
*
|
|
342
|
+
* @example
|
|
343
|
+
* tarask("планета", plainTextPipeline);
|
|
344
|
+
* // "плянэта"
|
|
345
|
+
*/
|
|
346
|
+
declare const tarask: (text: string, pipeline: TaraskStep<any>[], cfg?: Readonly<TaraskConfig>) => string;
|
|
347
|
+
|
|
348
|
+
/**
|
|
349
|
+
* Storage for the pipeline {@link abcOnly}.
|
|
350
|
+
*/
|
|
351
|
+
type AbcOnlyStorage = {
|
|
352
|
+
doEscapeCapitalized: boolean;
|
|
353
|
+
};
|
|
354
|
+
/**
|
|
355
|
+
* Pipeline for changing only the alphabet.
|
|
356
|
+
*
|
|
357
|
+
* The property `cfg.general.doEscapeCapitalized` is set to `false` during the pipeline execution.
|
|
358
|
+
*
|
|
359
|
+
* To see the full list of steps, check the source code.
|
|
360
|
+
*/
|
|
361
|
+
declare const abcOnly: (TaraskStep<SpecialSyntaxStorage> | TaraskStep<WhiteSpaceStorage> | (({ storage, cfg: { general } }: {
|
|
362
|
+
text: string;
|
|
363
|
+
storage: AbcOnlyStorage;
|
|
199
364
|
cfg: TaraskConfig;
|
|
200
|
-
}) =>
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
declare const
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
365
|
+
}) => void))[];
|
|
366
|
+
/**
|
|
367
|
+
* Pipeline for taraskevizing into plain text.
|
|
368
|
+
*
|
|
369
|
+
* To see the full list of steps, check the source code.
|
|
370
|
+
*/
|
|
371
|
+
declare const plainText: (TaraskStep<SplittedTextStorage> | TaraskStep<SpecialSyntaxStorage> | TaraskStep<WhiteSpaceStorage>)[];
|
|
372
|
+
/**
|
|
373
|
+
* Pipeline for taraskevizing into HTML.
|
|
374
|
+
*
|
|
375
|
+
* To see the full list of steps, check the source code.
|
|
376
|
+
*/
|
|
377
|
+
declare const html: (TaraskStep<SplittedTextStorage> | TaraskStep<SpecialSyntaxStorage> | TaraskStep<WhiteSpaceStorage>)[];
|
|
378
|
+
|
|
379
|
+
declare const pipelines_abcOnly: typeof abcOnly;
|
|
380
|
+
declare const pipelines_html: typeof html;
|
|
381
|
+
declare const pipelines_plainText: typeof plainText;
|
|
382
|
+
declare namespace pipelines {
|
|
383
|
+
export { pipelines_abcOnly as abcOnly, pipelines_html as html, pipelines_plainText as plainText };
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
type ExtendedDict = readonly (readonly [
|
|
387
|
+
RegExp,
|
|
388
|
+
string | ((...substrings: string[]) => string)
|
|
389
|
+
])[];
|
|
211
390
|
|
|
212
391
|
declare const afterTarask: ExtendedDict;
|
|
213
392
|
|
|
@@ -220,19 +399,26 @@ declare const replaceWithDict: (text: string, dict?: ExtendedDict) => string;
|
|
|
220
399
|
declare const restoreCase: (text: string[], orig: readonly string[]) => string[];
|
|
221
400
|
|
|
222
401
|
declare const htmlWrappers: {
|
|
223
|
-
fix: (content: string) => string
|
|
224
|
-
letterH: (content: string) => string
|
|
402
|
+
fix: (content: string) => `<tarF>${string}</tarF>`;
|
|
403
|
+
letterH: (content: string) => `<tarH>${string}</tarH>`;
|
|
225
404
|
};
|
|
226
405
|
declare const ansiColorWrappers: {
|
|
227
406
|
fix: (content: string) => string;
|
|
228
407
|
variable: (content: string) => string;
|
|
229
408
|
};
|
|
230
409
|
|
|
410
|
+
/**
|
|
411
|
+
* Collection of functions that help to work with dictionaries.
|
|
412
|
+
*/
|
|
231
413
|
declare const dictFrom: {
|
|
232
414
|
raw: (dict: RawDict, additionalFlags?: string) => Dict;
|
|
415
|
+
/**
|
|
416
|
+
* Adds the global flag to all patterns in the dictionary.
|
|
417
|
+
*/
|
|
233
418
|
nonGlobal: (dict: WritableDict) => Dict;
|
|
234
419
|
};
|
|
235
420
|
|
|
421
|
+
type index_ExtendedDict = ExtendedDict;
|
|
236
422
|
declare const index_afterTarask: typeof afterTarask;
|
|
237
423
|
declare const index_ansiColorWrappers: typeof ansiColorWrappers;
|
|
238
424
|
declare const index_dictFrom: typeof dictFrom;
|
|
@@ -242,7 +428,7 @@ declare const index_replaceG: typeof replaceG;
|
|
|
242
428
|
declare const index_replaceWithDict: typeof replaceWithDict;
|
|
243
429
|
declare const index_restoreCase: typeof restoreCase;
|
|
244
430
|
declare namespace index {
|
|
245
|
-
export { index_afterTarask as afterTarask, index_ansiColorWrappers as ansiColorWrappers, index_dictFrom as dictFrom, index_highlightDiff as highlightDiff, index_htmlWrappers as htmlWrappers, index_replaceG as replaceG, index_replaceWithDict as replaceWithDict, index_restoreCase as restoreCase };
|
|
431
|
+
export { type index_ExtendedDict as ExtendedDict, index_afterTarask as afterTarask, index_ansiColorWrappers as ansiColorWrappers, index_dictFrom as dictFrom, index_highlightDiff as highlightDiff, index_htmlWrappers as htmlWrappers, index_replaceG as replaceG, index_replaceWithDict as replaceWithDict, index_restoreCase as restoreCase };
|
|
246
432
|
}
|
|
247
433
|
|
|
248
|
-
export { type
|
|
434
|
+
export { type HtmlOptions, type NonHtmlOptions, REPLACE_J, TaraskConfig, type TaraskOptions, VARIATION, index$3 as dicts, index as lib, pipelines, index$1 as steps, tarask };
|