execonvert 0.5.5 → 0.5.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/CHANGELOG.md CHANGED
@@ -9,6 +9,21 @@ Categorías usadas: **Añadido**, **Cambiado**, **Corregido**, **Eliminado**.
9
9
 
10
10
  ## [Unreleased]
11
11
 
12
+ ## [0.5.6] - 2026-09-05
13
+
14
+ ### Corregido
15
+ - La prima de las derivadas se anidaba un nivel en cada conversión de ida y
16
+ vuelta: `f^{'}` se convertía en `f^{^{'}}`, y repitiendo el ciclo seguía
17
+ acumulando capas. La causa es que temml escribe la prima como un superíndice
18
+ sobre una base vacía, que al volver de MathML se traducía literalmente. Solo
19
+ se colapsa esa forma: un superíndice doble real, que sí tiene base, no se
20
+ toca.
21
+ - Las dependencias del repositorio estaban ancladas a versiones anteriores a
22
+ las que instalaba cualquier usuario del paquete (`mathml-to-latex` 1.5.0
23
+ frente a 1.8.0), de modo que las pruebas no ejercitaban el mismo código que
24
+ se ejecuta al usarlo. Con ambas al día, un proyecto con 22 fórmulas
25
+ sobrevive tres ciclos `.elpx → .docx → .elpx` sin una sola diferencia.
26
+
12
27
  ## [0.5.5] - 2026-09-05
13
28
 
14
29
  ### Añadido
@@ -11,9 +11,9 @@ import { convertMarkdownToElpx } from '../src/markdown-import.js';
11
11
  import { installCliRuntime } from './runtime.js';
12
12
  import { EXE_RUNTIME_VERSION, isNewerThanRuntime } from '../src/exe-runtime.js';
13
13
  import { automaticCheck, autoCheckAllowed, runUpdate, updateText } from './updates.js';
14
- const CLI_VERSION = '0.5.5'.startsWith('__')
14
+ const CLI_VERSION = '0.5.6'.startsWith('__')
15
15
  ? String(JSON.parse(await readFile(new URL('../package.json', import.meta.url), 'utf8')).version)
16
- : '0.5.5';
16
+ : '0.5.6';
17
17
  const cliMessages = {
18
18
  es: {
19
19
  'help.title': 'CLI de eXeConvert',
@@ -1016,6 +1016,10 @@ function stripHtmlFromMath(value) {
1016
1016
  const document = new DOMParser().parseFromString(`<!doctype html><html><body>${withLineBreaks}</body></html>`, 'text/html');
1017
1017
  return document.body.textContent || '';
1018
1018
  }
1019
+ /** Exposed for tests: the LaTeX normalisation applied to every converted formula. */
1020
+ export function normalizeLatexForTests(value) {
1021
+ return normalizeLatexValue(value);
1022
+ }
1019
1023
  function normalizeLatexValue(value) {
1020
1024
  let output = value.normalize('NFC').replace(/\u00a0/g, ' ').replace(/\r/g, '');
1021
1025
  output = output.replace(/[\uFFFD\uFEFF\u00AD\u2066-\u2069\u200B-\u200F\u202A-\u202E\uFFF9-\uFFFB]/g, '');
@@ -1028,6 +1032,11 @@ function normalizeLatexValue(value) {
1028
1032
  output = output.replace(/(^|[^\\])\.{2}\s+\\\\/g, '$1\\ldots ');
1029
1033
  output = output.replace(/\\\\backslash\b/g, '\\\\');
1030
1034
  output = output.replace(/\\backslash\b/g, '\\\\');
1035
+ // temml writes a prime as a superscript with an empty base, so a round trip
1036
+ // through MathML turns f^{'} into f^{^{'}} and nests one level deeper every
1037
+ // time. Only the empty-base form is collapsed: a real double superscript
1038
+ // carries a base and is left alone.
1039
+ output = output.replace(/\^\{\s*\^\{\s*([\u2032\u2033\u2034'`]+)\s*\}\s*\}/g, "^{$1}");
1031
1040
  output = output.replace(/[ \t]+/g, ' ');
1032
1041
  output = output.replace(/ ?\n ?/g, '\n');
1033
1042
  output = output.trim();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "execonvert",
3
- "version": "0.5.5",
3
+ "version": "0.5.6",
4
4
  "private": false,
5
5
  "repository": {
6
6
  "type": "git",
@@ -41,7 +41,8 @@
41
41
  "test:cli": "node --test tests/cli-update.test.mjs",
42
42
  "test:docx": "node --test tests/docx-omml.test.mjs",
43
43
  "test:args": "node --test tests/cli-args.test.mjs",
44
- "test:version": "node --import tsx --test tests/runtime-version.test.mjs"
44
+ "test:version": "node --import tsx --test tests/runtime-version.test.mjs",
45
+ "test:primes": "node --import tsx --test tests/latex-primes.test.mjs"
45
46
  },
46
47
  "dependencies": {
47
48
  "@resvg/resvg-js": "^2.6.2",