@descent-vtt/spec-graph 0.19.0 → 0.20.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/CHANGELOG.md +68 -0
- package/README.md +28 -8
- package/dist/cli.js +34 -9
- package/dist/cli.js.map +1 -1
- package/dist/extract.js +36 -3
- package/dist/extract.js.map +1 -1
- package/dist/paths.d.ts +12 -0
- package/dist/paths.js +14 -0
- package/dist/paths.js.map +1 -1
- package/package.json +1 -1
package/dist/extract.js
CHANGED
|
@@ -357,8 +357,33 @@ const NEGATION = /(?:^|[^\p{L}\p{N}-])(?:no|not|no-one|nobody|none|never|neither
|
|
|
357
357
|
* they were cancelled (ADR-0006, 2026-10-19). A contraction is a negation,
|
|
358
358
|
* `isn't` and `doesn’t`, and so is `cannot`. Tested against the text just
|
|
359
359
|
* before the phrase, which ends with the space or the comma before it.
|
|
360
|
+
*
|
|
361
|
+
* An aside between the two, closed by a comma of its own, leaves the clause
|
|
362
|
+
* open: "Not, as it happens, blocked by", "never, ever, blocked by" and "it
|
|
363
|
+
* is not, as far as anyone knows, blocked by" deny the relation as the words
|
|
364
|
+
* without the aside do. The aside is anything up to a comma, and may hold
|
|
365
|
+
* several, so the negation may also end a clause the phrase is not in -
|
|
366
|
+
* "if not, then, blocked by" - and the relation such a sentence states is
|
|
367
|
+
* missed, which ADR-0006 prefers to one it denies (2026-10-24). The same few
|
|
368
|
+
* words may stand after the last comma, "not, in the end, been superseded
|
|
369
|
+
* by". A run of spaces and commas is one comma in the text this is tested
|
|
370
|
+
* on, so no aside is empty and `.*` would read as `.+` does; and only
|
|
371
|
+
* whether the pattern matches is asked, so a lazy `.+?` reads alike too.
|
|
372
|
+
*/
|
|
373
|
+
const NEGATED_BEFORE = /(?:^|[^\p{L}\p{N}-])(?:no|not|no one|no-one|nobody|none|never|neither|nor|nothing|without|cannot|\p{L}+n['’]t)(?: (?:be|been|being|is|are|was|were|yet|longer|ever|even|currently|actually|really|necessarily|always))*(?: |,.+,(?:(?:be|been|being|is|are|was|were|yet|longer|ever|even|currently|actually|really|necessarily|always) )*)$/u;
|
|
374
|
+
/**
|
|
375
|
+
* A word that points the reader at the reference, and governs it as a
|
|
376
|
+
* citation from nearer than any phrase before it: "Per tick, see [ADR-7]"
|
|
377
|
+
* read ADR-7 as a premise, and "blocked by the cache, see [ADR-7]" read it
|
|
378
|
+
* as what blocks. `see` is no phrase for the vagueness that makes it a
|
|
379
|
+
* citation, and between a phrase and the reference it says the reference is
|
|
380
|
+
* where to read more, not what the phrase names (ADR-0006, 2026-10-24). It
|
|
381
|
+
* is a word as a negation is, between anything but a letter, a digit or a
|
|
382
|
+
* hyphen, so "the must-see list", "the licensee" and "seen in" point at
|
|
383
|
+
* nothing. The text it is tested on starts just after a phrase, where no
|
|
384
|
+
* letter stands, so the word is never its first and needs no start of text.
|
|
360
385
|
*/
|
|
361
|
-
const
|
|
386
|
+
const POINTER = /[^\p{L}\p{N}-]see(?![\p{L}\p{N}-])/u;
|
|
362
387
|
/**
|
|
363
388
|
* A code span that holds nothing but a negation word: `` `none` ``.
|
|
364
389
|
*
|
|
@@ -1294,11 +1319,19 @@ export function classifyReference(text, start, end, section) {
|
|
|
1294
1319
|
// What sits between the phrase and the reference has to be connective. A
|
|
1295
1320
|
// negation in there reverses the claim the phrase would otherwise make,
|
|
1296
1321
|
// and so does one just before the phrase, where no comma ends its clause
|
|
1297
|
-
// first.
|
|
1322
|
+
// first. A pointer in there governs the reference itself, as a citation.
|
|
1298
1323
|
if (NEGATION.test(before.slice(end)))
|
|
1299
1324
|
continue;
|
|
1300
|
-
if (
|
|
1325
|
+
if (POINTER.test(before.slice(end)))
|
|
1301
1326
|
continue;
|
|
1327
|
+
// A negation before a phrase stands between any phrase before it and the
|
|
1328
|
+
// reference, and denies what follows it: a phrase it leaves before an
|
|
1329
|
+
// aside governs no more than the one it cancels, so "Not, as decided in
|
|
1330
|
+
// [ADR-3], blocked by [ADR-7]" makes ADR-7 a premise of nothing.
|
|
1331
|
+
if (NEGATED_BEFORE.test(commas.slice(0, m.index))) {
|
|
1332
|
+
best = null;
|
|
1333
|
+
continue;
|
|
1334
|
+
}
|
|
1302
1335
|
// Always found: the pattern was compiled from this table's own keys, and a
|
|
1303
1336
|
// lower-cased search matches them only as written. The check is for types.
|
|
1304
1337
|
const rule = VERB_LOOKUP.get(phrase);
|