taraskevizer 10.1.4 → 10.1.6

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 CHANGED
@@ -7,7 +7,7 @@ process.argv.splice(0, 2);
7
7
  const firstArg = process.argv[0];
8
8
  if (firstArg) {
9
9
  if (firstArg === '-v' || firstArg === '--version') {
10
- printWithPrefix("10.1.4");
10
+ printWithPrefix("10.1.6");
11
11
  process.exit(0);
12
12
  }
13
13
  if (firstArg === '-h' || firstArg === '--help') {
package/dist/config.d.ts CHANGED
@@ -77,6 +77,14 @@ export declare class TaraskConfig {
77
77
  * @example "<"
78
78
  */
79
79
  leftAngleBracket: string;
80
+ /**
81
+ * Placeholder for parts that should not be fixed like those enclosed in `< >`.
82
+ *
83
+ * > Not recommended to change.
84
+ *
85
+ * @default " \ue0fe "
86
+ */
87
+ noFixPlaceholder: string;
80
88
  }
81
89
  /**
82
90
  * Predefined configuration for HTML.
package/dist/config.js CHANGED
@@ -24,6 +24,8 @@ export class TaraskConfig {
24
24
  newLine = '\n';
25
25
 
26
26
  leftAngleBracket = '<';
27
+
28
+ noFixPlaceholder = ' \ue0fe ';
27
29
  }
28
30
 
29
31
  export const htmlConfigOptions = {
@@ -9,5 +9,5 @@ export const phonetic = callableDict([
9
9
  [/сш/g, 'шш'],
10
10
  [/[зс]ч/g, 'шч'],
11
11
  [/чц(?![ьіеюя])/g, 'цц'],
12
- [/[жш]ц(?=ы )/g, 'сц'],
12
+ [/[жш]ц(?=[ауы] |а[хўйм] |амі )/g, 'сц'],
13
13
  ].concat(commonPhonetic));
@@ -1,9 +1,9 @@
1
1
  import type { TaraskStep } from '@/steps/types';
2
2
  /**
3
- * An abstraction for a step that always changes the text.
3
+ * Utility function for a step that always modifies the text
4
4
  *
5
5
  * > Not recommended to use if
6
- * a step doesn't ALWAYS change the text.
6
+ * a step doesn't ALWAYS modify the text.
7
7
  *
8
8
  * @example
9
9
  * type TextWrapperStorage = { wrapText: (text: string) => string };
@@ -15,7 +15,7 @@ export type SpecialSyntaxStorage = {
15
15
  export declare const applyNoFix: TaraskStep<SpecialSyntaxStorage>;
16
16
  /**
17
17
  * Captures noFix parts and stores them in {@link SpecialSyntaxStorage.noFixArr}.
18
- * Places a special character `" \ue0fe "` in their place.
18
+ * Places a {@link TaraskConfig.noFixPlaceholder} in their place.
19
19
  *
20
20
  * Use {@link applyNoFix} to bring the parts back to the text.
21
21
  *
@@ -1,22 +1,20 @@
1
1
  import { restoreCase, mutatingStep } from '../lib/index.js';
2
- const NOFIX_CHAR = ' \ue0fe ';
3
- const NOFIX_REGEX = new RegExp(NOFIX_CHAR, 'g');
4
2
 
5
3
  export const applyNoFix = (ctx) => {
6
4
  const { noFixArr } = ctx.storage;
7
5
  if (noFixArr.length) {
8
6
  noFixArr.reverse();
9
- ctx.text = ctx.text.replace(NOFIX_REGEX, () => noFixArr.pop());
7
+ ctx.text = ctx.text.replaceAll(ctx.cfg.noFixPlaceholder, () => noFixArr.pop());
10
8
  }
11
9
  };
12
10
 
13
- export const resolveSpecialSyntax = mutatingStep(({ text, storage, cfg: { doEscapeCapitalized, abc, leftAngleBracket } }) => {
11
+ export const resolveSpecialSyntax = mutatingStep(({ text, storage, cfg: { doEscapeCapitalized, abc, leftAngleBracket, noFixPlaceholder }, }) => {
14
12
  const noFixArr = (storage.noFixArr = []);
15
13
  const convertAlphavet = (abcOnlyText, abc) => restoreCase(abc.lower(abcOnlyText.toLowerCase()).split(' '), abcOnlyText.split(' ')).join(' ');
16
14
  const escapeCapsIfNeeded = (text) => doEscapeCapitalized
17
15
  ? text.replace(/(?!<=\p{Lu} )\p{Lu}{2}[\p{Lu} ]*(?!= \p{Lu})/gu, ($0) => {
18
16
  noFixArr.push(convertAlphavet($0, abc));
19
- return NOFIX_CHAR;
17
+ return noFixPlaceholder;
20
18
  })
21
19
  : text;
22
20
  const parts = text.split(/(?=[<>])/g);
@@ -49,14 +47,14 @@ export const resolveSpecialSyntax = mutatingStep(({ text, storage, cfg: { doEsca
49
47
  let toAddToResult;
50
48
  switch (char) {
51
49
  case '.':
52
- toAddToResult = NOFIX_CHAR;
50
+ toAddToResult = noFixPlaceholder;
53
51
  noFixArr.push(currentPart);
54
52
  break;
55
53
  case ',':
56
54
  toAddToResult = leftAngleBracket + currentPart + '>';
57
55
  break;
58
56
  default:
59
- toAddToResult = leftAngleBracket + NOFIX_CHAR;
57
+ toAddToResult = leftAngleBracket + noFixPlaceholder;
60
58
  noFixArr.push((isAbc ? '' : char) + currentPart + '>');
61
59
  }
62
60
  result += toAddToResult + escapeCapsIfNeeded(part.slice(1));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "taraskevizer",
3
- "version": "10.1.4",
3
+ "version": "10.1.6",
4
4
  "author": "GooseOb",
5
5
  "repository": {
6
6
  "type": "git",