@latex-kit/escape 0.2.0 → 0.3.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 CHANGED
@@ -58,6 +58,7 @@ missing value can never print as the word "undefined".
58
58
  | `^` `~` | `\textasciicircum{}` `\textasciitilde{}` |
59
59
  | `<` `>` `\|` | `\textless{}` `\textgreater{}` `\textbar{}` |
60
60
  | `[` `]` | `{[}` `{]}`, so they are never read as an optional argument |
61
+ | no-break space U+00A0, narrow U+202F | `~`, `\,` (TeX's own spacing; many fonts lack U+202F) |
61
62
  | `--`, `---` | `-\kern0pt-`, `-\kern0pt-\kern0pt-`: literal hyphens, not dashes, in every engine |
62
63
 
63
64
  Unicode passes through unchanged. Output assumes LuaLaTeX or XeLaTeX, or
package/esm/index.js CHANGED
@@ -30,11 +30,15 @@ const SPECIALS = {
30
30
  // an argument; grouping it makes it plain text everywhere
31
31
  '[': '{[}',
32
32
  ']': '{]}',
33
+ // Intl number and currency formats use these; many fonts lack U+202F, so
34
+ // use TeX's own non-breaking spaces instead of trusting the glyph
35
+ '\u00A0': '~',
36
+ '\u202F': '\\,',
33
37
  };
34
38
  // `-(?=-)` splits the -- and --- ligatures so "A--B" stays two hyphens. An
35
39
  // empty group (`-{}-`) is not enough under LuaLaTeX, where the font's TeX
36
40
  // ligatures still join the hyphens; a zero kern stops them in every engine.
37
- const SPECIAL_RE = /[\\{}$&#%_^~<>|[\]]|-(?=-)/g;
41
+ const SPECIAL_RE = /[\\{}$&#%_^~<>|[\]\u00A0\u202F]|-(?=-)/g;
38
42
  const CONTROL_CHARS = '[\\u0000-\\u0008\\u000B\\u000C\\u000E-\\u001F\\u007F]';
39
43
  const CONTROL_ONE = new RegExp(CONTROL_CHARS);
40
44
  const CONTROL_ALL = new RegExp(CONTROL_CHARS, 'g');
package/index.js CHANGED
@@ -37,11 +37,15 @@ const SPECIALS = {
37
37
  // an argument; grouping it makes it plain text everywhere
38
38
  '[': '{[}',
39
39
  ']': '{]}',
40
+ // Intl number and currency formats use these; many fonts lack U+202F, so
41
+ // use TeX's own non-breaking spaces instead of trusting the glyph
42
+ '\u00A0': '~',
43
+ '\u202F': '\\,',
40
44
  };
41
45
  // `-(?=-)` splits the -- and --- ligatures so "A--B" stays two hyphens. An
42
46
  // empty group (`-{}-`) is not enough under LuaLaTeX, where the font's TeX
43
47
  // ligatures still join the hyphens; a zero kern stops them in every engine.
44
- const SPECIAL_RE = /[\\{}$&#%_^~<>|[\]]|-(?=-)/g;
48
+ const SPECIAL_RE = /[\\{}$&#%_^~<>|[\]\u00A0\u202F]|-(?=-)/g;
45
49
  const CONTROL_CHARS = '[\\u0000-\\u0008\\u000B\\u000C\\u000E-\\u001F\\u007F]';
46
50
  const CONTROL_ONE = new RegExp(CONTROL_CHARS);
47
51
  const CONTROL_ALL = new RegExp(CONTROL_CHARS, 'g');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@latex-kit/escape",
3
- "version": "0.2.0",
3
+ "version": "0.3.0",
4
4
  "description": "Escape strings for safe interpolation into LaTeX documents",
5
5
  "author": "Constructive <developers@constructive.io>",
6
6
  "main": "index.js",
@@ -39,5 +39,5 @@
39
39
  "sanitize",
40
40
  "template"
41
41
  ],
42
- "gitHead": "b88becdf229a9f5689fcc3b8ff087f718e04f216"
42
+ "gitHead": "0da7d546606627d73d38647b02b29cd4df4addd4"
43
43
  }