@ai-matrx/content-ir 0.19.2 → 0.19.3
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 +20 -0
- package/dist/index.cjs +28 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +28 -1
- package/dist/index.js.map +1 -1
- package/dist/source.cjs +28 -1
- package/dist/source.cjs.map +1 -1
- package/dist/source.js +28 -1
- package/dist/source.js.map +1 -1
- package/package.json +1 -1
package/dist/source.js
CHANGED
|
@@ -745,6 +745,7 @@ var IDENTIFIER = /^[A-Za-z_][A-Za-z0-9_]*$/;
|
|
|
745
745
|
var MATH_SUFFIX = /^(?:s|es|th|st|nd|rd)$/i;
|
|
746
746
|
function isVariableChain(content, after) {
|
|
747
747
|
if (/^\{[A-Za-z_][\w.]*\}$/.test(content)) return true;
|
|
748
|
+
if (/^\(\(.*\)\)$/.test(content) || /^_[.[]/.test(content)) return true;
|
|
748
749
|
if (!after) return false;
|
|
749
750
|
if (after[0] === "{") return IDENTIFIER.test(content);
|
|
750
751
|
const run = /^[A-Za-z0-9_]+/.exec(after)?.[0];
|
|
@@ -1316,6 +1317,16 @@ var Tokenizer = class {
|
|
|
1316
1317
|
holdUndecidedTail() {
|
|
1317
1318
|
const last = this.lineStarts.length - 1;
|
|
1318
1319
|
if (last < 0) return;
|
|
1320
|
+
if (this.provisionalFrom < this.n) {
|
|
1321
|
+
for (let b = 0; b < this.blocks.length; b++) {
|
|
1322
|
+
const block = this.blocks[b];
|
|
1323
|
+
if (block.end <= this.provisionalFrom) continue;
|
|
1324
|
+
if (block.kind === "prose") block.inlines = block.inlines.filter((inline) => inline.end <= this.provisionalFrom);
|
|
1325
|
+
else if (block.island?.fromParagraph && block.start < this.provisionalFrom) {
|
|
1326
|
+
this.blocks[b] = { kind: "prose", start: block.start, end: block.end, island: null, inlines: [] };
|
|
1327
|
+
}
|
|
1328
|
+
}
|
|
1329
|
+
}
|
|
1319
1330
|
if (this.isOpenTail(last)) {
|
|
1320
1331
|
let b = this.blocks.length - 1;
|
|
1321
1332
|
while (b >= 0 && this.blocks[b].kind === "gap") b--;
|
|
@@ -1613,6 +1624,9 @@ var Tokenizer = class {
|
|
|
1613
1624
|
}
|
|
1614
1625
|
if (this.isOpenTail(k)) return this.heldFootnote(p, open[1]);
|
|
1615
1626
|
if (FOOTNOTE_DEF.test(line.trimStart())) break;
|
|
1627
|
+
if (this.streaming && TREE_GLYPHS.test(line) && this.connectorRunReachesEnd(k)) {
|
|
1628
|
+
return this.heldFootnote(p, open[1]);
|
|
1629
|
+
}
|
|
1616
1630
|
const block = this.detectBlock(this.lineStarts[k], k, false);
|
|
1617
1631
|
if (block && this.mayDissolve(block)) return this.heldFootnote(p, open[1]);
|
|
1618
1632
|
if (block) break;
|
|
@@ -1620,8 +1634,22 @@ var Tokenizer = class {
|
|
|
1620
1634
|
}
|
|
1621
1635
|
const end = this.contentEnds[last];
|
|
1622
1636
|
if (this.paragraphMayGrow(end)) return this.heldFootnote(p, open[1]);
|
|
1637
|
+
if (this.streaming && end > this.provisionalFrom) return this.heldFootnote(p, open[1]);
|
|
1623
1638
|
return this.island("footnote_def", p, end, true, { id: open[1] });
|
|
1624
1639
|
}
|
|
1640
|
+
/** Every line from `k` to the end is a connector line or blank (a tree may still form there). */
|
|
1641
|
+
connectorRunReachesEnd(k) {
|
|
1642
|
+
if (this.lastNonConnectorLine === void 0) {
|
|
1643
|
+
let j = this.lineCount - 1;
|
|
1644
|
+
for (; j >= 0; j--) {
|
|
1645
|
+
this.tick(1);
|
|
1646
|
+
if (!this.lineIsBlank(j) && !TREE_GLYPHS.test(this.lineText(j))) break;
|
|
1647
|
+
}
|
|
1648
|
+
this.lastNonConnectorLine = j;
|
|
1649
|
+
}
|
|
1650
|
+
return k > this.lastNonConnectorLine;
|
|
1651
|
+
}
|
|
1652
|
+
lastNonConnectorLine = void 0;
|
|
1625
1653
|
/** A footnote whose continuation is still arriving: open to the end of the text. */
|
|
1626
1654
|
heldFootnote(p, id) {
|
|
1627
1655
|
return this.island("footnote_def", p, this.n, false, { id });
|
|
@@ -1886,7 +1914,6 @@ var Tokenizer = class {
|
|
|
1886
1914
|
if (isRecognizedJsonHead(this.text.slice(tp, tp + 512))) {
|
|
1887
1915
|
return this.island("json", p, this.n, false, jsonMeta(this.text.slice(tp)));
|
|
1888
1916
|
}
|
|
1889
|
-
this.provisionalFrom = Math.min(this.provisionalFrom, p);
|
|
1890
1917
|
return null;
|
|
1891
1918
|
}
|
|
1892
1919
|
if (net !== 0) return null;
|