taraskevizer 1.1.2 → 1.2.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 +75 -1
- package/bin/index.js +99 -0
- package/dist/index.cjs +2191 -0
- package/dist/index.d.ts +12 -5
- package/dist/index.js +1636 -1635
- package/package.json +7 -2
- package/dist/index.mjs +0 -2134
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
## Install
|
|
2
2
|
|
|
3
|
-
```
|
|
3
|
+
```bash
|
|
4
4
|
$ npm i taraskevizer
|
|
5
5
|
```
|
|
6
6
|
|
|
@@ -82,6 +82,48 @@ false: <tarH>г</tarH> <tarH>Г</tarH>
|
|
|
82
82
|
true: <tarH>ґ</tarH> <tarH>Ґ</tarH>
|
|
83
83
|
```
|
|
84
84
|
|
|
85
|
+
### nonHtml
|
|
86
|
+
|
|
87
|
+
Type: `false|object`
|
|
88
|
+
|
|
89
|
+
Default value: `false`
|
|
90
|
+
|
|
91
|
+
If `html` is defined, will be ignored
|
|
92
|
+
|
|
93
|
+
#### nodeColors
|
|
94
|
+
|
|
95
|
+
Type: `boolean`
|
|
96
|
+
|
|
97
|
+
Default value: `false`
|
|
98
|
+
|
|
99
|
+
#### h
|
|
100
|
+
|
|
101
|
+
Type: `boolean`
|
|
102
|
+
|
|
103
|
+
Default value: `false`
|
|
104
|
+
|
|
105
|
+
Do replace ґ(g) by г(h) in cyrillic alphabet?
|
|
106
|
+
|
|
107
|
+
```
|
|
108
|
+
false: Ґ ґ
|
|
109
|
+
|
|
110
|
+
true: Г г
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
#### variations
|
|
114
|
+
|
|
115
|
+
Type: `number`
|
|
116
|
+
|
|
117
|
+
Default value: `0`
|
|
118
|
+
|
|
119
|
+
Which variation should be if a part of word is variable?
|
|
120
|
+
|
|
121
|
+
```
|
|
122
|
+
0 = main: Гродна
|
|
123
|
+
1 = first: Горадня
|
|
124
|
+
2 = all: (Гродна|Горадня)
|
|
125
|
+
```
|
|
126
|
+
|
|
85
127
|
## HTML tags
|
|
86
128
|
|
|
87
129
|
### tarF
|
|
@@ -115,3 +157,35 @@ Can be replaced by `ґ`(`g`) letter. appears only if alphabet is cyrillic
|
|
|
115
157
|
|
|
116
158
|
<tarH>Г</tarH>валт
|
|
117
159
|
```
|
|
160
|
+
|
|
161
|
+
# CLI
|
|
162
|
+
|
|
163
|
+
## Install
|
|
164
|
+
|
|
165
|
+
```bash
|
|
166
|
+
$ npm i -g taraskevizer
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
## Usage
|
|
170
|
+
|
|
171
|
+
```bash
|
|
172
|
+
$ taraskevize "планета"
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
## Options
|
|
176
|
+
|
|
177
|
+
```bash
|
|
178
|
+
# Alpabet
|
|
179
|
+
--latin (-l)
|
|
180
|
+
--arabic (-a)
|
|
181
|
+
# When to replace і by й after vowels
|
|
182
|
+
--jrandom (-jr)
|
|
183
|
+
--jalways (-ja)
|
|
184
|
+
# Do replace ґ(g) by г(h) in cyrillic alphabet?
|
|
185
|
+
--h (-h)
|
|
186
|
+
# Variations
|
|
187
|
+
--no-variations (-nv)
|
|
188
|
+
--first-variation-only (-fvo)
|
|
189
|
+
# Other
|
|
190
|
+
--no-color (-nc)
|
|
191
|
+
```
|
package/bin/index.js
ADDED
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { taraskSync } from '../dist/index.js';
|
|
3
|
+
import { readFile } from 'fs/promises';
|
|
4
|
+
|
|
5
|
+
const print = (...msgs) => {
|
|
6
|
+
console.log('\x1b[34m[taraskevizer]\x1b[0m', ...msgs);
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
const getPkg = () =>
|
|
10
|
+
readFile(new URL('../package.json', import.meta.url)).then(JSON.parse);
|
|
11
|
+
|
|
12
|
+
process.argv.splice(0, 2);
|
|
13
|
+
|
|
14
|
+
const checkForOptions = (options) =>
|
|
15
|
+
options.includes(process.argv[0].toLowerCase());
|
|
16
|
+
|
|
17
|
+
if (checkForOptions(['-v', '--version'])) {
|
|
18
|
+
const { version } = await getPkg();
|
|
19
|
+
print(version);
|
|
20
|
+
process.exit(0);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
const stgs = {
|
|
24
|
+
nonHtml: {
|
|
25
|
+
variations: 2,
|
|
26
|
+
nodeColors: true,
|
|
27
|
+
},
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
const optionDict = [
|
|
31
|
+
[
|
|
32
|
+
['--latin', '-l'],
|
|
33
|
+
() => {
|
|
34
|
+
stgs.abc = 1;
|
|
35
|
+
},
|
|
36
|
+
],
|
|
37
|
+
[
|
|
38
|
+
['--arabic', '-a'],
|
|
39
|
+
() => {
|
|
40
|
+
stgs.abc = 2;
|
|
41
|
+
},
|
|
42
|
+
],
|
|
43
|
+
[
|
|
44
|
+
['--jrandom', '-jr'],
|
|
45
|
+
() => {
|
|
46
|
+
stgs.j = 1;
|
|
47
|
+
},
|
|
48
|
+
],
|
|
49
|
+
[
|
|
50
|
+
['--jalways', '-ja'],
|
|
51
|
+
() => {
|
|
52
|
+
stgs.j = 2;
|
|
53
|
+
},
|
|
54
|
+
],
|
|
55
|
+
[
|
|
56
|
+
['--h', '-h'],
|
|
57
|
+
() => {
|
|
58
|
+
stgs.nonHtml.h = true;
|
|
59
|
+
},
|
|
60
|
+
],
|
|
61
|
+
[
|
|
62
|
+
['--no-variations', '-nv'],
|
|
63
|
+
() => {
|
|
64
|
+
stgs.nonHtml.variations = 0;
|
|
65
|
+
},
|
|
66
|
+
],
|
|
67
|
+
[
|
|
68
|
+
['--first-variation-only', '-fvo'],
|
|
69
|
+
() => {
|
|
70
|
+
stgs.nonHtml.variations = 1;
|
|
71
|
+
},
|
|
72
|
+
],
|
|
73
|
+
[
|
|
74
|
+
['--no-color', '-nc'],
|
|
75
|
+
() => {
|
|
76
|
+
stgs.nonHtml.nodeColors = false;
|
|
77
|
+
},
|
|
78
|
+
],
|
|
79
|
+
[
|
|
80
|
+
['--html', '-html'],
|
|
81
|
+
() => {
|
|
82
|
+
stgs.html = {};
|
|
83
|
+
},
|
|
84
|
+
],
|
|
85
|
+
];
|
|
86
|
+
|
|
87
|
+
optionEater: while (true) {
|
|
88
|
+
for (const [options, callback] of optionDict)
|
|
89
|
+
if (checkForOptions(options)) {
|
|
90
|
+
process.argv.shift();
|
|
91
|
+
callback();
|
|
92
|
+
continue optionEater;
|
|
93
|
+
}
|
|
94
|
+
break;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
const text = process.argv.join(' ');
|
|
98
|
+
|
|
99
|
+
console.log(taraskSync(text, stgs));
|