@haklex/rich-litexml-cli 0.15.5 → 0.15.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.
Files changed (2) hide show
  1. package/dist/cli.mjs +24 -11
  2. package/package.json +4 -4
package/dist/cli.mjs CHANGED
@@ -22386,16 +22386,24 @@ function createReaderContext(registry) {
22386
22386
  parseChildren(element) {
22387
22387
  const blockLevel = isBlockContainer(element);
22388
22388
  const nodes = [];
22389
- for (const child of element.childNodes) if (child.nodeType === 3) {
22390
- const text = child.textContent ?? "";
22391
- if (blockLevel && text.trim() === "") continue;
22392
- if (text === "") continue;
22393
- nodes.push(makeTextNode(text, 0));
22394
- } else if (child.nodeType === 1) {
22389
+ let pendingText = "";
22390
+ const flushText = () => {
22391
+ if (pendingText === "") return;
22392
+ if (blockLevel && pendingText.trim() === "") {
22393
+ pendingText = "";
22394
+ return;
22395
+ }
22396
+ nodes.push(makeTextNode(pendingText, 0));
22397
+ pendingText = "";
22398
+ };
22399
+ for (const child of element.childNodes) if (child.nodeType === 3) pendingText += child.textContent ?? "";
22400
+ else if (child.nodeType === 1) {
22401
+ flushText();
22395
22402
  const parsed = parseElement(child, registry, ctx, 0);
22396
22403
  if (parsed) if (Array.isArray(parsed)) nodes.push(...parsed);
22397
22404
  else nodes.push(parsed);
22398
22405
  }
22406
+ flushText();
22399
22407
  return nodes;
22400
22408
  },
22401
22409
  parseNestedState(xml) {
@@ -22421,15 +22429,20 @@ function parseElement(element, registry, ctx, inheritedFormat) {
22421
22429
  }
22422
22430
  function parseInlineChildren(element, registry, ctx, format) {
22423
22431
  const nodes = [];
22424
- for (const child of element.childNodes) if (child.nodeType === 3) {
22425
- const text = child.textContent ?? "";
22426
- if (text === "") continue;
22427
- nodes.push(makeTextNode(text, format));
22428
- } else if (child.nodeType === 1) {
22432
+ let pendingText = "";
22433
+ const flushText = () => {
22434
+ if (pendingText === "") return;
22435
+ nodes.push(makeTextNode(pendingText, format));
22436
+ pendingText = "";
22437
+ };
22438
+ for (const child of element.childNodes) if (child.nodeType === 3) pendingText += child.textContent ?? "";
22439
+ else if (child.nodeType === 1) {
22440
+ flushText();
22429
22441
  const parsed = parseElement(child, registry, ctx, format);
22430
22442
  if (parsed) if (Array.isArray(parsed)) nodes.push(...parsed);
22431
22443
  else nodes.push(parsed);
22432
22444
  }
22445
+ flushText();
22433
22446
  return nodes;
22434
22447
  }
22435
22448
  function parseFallbackNode(element) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@haklex/rich-litexml-cli",
3
- "version": "0.15.5",
3
+ "version": "0.15.6",
4
4
  "description": "Unified CLI for haklex LiteXML: convert LiteXML or Lexical JSON to HTML, JSON, or Markdown.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -18,9 +18,9 @@
18
18
  "dependencies": {
19
19
  "@lexical/headless": "^0.44.0",
20
20
  "lexical": "^0.44.0",
21
- "@haklex/rich-litexml": "0.15.5",
22
- "@haklex/rich-compose": "0.15.5",
23
- "@haklex/rich-headless": "0.15.5"
21
+ "@haklex/rich-compose": "0.15.6",
22
+ "@haklex/rich-litexml": "0.15.6",
23
+ "@haklex/rich-headless": "0.15.6"
24
24
  },
25
25
  "devDependencies": {
26
26
  "@types/node": "25.6.0",