taraskevizer 9.2.1 → 9.2.3
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 +29 -30
- package/dist/pipelines.d.ts +9 -8
- package/dist/pipelines.js +2 -2
- package/dist/tarask.d.ts +2 -2
- package/package.json +5 -5
package/dist/bin.js
CHANGED
|
@@ -1,61 +1,60 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { dicts, TaraskConfig, tarask, pipelines, htmlConfigOptions, wrappers, } from './index.js';
|
|
3
|
-
const prefix = '\x1b[34m[taraskevizer]\x1b[0m ';
|
|
4
3
|
const printWithPrefix = (msg) => {
|
|
5
|
-
process.stdout.write(
|
|
4
|
+
process.stdout.write("[34m[taraskevizer][0m" + msg + '\n');
|
|
6
5
|
};
|
|
7
6
|
process.argv.splice(0, 2);
|
|
8
7
|
const checkForOptions = (options) => process.argv[0] && options.includes(process.argv[0].toLowerCase());
|
|
9
8
|
if (checkForOptions(['-v', '--version'])) {
|
|
10
|
-
printWithPrefix("9.2.
|
|
9
|
+
printWithPrefix("9.2.3");
|
|
11
10
|
process.exit(0);
|
|
12
11
|
}
|
|
13
12
|
if (checkForOptions(['-h', '--help'])) {
|
|
14
|
-
printWithPrefix(`Usage:
|
|
13
|
+
printWithPrefix(`Usage: [34mtarask[0m [options] text
|
|
15
14
|
If text is not passed, interactive mode will be enabled
|
|
16
15
|
|
|
17
16
|
EXAMPLES
|
|
18
17
|
|
|
19
18
|
Convert and latinize a word
|
|
20
|
-
|
|
21
|
-
Will print "p
|
|
19
|
+
[34mtarask[0m [35m--latin[0m 'планета'
|
|
20
|
+
Will print "p[32ml[0ma[32mne[0mta"
|
|
22
21
|
|
|
23
22
|
Read from one file and write converted text to another
|
|
24
|
-
|
|
23
|
+
[34mtarask[0m < ./cyr-text.txt > ./lat-text.txt
|
|
25
24
|
|
|
26
25
|
Enter interactive mode
|
|
27
|
-
|
|
28
|
-
Will print "[taraskevizer] Enter the text:" and wait until you press Enter
|
|
26
|
+
[34mtarask[0m
|
|
27
|
+
Will print "[34m[taraskevizer][0m Enter the text:" and wait until you press Enter
|
|
29
28
|
|
|
30
29
|
OPTIONS
|
|
31
30
|
|
|
32
|
-
|
|
33
|
-
-h --help
|
|
34
|
-
-v --version
|
|
31
|
+
[33mGeneral[0m:
|
|
32
|
+
[35m-h[0m [35m--help[0m
|
|
33
|
+
[35m-v[0m [35m--version[0m
|
|
35
34
|
|
|
36
|
-
|
|
37
|
-
-l --latin
|
|
38
|
-
-lj --latin-ji
|
|
39
|
-
-a --arabic
|
|
35
|
+
[33mAlphabet[0m:
|
|
36
|
+
[35m-l[0m [35m--latin[0m
|
|
37
|
+
[35m-lj[0m [35m--latin-ji[0m
|
|
38
|
+
[35m-a[0m [35m--arabic[0m
|
|
40
39
|
|
|
41
|
-
|
|
42
|
-
-jr --jrandom
|
|
43
|
-
-ja --jalways
|
|
40
|
+
[33mWhen to replace і(i) by й(j) after vowels[0m:
|
|
41
|
+
[35m-jr[0m [35m--jrandom[0m
|
|
42
|
+
[35m-ja[0m [35m--jalways[0m
|
|
44
43
|
|
|
45
|
-
|
|
46
|
-
--h
|
|
44
|
+
[33mReplace ґ(g) by г(h) in cyrillic alphabet[0m:
|
|
45
|
+
[35m--h[0m
|
|
47
46
|
|
|
48
|
-
|
|
49
|
-
-nv --no-variations
|
|
50
|
-
-fv --first-variation
|
|
47
|
+
[33mVariations[0m:
|
|
48
|
+
[35m-nv[0m [35m--no-variations[0m
|
|
49
|
+
[35m-fv[0m [35m--first-variation[0m
|
|
51
50
|
|
|
52
|
-
|
|
53
|
-
-html --html
|
|
54
|
-
-abc --alphabet-only
|
|
51
|
+
[33mMode (only one can be used)[0m:
|
|
52
|
+
[35m-html[0m [35m--html[0m
|
|
53
|
+
[35m-abc[0m [35m--alphabet-only[0m
|
|
55
54
|
|
|
56
|
-
|
|
57
|
-
-nec --not-escape-caps
|
|
58
|
-
-nc --no-color
|
|
55
|
+
[33mOther[0m:
|
|
56
|
+
[35m-nec[0m [35m--not-escape-caps[0m
|
|
57
|
+
[35m-nc[0m [35m--no-color[0m
|
|
59
58
|
`);
|
|
60
59
|
process.exit(0);
|
|
61
60
|
}
|
package/dist/pipelines.d.ts
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
* an array of steps of type {@link steps.TaraskStep}.
|
|
2
|
+
* You can use builtin pipelines from this module or create your own.
|
|
4
3
|
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
* If you want to create a pipeline based on a pre-made one
|
|
4
|
+
* If you want to create a pipeline based on a builtin one
|
|
8
5
|
* and do it more safely, it's recommended to use
|
|
9
6
|
* `.map` if you need replacing only or
|
|
10
7
|
* `.flatMap` if you also need to add or remove steps.
|
|
11
8
|
*
|
|
12
9
|
* This way you will depend less on the
|
|
13
|
-
* internal structure of the
|
|
10
|
+
* internal structure of the builtin pipeline.
|
|
11
|
+
*
|
|
12
|
+
* For cases when you need to replace only {@link steps.taraskevize} in {@link tar}
|
|
13
|
+
* and have better tree-shaking, you can use {@link _createPipeline}.
|
|
14
14
|
*
|
|
15
15
|
* @module
|
|
16
16
|
*/
|
|
@@ -21,6 +21,7 @@ import { type TaraskStep } from './steps';
|
|
|
21
21
|
type AbcOnlyStorage = {
|
|
22
22
|
doEscapeCapitalized: boolean;
|
|
23
23
|
};
|
|
24
|
+
export type Pipeline = TaraskStep<any>[];
|
|
24
25
|
/**
|
|
25
26
|
* Pipeline for changing only the alphabet.
|
|
26
27
|
*
|
|
@@ -38,9 +39,9 @@ export declare const abc: (TaraskStep<import("./steps").SpecialSyntaxStorage> |
|
|
|
38
39
|
*
|
|
39
40
|
* Used by {@link tar} and {@link phonetic}.
|
|
40
41
|
*
|
|
41
|
-
* @param
|
|
42
|
+
* @param subPipeline - Steps used instead of [{@link subPipeline.taraskevize}].
|
|
42
43
|
*/
|
|
43
|
-
export declare const _createPipeline: (
|
|
44
|
+
export declare const _createPipeline: (subPipeline: Pipeline) => (TaraskStep<import("./steps").SplittedTextStorage> | TaraskStep<import("./steps").SpecialSyntaxStorage> | TaraskStep<import("./steps").WhiteSpaceStorage> | TaraskStep<import("./steps").TrimStorage>)[];
|
|
44
45
|
/**
|
|
45
46
|
* Pipeline for taraskevizing.
|
|
46
47
|
*/
|
package/dist/pipelines.js
CHANGED
|
@@ -20,14 +20,14 @@ export const abc = [
|
|
|
20
20
|
}),
|
|
21
21
|
];
|
|
22
22
|
|
|
23
|
-
export const _createPipeline = (
|
|
23
|
+
export const _createPipeline = (subPipeline) => [
|
|
24
24
|
trim,
|
|
25
25
|
resolveSpecialSyntax,
|
|
26
26
|
prepare,
|
|
27
27
|
whitespacesToSpaces,
|
|
28
28
|
storeSplittedAbcConvertedOrig,
|
|
29
29
|
toLowerCase,
|
|
30
|
-
...
|
|
30
|
+
...subPipeline,
|
|
31
31
|
replaceIbyJ,
|
|
32
32
|
convertAlphabetLowerCase,
|
|
33
33
|
storeSplittedText,
|
package/dist/tarask.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { TaraskConfig } from './config';
|
|
2
|
-
import type {
|
|
2
|
+
import type { Pipeline } from './pipelines';
|
|
3
3
|
/**
|
|
4
4
|
* @returns converted text
|
|
5
5
|
*
|
|
@@ -7,4 +7,4 @@ import type { TaraskStep } from './steps';
|
|
|
7
7
|
* tarask("планета", pipelines.tar);
|
|
8
8
|
* // "плянэта"
|
|
9
9
|
*/
|
|
10
|
-
export declare const tarask: (text: string, pipeline:
|
|
10
|
+
export declare const tarask: (text: string, pipeline: Pipeline, cfg?: Readonly<TaraskConfig>) => string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "taraskevizer",
|
|
3
|
-
"version": "9.2.
|
|
3
|
+
"version": "9.2.3",
|
|
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.16.
|
|
14
|
-
"bun-types": "^1.1.
|
|
13
|
+
"@types/node": "^20.16.11",
|
|
14
|
+
"bun-types": "^1.1.30",
|
|
15
15
|
"husky": "^9.1.6",
|
|
16
16
|
"prettier": "^3.3.3",
|
|
17
|
-
"typedoc": "^0.26.
|
|
18
|
-
"typescript": "^5.6.
|
|
17
|
+
"typedoc": "^0.26.9",
|
|
18
|
+
"typescript": "^5.6.3"
|
|
19
19
|
},
|
|
20
20
|
"bin": {
|
|
21
21
|
"tarask": "dist/bin.js"
|