taraskevizer 5.3.2 → 6.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 +3 -3
- package/dist/index.cjs +85 -46
- package/dist/index.d.ts +5 -3
- package/dist/index.js +85 -46
- package/package.json +1 -4
package/README.md
CHANGED
|
@@ -53,7 +53,7 @@ taraskevizer.convertToHtml('энергія планеты');
|
|
|
53
53
|
// "en<tarF>erg</tarF>ija p<tarF>lan</tarF>ety"
|
|
54
54
|
|
|
55
55
|
// properties can be rewritten after creating an object
|
|
56
|
-
taraskevizer.abc = ALPHABET.ARABIC;
|
|
56
|
+
taraskevizer.general.abc = ALPHABET.ARABIC;
|
|
57
57
|
taraskevizer.html.g = true;
|
|
58
58
|
|
|
59
59
|
const latinizerWithJi = new Taraskevizer({
|
|
@@ -108,13 +108,13 @@ If set to false, may cause unwanted changes in acronyms.
|
|
|
108
108
|
|
|
109
109
|
Is always `true` in `convertAlphabetOnly`.
|
|
110
110
|
|
|
111
|
-
###
|
|
111
|
+
### taraskevize
|
|
112
112
|
|
|
113
113
|
Type: `(text: string) => string`
|
|
114
114
|
|
|
115
115
|
Default value: internal function `taraskevize`
|
|
116
116
|
|
|
117
|
-
|
|
117
|
+
Overriddes internal function in order to change behaviour of taraskevization.
|
|
118
118
|
This function usually uses private api via `__tarask__`
|
|
119
119
|
|
|
120
120
|
## html
|
package/dist/index.cjs
CHANGED
|
@@ -2004,7 +2004,6 @@ for (const word of gwords)
|
|
|
2004
2004
|
wordlist.push([RegExp(word.replace(/ґ/g, "г"), "g"), word]);
|
|
2005
2005
|
|
|
2006
2006
|
// src/tarask.ts
|
|
2007
|
-
var import_diff = require("diff");
|
|
2008
2007
|
var isUpperCase = (str) => str === str.toUpperCase();
|
|
2009
2008
|
var getLastLetter = (word, i) => {
|
|
2010
2009
|
for (let i2 = word.length - 1; i2 >= 0; i2--)
|
|
@@ -2097,13 +2096,62 @@ var restoreCase = (text, orig) => {
|
|
|
2097
2096
|
}
|
|
2098
2097
|
return text;
|
|
2099
2098
|
};
|
|
2100
|
-
var
|
|
2101
|
-
(
|
|
2102
|
-
|
|
2103
|
-
|
|
2104
|
-
|
|
2105
|
-
|
|
2106
|
-
|
|
2099
|
+
var highlightDiff = (text, orig, isCyrillic, highlight) => {
|
|
2100
|
+
for (let i = 0; i < text.length; i++) {
|
|
2101
|
+
const word = text[i];
|
|
2102
|
+
const oWord = orig[i];
|
|
2103
|
+
if (oWord === word)
|
|
2104
|
+
continue;
|
|
2105
|
+
const wordH = isCyrillic ? replaceG(word, ($0) => gobj[$0]) : word;
|
|
2106
|
+
if (oWord === wordH)
|
|
2107
|
+
continue;
|
|
2108
|
+
if (!/\(/.test(word)) {
|
|
2109
|
+
if (word.length === oWord.length) {
|
|
2110
|
+
const wordLetters = word.split("");
|
|
2111
|
+
for (let j = 0; j < wordLetters.length; j++) {
|
|
2112
|
+
if (wordH[j] !== oWord[j])
|
|
2113
|
+
wordLetters[j] = highlight(wordLetters[j]);
|
|
2114
|
+
}
|
|
2115
|
+
text[i] = wordLetters.join("");
|
|
2116
|
+
continue;
|
|
2117
|
+
}
|
|
2118
|
+
if (isCyrillic) {
|
|
2119
|
+
const word1 = word.replace(/ь/g, "");
|
|
2120
|
+
switch (oWord) {
|
|
2121
|
+
case word1:
|
|
2122
|
+
text[i] = word.replace(/ь/g, highlight("ь"));
|
|
2123
|
+
continue;
|
|
2124
|
+
case word1 + "ь":
|
|
2125
|
+
text[i] = word.slice(0, -1).replace(/ь/g, highlight("ь")) + "ь";
|
|
2126
|
+
continue;
|
|
2127
|
+
}
|
|
2128
|
+
}
|
|
2129
|
+
}
|
|
2130
|
+
const oWordEnd = oWord.length - 1;
|
|
2131
|
+
let fromStart = 0;
|
|
2132
|
+
let fromWordEnd = word.length - 1;
|
|
2133
|
+
let fromOWordEnd = oWordEnd;
|
|
2134
|
+
while (wordH[fromStart] === oWord[fromStart])
|
|
2135
|
+
++fromStart;
|
|
2136
|
+
while (wordH[fromWordEnd] === oWord[fromOWordEnd]) {
|
|
2137
|
+
--fromWordEnd;
|
|
2138
|
+
--fromOWordEnd;
|
|
2139
|
+
}
|
|
2140
|
+
if (oWord.length < word.length) {
|
|
2141
|
+
if (fromOWordEnd === oWordEnd) {
|
|
2142
|
+
text[i] = highlight(word);
|
|
2143
|
+
continue;
|
|
2144
|
+
}
|
|
2145
|
+
if (fromWordEnd < 0)
|
|
2146
|
+
fromWordEnd = 0;
|
|
2147
|
+
}
|
|
2148
|
+
if (fromStart === fromWordEnd + 1) {
|
|
2149
|
+
--fromStart;
|
|
2150
|
+
++fromWordEnd;
|
|
2151
|
+
}
|
|
2152
|
+
text[i] = word.slice(0, fromStart) + highlight(word.slice(fromStart, fromWordEnd + 1)) + word.slice(fromWordEnd + 1);
|
|
2153
|
+
}
|
|
2154
|
+
};
|
|
2107
2155
|
var replaceWithDict = (text, dict = []) => {
|
|
2108
2156
|
for (const [pattern, result] of dict)
|
|
2109
2157
|
text = text.replace(
|
|
@@ -2126,9 +2174,11 @@ var __tarask__ = {
|
|
|
2126
2174
|
};
|
|
2127
2175
|
var convertAlphabet = (text, abc) => replaceWithDict(replaceWithDict(text, letters[abc]), lettersUpperCase[abc]);
|
|
2128
2176
|
var Taraskevizer = class {
|
|
2129
|
-
|
|
2130
|
-
|
|
2131
|
-
|
|
2177
|
+
general = {
|
|
2178
|
+
abc: ALPHABET.CYRILLIC,
|
|
2179
|
+
j: REPLACE_J.NEVER,
|
|
2180
|
+
doEscapeCapitalized: true
|
|
2181
|
+
};
|
|
2132
2182
|
html = {
|
|
2133
2183
|
g: false
|
|
2134
2184
|
};
|
|
@@ -2140,34 +2190,21 @@ var Taraskevizer = class {
|
|
|
2140
2190
|
constructor(options) {
|
|
2141
2191
|
if (!options)
|
|
2142
2192
|
return;
|
|
2143
|
-
|
|
2144
|
-
if (general) {
|
|
2145
|
-
for (const prop of [
|
|
2146
|
-
"abc",
|
|
2147
|
-
"j",
|
|
2148
|
-
"doEscapeCapitalized"
|
|
2149
|
-
])
|
|
2150
|
-
if (prop in general)
|
|
2151
|
-
this[prop] = general[prop];
|
|
2152
|
-
}
|
|
2153
|
-
if (options.OVERRIDE_taraskevize)
|
|
2154
|
-
this.taraskevize = options.OVERRIDE_taraskevize;
|
|
2193
|
+
Object.assign(this.general, options.general);
|
|
2155
2194
|
Object.assign(this.html, options.html);
|
|
2156
2195
|
Object.assign(this.nonHtml, options.nonHtml);
|
|
2157
2196
|
}
|
|
2158
2197
|
convert(text) {
|
|
2159
2198
|
const wrapInColorOf = wrappers.ansiColors;
|
|
2199
|
+
const isCyrillic = this.general.abc === ALPHABET.CYRILLIC;
|
|
2160
2200
|
const noFixArr = [];
|
|
2161
|
-
|
|
2162
|
-
|
|
2163
|
-
|
|
2201
|
+
const { splitted, splittedOrig } = this.process(
|
|
2202
|
+
this.prepare(text, noFixArr, "<")
|
|
2203
|
+
);
|
|
2164
2204
|
if (this.nonHtml.ansiColors)
|
|
2165
|
-
|
|
2166
|
-
|
|
2167
|
-
|
|
2168
|
-
wrapInColorOf.fix
|
|
2169
|
-
);
|
|
2170
|
-
if (this.abc === ALPHABET.CYRILLIC && (this.nonHtml.h || this.nonHtml.ansiColors))
|
|
2205
|
+
highlightDiff(splitted, splittedOrig, isCyrillic, wrapInColorOf.fix);
|
|
2206
|
+
text = join(splitted);
|
|
2207
|
+
if (isCyrillic && (this.nonHtml.h || this.nonHtml.ansiColors))
|
|
2171
2208
|
text = replaceG(
|
|
2172
2209
|
text,
|
|
2173
2210
|
this.nonHtml.ansiColors ? this.nonHtml.h ? ($0) => wrapInColorOf.variable(gobj[$0]) : wrapInColorOf.variable("$&") : ($0) => gobj[$0]
|
|
@@ -2184,15 +2221,14 @@ var Taraskevizer = class {
|
|
|
2184
2221
|
}
|
|
2185
2222
|
convertToHtml(text) {
|
|
2186
2223
|
const wrapInTag = wrappers.html;
|
|
2224
|
+
const isCyrillic = this.general.abc === ALPHABET.CYRILLIC;
|
|
2187
2225
|
const noFixArr = [];
|
|
2188
|
-
|
|
2189
|
-
|
|
2190
|
-
text = highlightChanges(
|
|
2191
|
-
this.process(text, origInTargetAlphabet),
|
|
2192
|
-
afterJoin(origInTargetAlphabet),
|
|
2193
|
-
wrapInTag.fix
|
|
2226
|
+
const { splitted, splittedOrig } = this.process(
|
|
2227
|
+
this.prepare(text, noFixArr, "<")
|
|
2194
2228
|
);
|
|
2195
|
-
|
|
2229
|
+
highlightDiff(splitted, splittedOrig, isCyrillic, wrapInTag.fix);
|
|
2230
|
+
text = join(splitted);
|
|
2231
|
+
if (isCyrillic)
|
|
2196
2232
|
text = replaceG(
|
|
2197
2233
|
text,
|
|
2198
2234
|
this.html.g ? wrapInTag.letterH("$&") : ($0) => wrapInTag.letterH(gobj[$0])
|
|
@@ -2206,7 +2242,7 @@ var Taraskevizer = class {
|
|
|
2206
2242
|
"<br>"
|
|
2207
2243
|
);
|
|
2208
2244
|
}
|
|
2209
|
-
prepare(text, noFixArr, LEFT_ANGLE_BRACKET, doEscapeCapitalized = this.doEscapeCapitalized) {
|
|
2245
|
+
prepare(text, noFixArr, LEFT_ANGLE_BRACKET, doEscapeCapitalized = this.general.doEscapeCapitalized) {
|
|
2210
2246
|
text = ` ${text.trim()} `.replace(//g, "");
|
|
2211
2247
|
if (doEscapeCapitalized)
|
|
2212
2248
|
text = text.replace(
|
|
@@ -2218,7 +2254,7 @@ var Taraskevizer = class {
|
|
|
2218
2254
|
return LEFT_ANGLE_BRACKET + $3 + ">";
|
|
2219
2255
|
if ($1)
|
|
2220
2256
|
$3 = restoreCase(
|
|
2221
|
-
[replaceWithDict($3.toLowerCase(), letters[this.abc])],
|
|
2257
|
+
[replaceWithDict($3.toLowerCase(), letters[this.general.abc])],
|
|
2222
2258
|
[$3]
|
|
2223
2259
|
);
|
|
2224
2260
|
noFixArr.push($2 === "." ? $3 : LEFT_ANGLE_BRACKET + $3 + ">");
|
|
@@ -2230,14 +2266,17 @@ var Taraskevizer = class {
|
|
|
2230
2266
|
return finalize(
|
|
2231
2267
|
applyNoFix(
|
|
2232
2268
|
noFixArr,
|
|
2233
|
-
convertAlphabet(
|
|
2269
|
+
convertAlphabet(
|
|
2270
|
+
this.prepare(text, noFixArr, "<", false),
|
|
2271
|
+
this.general.abc
|
|
2272
|
+
)
|
|
2234
2273
|
).replace(/ /g, " ").replace(new RegExp(" (\\p{P}|\\p{S}|\\d|() ", "gu"), "$1"),
|
|
2235
2274
|
"\n"
|
|
2236
2275
|
);
|
|
2237
2276
|
}
|
|
2238
|
-
process(text
|
|
2239
|
-
const { abc, j } = this;
|
|
2240
|
-
const splittedOrig =
|
|
2277
|
+
process(text) {
|
|
2278
|
+
const { abc, j } = this.general;
|
|
2279
|
+
const splittedOrig = convertAlphabet(text, abc).split(" ");
|
|
2241
2280
|
text = this.taraskevize(text.toLowerCase());
|
|
2242
2281
|
if (j && abc !== ALPHABET.LATIN_JI)
|
|
2243
2282
|
text = replaceIbyJ(text, j === REPLACE_J.ALWAYS);
|
|
@@ -2245,7 +2284,7 @@ var Taraskevizer = class {
|
|
|
2245
2284
|
let splitted = text.split(" ");
|
|
2246
2285
|
if (abc !== ALPHABET.ARABIC)
|
|
2247
2286
|
splitted = restoreCase(splitted, splittedOrig);
|
|
2248
|
-
return
|
|
2287
|
+
return { splittedOrig, splitted };
|
|
2249
2288
|
}
|
|
2250
2289
|
taraskevize(text) {
|
|
2251
2290
|
text = replaceWithDict(text, wordlist);
|
package/dist/index.d.ts
CHANGED
|
@@ -47,9 +47,11 @@ declare const __tarask__: {
|
|
|
47
47
|
readonly afterTarask: ExtendedDict;
|
|
48
48
|
};
|
|
49
49
|
declare class Taraskevizer {
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
50
|
+
general: {
|
|
51
|
+
abc: Alphabet;
|
|
52
|
+
j: OptionJ;
|
|
53
|
+
doEscapeCapitalized: boolean;
|
|
54
|
+
};
|
|
53
55
|
html: {
|
|
54
56
|
g: boolean;
|
|
55
57
|
};
|
package/dist/index.js
CHANGED
|
@@ -1973,7 +1973,6 @@ for (const word of gwords)
|
|
|
1973
1973
|
wordlist.push([RegExp(word.replace(/ґ/g, "г"), "g"), word]);
|
|
1974
1974
|
|
|
1975
1975
|
// src/tarask.ts
|
|
1976
|
-
import { diffChars } from "diff";
|
|
1977
1976
|
var isUpperCase = (str) => str === str.toUpperCase();
|
|
1978
1977
|
var getLastLetter = (word, i) => {
|
|
1979
1978
|
for (let i2 = word.length - 1; i2 >= 0; i2--)
|
|
@@ -2066,13 +2065,62 @@ var restoreCase = (text, orig) => {
|
|
|
2066
2065
|
}
|
|
2067
2066
|
return text;
|
|
2068
2067
|
};
|
|
2069
|
-
var
|
|
2070
|
-
(
|
|
2071
|
-
|
|
2072
|
-
|
|
2073
|
-
|
|
2074
|
-
|
|
2075
|
-
|
|
2068
|
+
var highlightDiff = (text, orig, isCyrillic, highlight) => {
|
|
2069
|
+
for (let i = 0; i < text.length; i++) {
|
|
2070
|
+
const word = text[i];
|
|
2071
|
+
const oWord = orig[i];
|
|
2072
|
+
if (oWord === word)
|
|
2073
|
+
continue;
|
|
2074
|
+
const wordH = isCyrillic ? replaceG(word, ($0) => gobj[$0]) : word;
|
|
2075
|
+
if (oWord === wordH)
|
|
2076
|
+
continue;
|
|
2077
|
+
if (!/\(/.test(word)) {
|
|
2078
|
+
if (word.length === oWord.length) {
|
|
2079
|
+
const wordLetters = word.split("");
|
|
2080
|
+
for (let j = 0; j < wordLetters.length; j++) {
|
|
2081
|
+
if (wordH[j] !== oWord[j])
|
|
2082
|
+
wordLetters[j] = highlight(wordLetters[j]);
|
|
2083
|
+
}
|
|
2084
|
+
text[i] = wordLetters.join("");
|
|
2085
|
+
continue;
|
|
2086
|
+
}
|
|
2087
|
+
if (isCyrillic) {
|
|
2088
|
+
const word1 = word.replace(/ь/g, "");
|
|
2089
|
+
switch (oWord) {
|
|
2090
|
+
case word1:
|
|
2091
|
+
text[i] = word.replace(/ь/g, highlight("ь"));
|
|
2092
|
+
continue;
|
|
2093
|
+
case word1 + "ь":
|
|
2094
|
+
text[i] = word.slice(0, -1).replace(/ь/g, highlight("ь")) + "ь";
|
|
2095
|
+
continue;
|
|
2096
|
+
}
|
|
2097
|
+
}
|
|
2098
|
+
}
|
|
2099
|
+
const oWordEnd = oWord.length - 1;
|
|
2100
|
+
let fromStart = 0;
|
|
2101
|
+
let fromWordEnd = word.length - 1;
|
|
2102
|
+
let fromOWordEnd = oWordEnd;
|
|
2103
|
+
while (wordH[fromStart] === oWord[fromStart])
|
|
2104
|
+
++fromStart;
|
|
2105
|
+
while (wordH[fromWordEnd] === oWord[fromOWordEnd]) {
|
|
2106
|
+
--fromWordEnd;
|
|
2107
|
+
--fromOWordEnd;
|
|
2108
|
+
}
|
|
2109
|
+
if (oWord.length < word.length) {
|
|
2110
|
+
if (fromOWordEnd === oWordEnd) {
|
|
2111
|
+
text[i] = highlight(word);
|
|
2112
|
+
continue;
|
|
2113
|
+
}
|
|
2114
|
+
if (fromWordEnd < 0)
|
|
2115
|
+
fromWordEnd = 0;
|
|
2116
|
+
}
|
|
2117
|
+
if (fromStart === fromWordEnd + 1) {
|
|
2118
|
+
--fromStart;
|
|
2119
|
+
++fromWordEnd;
|
|
2120
|
+
}
|
|
2121
|
+
text[i] = word.slice(0, fromStart) + highlight(word.slice(fromStart, fromWordEnd + 1)) + word.slice(fromWordEnd + 1);
|
|
2122
|
+
}
|
|
2123
|
+
};
|
|
2076
2124
|
var replaceWithDict = (text, dict = []) => {
|
|
2077
2125
|
for (const [pattern, result] of dict)
|
|
2078
2126
|
text = text.replace(
|
|
@@ -2095,9 +2143,11 @@ var __tarask__ = {
|
|
|
2095
2143
|
};
|
|
2096
2144
|
var convertAlphabet = (text, abc) => replaceWithDict(replaceWithDict(text, letters[abc]), lettersUpperCase[abc]);
|
|
2097
2145
|
var Taraskevizer = class {
|
|
2098
|
-
|
|
2099
|
-
|
|
2100
|
-
|
|
2146
|
+
general = {
|
|
2147
|
+
abc: ALPHABET.CYRILLIC,
|
|
2148
|
+
j: REPLACE_J.NEVER,
|
|
2149
|
+
doEscapeCapitalized: true
|
|
2150
|
+
};
|
|
2101
2151
|
html = {
|
|
2102
2152
|
g: false
|
|
2103
2153
|
};
|
|
@@ -2109,34 +2159,21 @@ var Taraskevizer = class {
|
|
|
2109
2159
|
constructor(options) {
|
|
2110
2160
|
if (!options)
|
|
2111
2161
|
return;
|
|
2112
|
-
|
|
2113
|
-
if (general) {
|
|
2114
|
-
for (const prop of [
|
|
2115
|
-
"abc",
|
|
2116
|
-
"j",
|
|
2117
|
-
"doEscapeCapitalized"
|
|
2118
|
-
])
|
|
2119
|
-
if (prop in general)
|
|
2120
|
-
this[prop] = general[prop];
|
|
2121
|
-
}
|
|
2122
|
-
if (options.OVERRIDE_taraskevize)
|
|
2123
|
-
this.taraskevize = options.OVERRIDE_taraskevize;
|
|
2162
|
+
Object.assign(this.general, options.general);
|
|
2124
2163
|
Object.assign(this.html, options.html);
|
|
2125
2164
|
Object.assign(this.nonHtml, options.nonHtml);
|
|
2126
2165
|
}
|
|
2127
2166
|
convert(text) {
|
|
2128
2167
|
const wrapInColorOf = wrappers.ansiColors;
|
|
2168
|
+
const isCyrillic = this.general.abc === ALPHABET.CYRILLIC;
|
|
2129
2169
|
const noFixArr = [];
|
|
2130
|
-
|
|
2131
|
-
|
|
2132
|
-
|
|
2170
|
+
const { splitted, splittedOrig } = this.process(
|
|
2171
|
+
this.prepare(text, noFixArr, "<")
|
|
2172
|
+
);
|
|
2133
2173
|
if (this.nonHtml.ansiColors)
|
|
2134
|
-
|
|
2135
|
-
|
|
2136
|
-
|
|
2137
|
-
wrapInColorOf.fix
|
|
2138
|
-
);
|
|
2139
|
-
if (this.abc === ALPHABET.CYRILLIC && (this.nonHtml.h || this.nonHtml.ansiColors))
|
|
2174
|
+
highlightDiff(splitted, splittedOrig, isCyrillic, wrapInColorOf.fix);
|
|
2175
|
+
text = join(splitted);
|
|
2176
|
+
if (isCyrillic && (this.nonHtml.h || this.nonHtml.ansiColors))
|
|
2140
2177
|
text = replaceG(
|
|
2141
2178
|
text,
|
|
2142
2179
|
this.nonHtml.ansiColors ? this.nonHtml.h ? ($0) => wrapInColorOf.variable(gobj[$0]) : wrapInColorOf.variable("$&") : ($0) => gobj[$0]
|
|
@@ -2153,15 +2190,14 @@ var Taraskevizer = class {
|
|
|
2153
2190
|
}
|
|
2154
2191
|
convertToHtml(text) {
|
|
2155
2192
|
const wrapInTag = wrappers.html;
|
|
2193
|
+
const isCyrillic = this.general.abc === ALPHABET.CYRILLIC;
|
|
2156
2194
|
const noFixArr = [];
|
|
2157
|
-
|
|
2158
|
-
|
|
2159
|
-
text = highlightChanges(
|
|
2160
|
-
this.process(text, origInTargetAlphabet),
|
|
2161
|
-
afterJoin(origInTargetAlphabet),
|
|
2162
|
-
wrapInTag.fix
|
|
2195
|
+
const { splitted, splittedOrig } = this.process(
|
|
2196
|
+
this.prepare(text, noFixArr, "<")
|
|
2163
2197
|
);
|
|
2164
|
-
|
|
2198
|
+
highlightDiff(splitted, splittedOrig, isCyrillic, wrapInTag.fix);
|
|
2199
|
+
text = join(splitted);
|
|
2200
|
+
if (isCyrillic)
|
|
2165
2201
|
text = replaceG(
|
|
2166
2202
|
text,
|
|
2167
2203
|
this.html.g ? wrapInTag.letterH("$&") : ($0) => wrapInTag.letterH(gobj[$0])
|
|
@@ -2175,7 +2211,7 @@ var Taraskevizer = class {
|
|
|
2175
2211
|
"<br>"
|
|
2176
2212
|
);
|
|
2177
2213
|
}
|
|
2178
|
-
prepare(text, noFixArr, LEFT_ANGLE_BRACKET, doEscapeCapitalized = this.doEscapeCapitalized) {
|
|
2214
|
+
prepare(text, noFixArr, LEFT_ANGLE_BRACKET, doEscapeCapitalized = this.general.doEscapeCapitalized) {
|
|
2179
2215
|
text = ` ${text.trim()} `.replace(//g, "");
|
|
2180
2216
|
if (doEscapeCapitalized)
|
|
2181
2217
|
text = text.replace(
|
|
@@ -2187,7 +2223,7 @@ var Taraskevizer = class {
|
|
|
2187
2223
|
return LEFT_ANGLE_BRACKET + $3 + ">";
|
|
2188
2224
|
if ($1)
|
|
2189
2225
|
$3 = restoreCase(
|
|
2190
|
-
[replaceWithDict($3.toLowerCase(), letters[this.abc])],
|
|
2226
|
+
[replaceWithDict($3.toLowerCase(), letters[this.general.abc])],
|
|
2191
2227
|
[$3]
|
|
2192
2228
|
);
|
|
2193
2229
|
noFixArr.push($2 === "." ? $3 : LEFT_ANGLE_BRACKET + $3 + ">");
|
|
@@ -2199,14 +2235,17 @@ var Taraskevizer = class {
|
|
|
2199
2235
|
return finalize(
|
|
2200
2236
|
applyNoFix(
|
|
2201
2237
|
noFixArr,
|
|
2202
|
-
convertAlphabet(
|
|
2238
|
+
convertAlphabet(
|
|
2239
|
+
this.prepare(text, noFixArr, "<", false),
|
|
2240
|
+
this.general.abc
|
|
2241
|
+
)
|
|
2203
2242
|
).replace(/ /g, " ").replace(new RegExp(" (\\p{P}|\\p{S}|\\d|() ", "gu"), "$1"),
|
|
2204
2243
|
"\n"
|
|
2205
2244
|
);
|
|
2206
2245
|
}
|
|
2207
|
-
process(text
|
|
2208
|
-
const { abc, j } = this;
|
|
2209
|
-
const splittedOrig =
|
|
2246
|
+
process(text) {
|
|
2247
|
+
const { abc, j } = this.general;
|
|
2248
|
+
const splittedOrig = convertAlphabet(text, abc).split(" ");
|
|
2210
2249
|
text = this.taraskevize(text.toLowerCase());
|
|
2211
2250
|
if (j && abc !== ALPHABET.LATIN_JI)
|
|
2212
2251
|
text = replaceIbyJ(text, j === REPLACE_J.ALWAYS);
|
|
@@ -2214,7 +2253,7 @@ var Taraskevizer = class {
|
|
|
2214
2253
|
let splitted = text.split(" ");
|
|
2215
2254
|
if (abc !== ALPHABET.ARABIC)
|
|
2216
2255
|
splitted = restoreCase(splitted, splittedOrig);
|
|
2217
|
-
return
|
|
2256
|
+
return { splittedOrig, splitted };
|
|
2218
2257
|
}
|
|
2219
2258
|
taraskevize(text) {
|
|
2220
2259
|
text = replaceWithDict(text, wordlist);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "taraskevizer",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "6.0.0",
|
|
4
4
|
"author": "GooseOb",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -8,9 +8,6 @@
|
|
|
8
8
|
},
|
|
9
9
|
"main": "dist/index.js",
|
|
10
10
|
"module": "dist/index.js",
|
|
11
|
-
"dependencies": {
|
|
12
|
-
"diff": "^5.2.0"
|
|
13
|
-
},
|
|
14
11
|
"devDependencies": {
|
|
15
12
|
"@digitak/esrun": "^3.2.26",
|
|
16
13
|
"@types/diff": "^5.2.0",
|