taraskevizer 1.4.0 → 1.4.2

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/index.cjs CHANGED
@@ -2085,6 +2085,11 @@ for (const word of gwords)
2085
2085
 
2086
2086
  // src/tarask.ts
2087
2087
  var isUpperCase = (str) => str === str.toUpperCase();
2088
+ var getLastLetter = (word) => {
2089
+ for (let i = word.length - 1; i > 0; i--)
2090
+ if (/\p{L}/u.test(word[i]))
2091
+ return word[i];
2092
+ };
2088
2093
  var NOFIX_CHAR = " ￿ ";
2089
2094
  var NOFIX_REGEX = new RegExp(NOFIX_CHAR, "g");
2090
2095
  var OPTIONAL_WORDS_REGEX = /\(.*?\)/g;
@@ -2132,7 +2137,7 @@ var taraskSync = (text, options) => {
2132
2137
  const apply = html ? tagApplications.html : tagApplications.nonHtml;
2133
2138
  const noFix = [];
2134
2139
  const LEFT_ANGLE_BRACKET = html ? "&lt;" : "<";
2135
- text = ` ${text.trim()} `.replace(/<([,.]?)((?:.|\s)*?)>/g, ($0, $1, $2) => {
2140
+ text = ` ${text.trim()} `.replace(/�/g, "").replace(/<([,.]?)((?:.|\s)*?)>/g, ($0, $1, $2) => {
2136
2141
  if ($1 === ",")
2137
2142
  return LEFT_ANGLE_BRACKET + $2 + ">";
2138
2143
  noFix[noFix.length] = $1 === "." ? $2 : $0;
@@ -2190,7 +2195,7 @@ function restoreCase(text, orig) {
2190
2195
  continue;
2191
2196
  if (word === "зь") {
2192
2197
  text[i] = isUpperCase(orig[i + 1]) ? "ЗЬ" : "Зь";
2193
- } else if (isUpperCase(oWord[oWord.length - 1])) {
2198
+ } else if (isUpperCase(getLastLetter(oWord))) {
2194
2199
  text[i] = word.toUpperCase();
2195
2200
  } else {
2196
2201
  text[i] = word[0] === "(" ? word.replace(
package/dist/index.js CHANGED
@@ -2055,6 +2055,11 @@ for (const word of gwords)
2055
2055
 
2056
2056
  // src/tarask.ts
2057
2057
  var isUpperCase = (str) => str === str.toUpperCase();
2058
+ var getLastLetter = (word) => {
2059
+ for (let i = word.length - 1; i > 0; i--)
2060
+ if (/\p{L}/u.test(word[i]))
2061
+ return word[i];
2062
+ };
2058
2063
  var NOFIX_CHAR = " ￿ ";
2059
2064
  var NOFIX_REGEX = new RegExp(NOFIX_CHAR, "g");
2060
2065
  var OPTIONAL_WORDS_REGEX = /\(.*?\)/g;
@@ -2102,7 +2107,7 @@ var taraskSync = (text, options) => {
2102
2107
  const apply = html ? tagApplications.html : tagApplications.nonHtml;
2103
2108
  const noFix = [];
2104
2109
  const LEFT_ANGLE_BRACKET = html ? "&lt;" : "<";
2105
- text = ` ${text.trim()} `.replace(/<([,.]?)((?:.|\s)*?)>/g, ($0, $1, $2) => {
2110
+ text = ` ${text.trim()} `.replace(/�/g, "").replace(/<([,.]?)((?:.|\s)*?)>/g, ($0, $1, $2) => {
2106
2111
  if ($1 === ",")
2107
2112
  return LEFT_ANGLE_BRACKET + $2 + ">";
2108
2113
  noFix[noFix.length] = $1 === "." ? $2 : $0;
@@ -2160,7 +2165,7 @@ function restoreCase(text, orig) {
2160
2165
  continue;
2161
2166
  if (word === "зь") {
2162
2167
  text[i] = isUpperCase(orig[i + 1]) ? "ЗЬ" : "Зь";
2163
- } else if (isUpperCase(oWord[oWord.length - 1])) {
2168
+ } else if (isUpperCase(getLastLetter(oWord))) {
2164
2169
  text[i] = word.toUpperCase();
2165
2170
  } else {
2166
2171
  text[i] = word[0] === "(" ? word.replace(
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "taraskevizer",
3
3
  "author": "GooseOb",
4
4
  "license": "MIT",
5
- "version": "1.4.0",
5
+ "version": "1.4.2",
6
6
  "private": false,
7
7
  "homepage": "https://gooseob.github.io/taraskevizatar/",
8
8
  "main": "dist/index.js",