taraskevizer 9.1.5 → 9.1.7
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/dist/bin.js +1 -1
- package/dist/config.d.ts +27 -10
- package/dist/config.js +2 -0
- package/dist/constants.d.ts +1 -1
- package/dist/dict/iawords.js +1 -1
- package/dist/lib/after-tarask.js +6 -2
- package/dist/lib/mutating-step.d.ts +1 -1
- package/dist/steps/finalize.js +9 -6
- package/dist/steps/join-splitted.d.ts +1 -1
- package/dist/steps/types.d.ts +1 -1
- package/dist/wrappers.d.ts +1 -1
- package/package.json +5 -5
package/dist/bin.js
CHANGED
|
@@ -7,7 +7,7 @@ const printWithPrefix = (msg) => {
|
|
|
7
7
|
process.argv.splice(0, 2);
|
|
8
8
|
const checkForOptions = (options) => process.argv[0] && options.includes(process.argv[0].toLowerCase());
|
|
9
9
|
if (checkForOptions(['-v', '--version'])) {
|
|
10
|
-
printWithPrefix("9.1.
|
|
10
|
+
printWithPrefix("9.1.7");
|
|
11
11
|
process.exit(0);
|
|
12
12
|
}
|
|
13
13
|
if (checkForOptions(['-h', '--help'])) {
|
package/dist/config.d.ts
CHANGED
|
@@ -1,14 +1,12 @@
|
|
|
1
1
|
import type { PartialReadonly } from './types';
|
|
2
|
-
import { Alphabet } from './dict/alphabets';
|
|
3
|
-
import { WrapperDict } from './wrappers';
|
|
2
|
+
import type { Alphabet } from './dict/alphabets';
|
|
3
|
+
import { type WrapperDict } from './wrappers';
|
|
4
4
|
export type Variation = 'no' | 'first' | 'all';
|
|
5
5
|
export type OptionJ = 'never' | 'random' | 'always';
|
|
6
6
|
export declare class TaraskConfig {
|
|
7
7
|
constructor(options?: PartialReadonly<TaraskConfig>);
|
|
8
8
|
/**
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
* The set of defined alphabets can be found in {@link dicts.alphabets}.
|
|
9
|
+
* Predefined alphabets are in {@link dicts.alphabets}.
|
|
12
10
|
*
|
|
13
11
|
* @default alphabets.cyrillic
|
|
14
12
|
*/
|
|
@@ -32,7 +30,14 @@ export declare class TaraskConfig {
|
|
|
32
30
|
* @default true
|
|
33
31
|
*/
|
|
34
32
|
doEscapeCapitalized: boolean;
|
|
35
|
-
/**
|
|
33
|
+
/**
|
|
34
|
+
* Used for wrapping changed parts.
|
|
35
|
+
* Predefined dicts are in {@link wrappers}.
|
|
36
|
+
*
|
|
37
|
+
* If `null`, wrapping changes will be skipped.
|
|
38
|
+
*
|
|
39
|
+
* @default null
|
|
40
|
+
*/
|
|
36
41
|
wrapperDict: null | WrapperDict;
|
|
37
42
|
/**
|
|
38
43
|
* Do replace ґ(g) by г(h) in cyrillic alphabet?
|
|
@@ -58,7 +63,19 @@ export declare class TaraskConfig {
|
|
|
58
63
|
* @default "all"
|
|
59
64
|
*/
|
|
60
65
|
variations: Variation;
|
|
66
|
+
/**
|
|
67
|
+
* String to replace `"\n"` with.
|
|
68
|
+
*
|
|
69
|
+
* @default "\n"
|
|
70
|
+
* @example "<br>"
|
|
71
|
+
*/
|
|
61
72
|
newLine: string;
|
|
73
|
+
/**
|
|
74
|
+
* String to replace `"<"` with.
|
|
75
|
+
*
|
|
76
|
+
* @default "<"
|
|
77
|
+
* @example "<"
|
|
78
|
+
*/
|
|
62
79
|
leftAngleBracket: string;
|
|
63
80
|
}
|
|
64
81
|
/**
|
|
@@ -71,8 +88,8 @@ export declare class TaraskConfig {
|
|
|
71
88
|
* });
|
|
72
89
|
*/
|
|
73
90
|
export declare const htmlConfigOptions: {
|
|
74
|
-
wrapperDict: Required<WrapperDict>;
|
|
75
|
-
g: false;
|
|
76
|
-
newLine:
|
|
77
|
-
leftAngleBracket:
|
|
91
|
+
readonly wrapperDict: Required<WrapperDict>;
|
|
92
|
+
readonly g: false;
|
|
93
|
+
readonly newLine: "<br>";
|
|
94
|
+
readonly leftAngleBracket: "<";
|
|
78
95
|
};
|
package/dist/config.js
CHANGED
package/dist/constants.d.ts
CHANGED
package/dist/dict/iawords.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { iwords } from './iwords.js';
|
|
2
2
|
import { dictFrom, toOneLine } from './lib.js';
|
|
3
|
-
const ia = (word, words) => ` ${word}(?= \\(?(?:[
|
|
3
|
+
const ia = (word, words) => ` ${word}(?= \\(?(?:[бвгджзйклмнпрстфцчшўьʼ]*[оё]|${toOneLine(words).replace(/\(/g, '(?:')}|i(?:${iwords})))`;
|
|
4
4
|
export const iaWords = dictFrom.raw([
|
|
5
5
|
|
|
6
6
|
[
|
package/dist/lib/after-tarask.js
CHANGED
|
@@ -1,13 +1,17 @@
|
|
|
1
1
|
const prepositionPattern = /^(?:а[бд]?|б[ея]зь?|[дз]а|д?ля|дзеля|[нп]ад?|пр[аы]|празь?|у|церазь?)$/;
|
|
2
2
|
const isSingleVowel = (str) => str.match(/[аеёіоуыэюя]/g)?.length === 1;
|
|
3
|
+
const isFirstSyllabeStressed = (word) => /^[бвгджзйклмнпрстфцчшўьʼ]*.\u0301/.test(word);
|
|
3
4
|
export const endZSoftenAndNiaBiaz = [
|
|
4
5
|
[
|
|
5
6
|
/ бе(зь? \S+)/g,
|
|
6
|
-
($0, $1) => (isSingleVowel($1) ? ' бя' + $1 : $0
|
|
7
|
+
($0, $1) => isFirstSyllabeStressed($1) || isSingleVowel($1) ? ' бя' + $1 : $0,
|
|
7
8
|
],
|
|
8
9
|
[
|
|
9
10
|
/ не (\S+)/g,
|
|
10
|
-
($0, $1) =>
|
|
11
|
+
($0, $1) => isFirstSyllabeStressed($1) ||
|
|
12
|
+
(isSingleVowel($1) && !prepositionPattern.test($1))
|
|
13
|
+
? ' ня ' + $1
|
|
14
|
+
: $0,
|
|
11
15
|
],
|
|
12
16
|
[/ б[ея]з(?= і\S*[ая]ў|ну )/g, ' бязь'],
|
|
13
17
|
[/( (?:пра|цера)?з)(?= і\S*[ая]ў|ну )/g, (_$0, $1) => $1 + 'ь'],
|
package/dist/steps/finalize.js
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
import { mutatingStep } from '../lib/index.js';
|
|
2
2
|
|
|
3
|
-
export const finalize = mutatingStep(({ text, cfg: { newLine } }) =>
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
3
|
+
export const finalize = mutatingStep(({ text, cfg: { newLine } }) => {
|
|
4
|
+
text = text
|
|
5
|
+
.replace(/(/g, '(')
|
|
6
|
+
.replace(/ /g, ' ')
|
|
7
|
+
.replace(/ (\p{P}|\p{S}|\d+) /gu, '$1');
|
|
8
|
+
if (newLine !== '\n')
|
|
9
|
+
text = text.replace(/\n/g, newLine);
|
|
10
|
+
return text.trim();
|
|
11
|
+
});
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { SplittedTextStorage } from './types';
|
|
1
|
+
import type { SplittedTextStorage } from './types';
|
|
2
2
|
export declare const joinSplittedText: import("./types").TaraskStep<SplittedTextStorage>;
|
package/dist/steps/types.d.ts
CHANGED
package/dist/wrappers.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "taraskevizer",
|
|
3
|
-
"version": "9.1.
|
|
3
|
+
"version": "9.1.7",
|
|
4
4
|
"author": "GooseOb",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -10,12 +10,12 @@
|
|
|
10
10
|
"module": "dist/index.js",
|
|
11
11
|
"devDependencies": {
|
|
12
12
|
"@digitak/esrun": "^3.2.26",
|
|
13
|
-
"@types/node": "^20.14.
|
|
14
|
-
"bun-types": "^1.1.
|
|
15
|
-
"husky": "^9.1.
|
|
13
|
+
"@types/node": "^20.14.14",
|
|
14
|
+
"bun-types": "^1.1.21",
|
|
15
|
+
"husky": "^9.1.4",
|
|
16
16
|
"prettier": "^3.3.3",
|
|
17
17
|
"typedoc": "^0.25.13",
|
|
18
|
-
"typescript": "^5.5.
|
|
18
|
+
"typescript": "^5.5.4"
|
|
19
19
|
},
|
|
20
20
|
"bin": {
|
|
21
21
|
"tarask": "dist/bin.js"
|