@descent-vtt/spec-graph 0.10.0 → 0.11.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 +18 -0
- package/README.md +21 -69
- package/dist/extract.d.ts +1 -14
- package/dist/extract.js +14 -58
- package/dist/extract.js.map +1 -1
- package/dist/lifecycle.d.ts +1 -11
- package/dist/lifecycle.js +31 -187
- package/dist/lifecycle.js.map +1 -1
- package/dist/sections.js +2 -2
- package/dist/sections.js.map +1 -1
- package/dist/state.js +3 -19
- package/dist/state.js.map +1 -1
- package/dist/yaml.js +2 -2
- package/dist/yaml.js.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -11,6 +11,24 @@ the family's
|
|
|
11
11
|
[versioning policy](https://github.com/DescentVTT/spec-core/blob/main/docs/adr/0009-versions-before-1-0.md)
|
|
12
12
|
records.
|
|
13
13
|
|
|
14
|
+
## 0.11.0
|
|
15
|
+
|
|
16
|
+
spec-graph reads English only again, by the maintainer's decision; the
|
|
17
|
+
two-column status table stays with English keys. spec-core's copy is
|
|
18
|
+
unchanged.
|
|
19
|
+
|
|
20
|
+
### Removed
|
|
21
|
+
|
|
22
|
+
- Statuses, relations, obligation and bookkeeping headings and markers
|
|
23
|
+
written in Chinese are no longer read: a Chinese status word, `狀態` or
|
|
24
|
+
`状态` as a status key, heading, label or table key, and a full-width
|
|
25
|
+
colon after a status label or heading give an unknown phase, and a
|
|
26
|
+
Chinese phrase, heading or marker draws nothing. The two-column status
|
|
27
|
+
table stays, with `Status` and `State`, and so do the stop at `。?!;`
|
|
28
|
+
and a full-width comma or semicolon between successors (ADR-0002,
|
|
29
|
+
ADR-0003, ADR-0006). Upgrading: write the status in English, e.g.
|
|
30
|
+
`status: superseded`.
|
|
31
|
+
|
|
14
32
|
## 0.10.0
|
|
15
33
|
|
|
16
34
|
Statuses, status tables, relations, obligations and markers written in
|
package/README.md
CHANGED
|
@@ -133,8 +133,9 @@ onto four phases, chosen so one question can be answered from the phase alone:
|
|
|
133
133
|
| `frozen` | `final`, `ratified`, `locked`, `published`, … | **no** |
|
|
134
134
|
| `retired` | `superseded`, `deprecated`, `rejected`, `withdrawn`, … | **no** |
|
|
135
135
|
|
|
136
|
-
The status is found wherever your team writes it,
|
|
137
|
-
(
|
|
136
|
+
The status is found wherever your team writes it, and however it is dressed
|
|
137
|
+
(`**Accepted** (2026-03-01) ✅`). A document may be written in any language; its
|
|
138
|
+
status is read in English (`status: superseded`):
|
|
138
139
|
|
|
139
140
|
- front matter: `status:`, `state:`, `stage:`
|
|
140
141
|
- a `## Status` section
|
|
@@ -167,44 +168,14 @@ that `provisionally accepted` is a draft.
|
|
|
167
168
|
| `active` | `accepted`, `active`, `approved`, `adopted`, `agreed`, `implementable`, `implemented`, `implementing`, `current`, `effective`, `in-effect`, `enforced`, `stable`, `merged`, `released`, `shipped`, `live`, `done`, `complete`, `completed`, `signed-off`, `committed` |
|
|
168
169
|
| `draft` | `draft`, `drafting`, `proposed`, `proposal`, `provisional`, `provisionally-accepted`, `prospective`, `wip`, `work-in-progress`, `in-progress`, `in_progress`, `review`, `in-review`, `under-review`, `reviewing`, `discussion`, `discussing`, `pending`, `idea`, `exploratory`, `candidate`, `open`, `new`, `unreviewed`, `rfc`, `experimental`, `alpha`, `beta`, `incubating` |
|
|
169
170
|
|
|
170
|
-
Chinese is read in Traditional and Simplified characters, each word as the
|
|
171
|
-
English word it translates, so it lands in that word's row: `延後` is
|
|
172
|
-
`deferred` and retired, `封存` is `archived` and a record, and `暫定` is
|
|
173
|
-
`provisionally accepted`, so `暫定接受` is a draft.
|
|
174
|
-
|
|
175
|
-
- **A Chinese word counts wherever it stands in the status**, because Chinese
|
|
176
|
-
puts no space between words: `已接受,後被ADR-0003取代` holds `已接受` and a
|
|
177
|
-
supersession.
|
|
178
|
-
- **Except directly after a negation:** `不`, `未`, `非`, `沒`, `没`, `無`,
|
|
179
|
-
`无`, `勿`, `尚未` or `不再`. `未接受`, `尚未核准` and `不再生效` say nothing;
|
|
180
|
-
a word that starts with one, `不採納`, is itself.
|
|
181
|
-
- **Superseded is also `被` followed by `取代`, `替代` or `取而代之`**, within 30
|
|
182
|
-
characters and in the same sentence: `已被 ADR-0003 取代` is retired, and
|
|
183
|
-
names ADR-0003 as what replaced it.
|
|
184
|
-
- **`已取代` alone is retired.** Followed by a name, after spaces or a colon -
|
|
185
|
-
`已取代 ADR-0002` - it says what this document replaced, and is not read.
|
|
186
|
-
- **`取代` with no `被`**, as in `已接受(取代 ADR-0002)`, retires nothing.
|
|
187
|
-
|
|
188
|
-
| Phase | Chinese status words |
|
|
189
|
-
| --- | --- |
|
|
190
|
-
| `retired` | `已被取代`, `被取代`, `已取代`, `已棄用`, `棄用`, `已弃用`, `弃用`, `已廢棄`, `廢棄`, `已废弃`, `废弃`, `已停用`, `已過時`, `已过时`, `已否決`, `否決`, `已否决`, `否决`, `已拒絕`, `已拒绝`, `不採納`, `不采纳`, `已撤回`, `撤回`, `已作廢`, `作廢`, `已作废`, `作废`, `延後`, `延后`, `暫緩`, `暂缓`, `擱置`, `搁置` |
|
|
191
|
-
| `record` | `封存`, `已封存`, `歸檔`, `已歸檔`, `归档`, `已归档` |
|
|
192
|
-
| `frozen` | `已定案`, `定案`, `已凍結`, `已冻结` |
|
|
193
|
-
| `active` | `已接受`, `接受`, `已採納`, `採納`, `已采纳`, `采纳`, `已核准`, `核准`, `已批准`, `批准`, `已生效`, `生效`, `已實施`, `已实施`, `已完成` |
|
|
194
|
-
| `draft` | `暫定`, `暂定`, `草稿`, `草案`, `提議`, `提议`, `提案`, `審查中`, `审查中`, `審核中`, `审核中`, `討論中`, `讨论中`, `待審`, `待审`, `待審核`, `待审核` |
|
|
195
|
-
|
|
196
171
|
| Where | Read from |
|
|
197
172
|
| --- | --- |
|
|
198
|
-
| Front matter, the first key present | `status`,
|
|
199
|
-
| A section, under the heading, with or without a colon
|
|
200
|
-
| A two-column table above the first `##`, in the cell right of the first key in the left column, the header row included | `Status`, `State
|
|
173
|
+
| Front matter, the first key present | `status`, `state`, `stage`, `lifecycle`, `phase`, `adr-status` |
|
|
174
|
+
| A section, under the heading, with or without a colon | `Status`, `State`, `Stage`, `Lifecycle`, `Current status` |
|
|
175
|
+
| A two-column table above the first `##`, in the cell right of the first key in the left column, the header row included | `Status`, `State` |
|
|
201
176
|
| A directory, for a document that declares no status | `archive`, `archived`, `attic`, `deprecated`, `graveyard`, `historical`, `obsolete`, `rejected`, `retired`, `superseded`, `superceded`, `withdrawn` |
|
|
202
177
|
|
|
203
|
-
|
|
204
|
-
there is a line left unread, where a heading or a label takes either colon.
|
|
205
|
-
|
|
206
|
-
The table is where many teams put a document's fields, `| 狀態 | 已接受 |` or
|
|
207
|
-
`| Status | Accepted |`:
|
|
178
|
+
The table is where many teams put a document's fields, `| Status | Accepted |`:
|
|
208
179
|
|
|
209
180
|
- It is read where a `## Status` section is, after one: a document with both is
|
|
210
181
|
read from the section, and front matter still wins over either.
|
|
@@ -275,26 +246,23 @@ code. *"We resolved to keep the queue"* does not close anything.
|
|
|
275
246
|
| Disposition | Checkboxes | Markers | `state=` |
|
|
276
247
|
| --- | --- | --- | --- |
|
|
277
248
|
| `unresolved` | `[ ]` `[?]` `[!]` `[*]` | `unresolved`, `still open`, `open question`, `tbd`, `undecided`, `reopened` | `open`, `unresolved`, `todo` |
|
|
278
|
-
| `narrowed` | `[~]` `[/]` | `partially resolved`, `partially answered`, `partially done`, `partly resolved`, `narrowed`, `narrowed to`, `scoped down`, `reduced scope`, `reduced to`, `partial`, `in progress`, `in_progress`, `remaining`, `split
|
|
279
|
-
| `delegated` | | `delegated`, `delegated to`, `moved to`, `tracked in`, `tracked by`, `handed off`, `handed off to`, `handed to`, `deferred to`, `follow up in`, `follow-up in`, `followup in`, `continued in`, `owned by
|
|
280
|
-
| `satisfied` | `[x]` `[X]` `[+]` | `resolved`, `answered`, `decided`, `settled`, `done`, `complete`, `completed`, `closed`, `fixed`, `shipped`, `addressed`, `implemented`, `solved`, `confirmed
|
|
281
|
-
| `accepted-debt` | | `accepted debt`, `accepted as debt`, `accepted risk`, `known limitation`, `known issue`, `known gap`, `technical debt`, `tech debt`, `wontfix`, `won't fix`, `won’t fix`, `will not fix`, `by design`, `tolerated`, `living with it
|
|
249
|
+
| `narrowed` | `[~]` `[/]` | `partially resolved`, `partially answered`, `partially done`, `partly resolved`, `narrowed`, `narrowed to`, `scoped down`, `reduced scope`, `reduced to`, `partial`, `in progress`, `in_progress`, `remaining`, `split` | `narrowed`, `partial` |
|
|
250
|
+
| `delegated` | | `delegated`, `delegated to`, `moved to`, `tracked in`, `tracked by`, `handed off`, `handed off to`, `handed to`, `deferred to`, `follow up in`, `follow-up in`, `followup in`, `continued in`, `owned by` | `delegated` |
|
|
251
|
+
| `satisfied` | `[x]` `[X]` `[+]` | `resolved`, `answered`, `decided`, `settled`, `done`, `complete`, `completed`, `closed`, `fixed`, `shipped`, `addressed`, `implemented`, `solved`, `confirmed` | `satisfied`, `resolved`, `done`, `closed` |
|
|
252
|
+
| `accepted-debt` | | `accepted debt`, `accepted as debt`, `accepted risk`, `known limitation`, `known issue`, `known gap`, `technical debt`, `tech debt`, `wontfix`, `won't fix`, `won’t fix`, `will not fix`, `by design`, `tolerated`, `living with it` | `accepted-debt`, `debt`, `wontfix` |
|
|
282
253
|
| `rejected` | `[-]` | `rejected`, `declined`, `dropped`, `not doing`, `will not do`, `abandoned`, `cancelled`, `canceled`, `withdrawn` | `rejected`, `declined` |
|
|
283
254
|
| `obviated` | | `no longer applicable`, `no longer relevant`, `no longer needed`, `overtaken by events`, `premise invalid`, `obviated`, `obsolete`, `not applicable`, `moot`, `void`, `n/a`, `obe` | `obviated`, `moot` |
|
|
284
255
|
|
|
285
256
|
Where a marker counts, and how it may be written:
|
|
286
257
|
|
|
287
258
|
- A marker counts where a statement starts: at the start of the item or of a
|
|
288
|
-
line, after the end of a sentence
|
|
289
|
-
with a space after it or none - or after `(` or `[`.
|
|
259
|
+
line, after the end of a sentence, or after `(` or `[`.
|
|
290
260
|
- Punctuated means followed by `:`, `:`, `-`, `–`, `—` or `.`, so `Done.`
|
|
291
261
|
closes an item; emphasised means the emphasis closes on the marker, so
|
|
292
262
|
`**Closed beta**` does not.
|
|
293
263
|
- A marker of more than one word may be spaced, hyphenated or joined by an
|
|
294
264
|
underscore, whichever the table has: `**Tech-debt:**` and `TECH_DEBT:` are
|
|
295
265
|
`tech debt`. An apostrophe may be straight or curly.
|
|
296
|
-
- A Chinese marker is the English one it translates, and has no case to shout
|
|
297
|
-
in: `已決定:` and `**已決定**` close an item, and `我們已決定採用` does not.
|
|
298
266
|
|
|
299
267
|
</details>
|
|
300
268
|
|
|
@@ -309,8 +277,7 @@ heading of its level. Every other bullet is the document's own prose.
|
|
|
309
277
|
`Follow Ups`, `Follow-Ups`, `Followups`, `Follow Up`, `Follow-Up`,
|
|
310
278
|
`Unresolved`, `Outstanding`, `Outstanding Questions`, `Tasks`, `Task List`,
|
|
311
279
|
`Work Items`, `Remaining Work`, `Decisions Needed`, `Blockers`, `Parking Lot`,
|
|
312
|
-
`Future Work`, `Deferred
|
|
313
|
-
`待辦事項`, `待办事项`, `後續工作`, `后续工作`.
|
|
280
|
+
`Future Work`, `Deferred`.
|
|
314
281
|
|
|
315
282
|
### References, resolved forgivingly and validated strictly
|
|
316
283
|
|
|
@@ -473,6 +440,9 @@ A phrase governs a reference when it stands no more than 40 characters before
|
|
|
473
440
|
it, in the same statement: a sentence, a paragraph, a list item or a table cell.
|
|
474
441
|
|
|
475
442
|
- A negation between the two - `owned by nobody` - cancels it.
|
|
443
|
+
- A sentence written in Chinese ends at `。`, `?`, `!` or `;`, with a space
|
|
444
|
+
after it or none, so `Deferred to later。另見 ADR-0002` hands nothing to
|
|
445
|
+
ADR-0002. A stop only ends a statement sooner: it reads less, never more.
|
|
476
446
|
- Prose reads both directions too: `supersedes` and `superseded by`, `amends`
|
|
477
447
|
and `amended by`, `blocked by` and `blocks` or `blocking`, `depends on` and
|
|
478
448
|
`depended on by` - the second of each pair points back at the document that
|
|
@@ -482,30 +452,12 @@ it, in the same statement: a sentence, a paragraph, a list item or a table cell.
|
|
|
482
452
|
phrase: `[ADR-0002](0002.md) requires a migration` says nothing about this
|
|
483
453
|
document.
|
|
484
454
|
|
|
485
|
-
In Chinese a phrase before the reference hands the work on, as `deferred to`
|
|
486
|
-
does. **Chinese hand-off phrases:** `延後至`, `延后至`, `延至`, `移交至`,
|
|
487
|
-
`移交給`, `移交给`, `留待`, `交由`, `併入`, `并入`.
|
|
488
|
-
|
|
489
|
-
- Chinese puts no space between words, so one counts wherever it stands,
|
|
490
|
-
`此問題延後至ADR-0002`, except directly after a negation - `不`, `未`, `非`,
|
|
491
|
-
`沒`, `没`, `無`, `无`, `勿`, `尚未` or `不再` - so `未移交給 ADR-0002` hands
|
|
492
|
-
nothing on.
|
|
493
|
-
- An English phrase counts beside Chinese as well, `此問題deferred to ADR-0002`:
|
|
494
|
-
a Han character is not part of an English word.
|
|
495
|
-
- A statement also ends at `。`, `?`, `!` and `;`, with a space after it or
|
|
496
|
-
none, so `上次延後至別處。另見 ADR-0002` hands nothing to ADR-0002.
|
|
497
|
-
- A phrase written around the reference, `由 ADR-0002 決定` or
|
|
498
|
-
`在 ADR-0002 中追蹤`, is not read, and neither are `根據`, `依據` and `基於`:
|
|
499
|
-
Chinese uses them for any citation, and an `assumes` read from one would make
|
|
500
|
-
a stale premise of it.
|
|
501
|
-
|
|
502
455
|
A link under a heading that files it as bookkeeping is `relates-to` unless a
|
|
503
456
|
phrase beside it says more. **Bookkeeping headings:** `See also`, `References`,
|
|
504
457
|
`Reference`, `Related`, `Related work`, `Related decisions`,
|
|
505
458
|
`Related documents`, `Links`, `Further reading`, `Prior art`, `History`,
|
|
506
459
|
`Changelog`, `Change log`, `Revision history`, `Bibliography`, `Sources`,
|
|
507
|
-
`Appendix`, `More information`, `Resources`, `Index
|
|
508
|
-
`相關文件`, `相关文件`, `延伸閱讀`, `延伸阅读`, `附錄`, `附录`, `修訂紀錄`, `修订记录`.
|
|
460
|
+
`Appendix`, `More information`, `Resources`, `Index`.
|
|
509
461
|
|
|
510
462
|
Two properties do the work:
|
|
511
463
|
|
|
@@ -531,8 +483,8 @@ decisions. **A specification is a region of a file, not a file**, so both work:
|
|
|
531
483
|
Shard by tenant id.
|
|
532
484
|
```
|
|
533
485
|
|
|
534
|
-
Each section with an identifier *and* a status - a `**Status:**` line
|
|
535
|
-
|
|
486
|
+
Each section with an identifier *and* a status - a `**Status:**` line or a
|
|
487
|
+
`### Status` section under its heading - becomes a
|
|
536
488
|
specification in its own right, with its own lifecycle, its own obligations and
|
|
537
489
|
its own relations — resolvable from anywhere in the corpus as `ADR-0007`,
|
|
538
490
|
whether it lives in a register or in its own file. Moving it out later breaks
|
|
@@ -1325,9 +1277,9 @@ tools share, whose code is copied into `src/vendor/` and checked by hash rather
|
|
|
1325
1277
|
than installed. So the whole package is auditable in an afternoon — and nothing
|
|
1326
1278
|
in the pipeline can take longer than its input.
|
|
1327
1279
|
|
|
1328
|
-
**Verified, not just covered.** 1,
|
|
1280
|
+
**Verified, not just covered.** 1,880 tests; 99.4% statement and 99.8% line
|
|
1329
1281
|
coverage. Coverage says a line ran, so the suite is also held to a mutation
|
|
1330
|
-
score - 96.
|
|
1282
|
+
score - 96.32% over 8,393 mutants, measured by CI's full sweep, and a build
|
|
1331
1283
|
fails under 93 - because a vocabulary entry or a boundary
|
|
1332
1284
|
condition can be weakened by an ordinary-looking refactor without a single test
|
|
1333
1285
|
going red. [ADR-0007](https://github.com/DescentVTT/spec-graph/blob/main/docs/adr/0007-mutation-testing.md) is straight about what
|
package/dist/extract.d.ts
CHANGED
|
@@ -128,19 +128,6 @@ export declare function foldRelationKey(key: string): string;
|
|
|
128
128
|
* be shadowed, which is {@link UNINHERITED}.
|
|
129
129
|
*/
|
|
130
130
|
export declare function inheritableFrontMatter(entries: readonly YamlEntry[]): Readonly<Record<string, string | readonly string[]>>;
|
|
131
|
-
/**
|
|
132
|
-
* Phrases that give a link its meaning, longest-matching-nearest wins.
|
|
133
|
-
*
|
|
134
|
-
* Only phrases that genuinely commit the citing document are here. Vague ones
|
|
135
|
-
* ("see", "covered by") stay out: a `references` edge is harmless, whereas a
|
|
136
|
-
* wrongly inferred `assumes` edge produces a confident stale-premise finding
|
|
137
|
-
* about a document that never depended on anything.
|
|
138
|
-
*/
|
|
139
|
-
declare const VERB_RULES: readonly {
|
|
140
|
-
kind: EdgeKind;
|
|
141
|
-
inverted: boolean;
|
|
142
|
-
phrases: readonly string[];
|
|
143
|
-
}[];
|
|
144
131
|
/** Headings under which a link is bookkeeping rather than a commitment. */
|
|
145
132
|
declare const WEAK_SECTIONS: ReadonlySet<string>;
|
|
146
133
|
/** Headings whose bullets are obligations even without a checkbox. */
|
|
@@ -183,4 +170,4 @@ export interface Classification {
|
|
|
183
170
|
*/
|
|
184
171
|
export declare function classifyReference(text: string, start: number, end: number, section: readonly string[]): Classification;
|
|
185
172
|
/** Exposed for tests and for callers that classify their own sections. */
|
|
186
|
-
export { OBLIGATION_SECTIONS, sectionPathAt,
|
|
173
|
+
export { OBLIGATION_SECTIONS, sectionPathAt, WEAK_SECTIONS };
|
package/dist/extract.js
CHANGED
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
*/
|
|
17
17
|
import { attr, attrList, bindItemDirectives, parseDirectives } from './directives.js';
|
|
18
18
|
import { identify, isDocumentTarget, isExternal, looksLikePath, normaliseRef, parsePrefixedRef, withinOneEdit, ID_KEYS, } from './identity.js';
|
|
19
|
-
import { isStatusHeading,
|
|
19
|
+
import { isStatusHeading, phaseFromPath, phaseOf, STATUS_KEYS, supersessionTargetsIn } from './lifecycle.js';
|
|
20
20
|
import { anchorsOf, isMarkdownLine, isOnlyComment, referenceLinks, scanMarkdown, slugify, } from './markdown.js';
|
|
21
21
|
import { findSpecificationRegions, isRegisterTable, opensHeading, regionAt, } from './sections.js';
|
|
22
22
|
import { resolveItemState } from './state.js';
|
|
@@ -253,22 +253,6 @@ const VERB_RULES = [
|
|
|
253
253
|
'to be resolved in',
|
|
254
254
|
'to be handled in',
|
|
255
255
|
'to be answered in',
|
|
256
|
-
// Chinese, Traditional and Simplified, each standing before the
|
|
257
|
-
// reference as its English counterpart does: deferred to, handed to,
|
|
258
|
-
// left to. `併入`, merged into, hands a question on whole; read as
|
|
259
|
-
// `rolled into`, a supersession, a constraint merged into another
|
|
260
|
-
// decision's design would retire the document that states it. Nothing
|
|
261
|
-
// that wraps the reference, `由 X 決定`: a phrase here only precedes one.
|
|
262
|
-
'延後至',
|
|
263
|
-
'延后至',
|
|
264
|
-
'延至',
|
|
265
|
-
'移交至',
|
|
266
|
-
'移交給',
|
|
267
|
-
'移交给',
|
|
268
|
-
'留待',
|
|
269
|
-
'交由',
|
|
270
|
-
'併入',
|
|
271
|
-
'并入',
|
|
272
256
|
],
|
|
273
257
|
},
|
|
274
258
|
{
|
|
@@ -354,22 +338,12 @@ const VERB_WINDOW = 40;
|
|
|
354
338
|
* Neither the sort nor the escaping decides anything today, and no test can
|
|
355
339
|
* pin them: no phrase in the table is another one followed by more words, and
|
|
356
340
|
* none holds a character a pattern would read. Both are for the next phrase.
|
|
357
|
-
*
|
|
358
|
-
* An English phrase stands between word boundaries, and a Han character is
|
|
359
|
-
* not part of an English word: `此問題deferred to ADR-0002` holds the whole
|
|
360
|
-
* phrase, which the boundary read as a letter used to refuse. A Chinese phrase
|
|
361
|
-
* has no boundary at all, since Chinese puts no space between words.
|
|
362
341
|
*/
|
|
363
342
|
const VERB_LOOKUP = new Map(VERB_RULES.flatMap((rule) => rule.phrases.map((phrase) => [phrase, { kind: rule.kind, inverted: rule.inverted }])));
|
|
364
|
-
const
|
|
365
|
-
/** A letter or digit an English phrase may not touch: any but a Han character. */
|
|
366
|
-
const WORD_CHARACTER = String.raw `(?!\p{Script=Han})[\p{L}\p{N}]`;
|
|
367
|
-
const alternation = (phrases) => [...phrases]
|
|
343
|
+
const VERB_PATTERN = new RegExp(`(?<![\\p{L}\\p{N}])(?:${[...VERB_LOOKUP.keys()]
|
|
368
344
|
.sort((a, b) => b.length - a.length)
|
|
369
345
|
.map((phrase) => phrase.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'))
|
|
370
|
-
.join('|');
|
|
371
|
-
const VERB_PATTERN = new RegExp(`(?<!${WORD_CHARACTER})(?:${alternation([...VERB_LOOKUP.keys()].filter((phrase) => !HAN.test(phrase)))})(?!${WORD_CHARACTER})` +
|
|
372
|
-
`|(?:${alternation([...VERB_LOOKUP.keys()].filter((phrase) => HAN.test(phrase)))})`, 'gu');
|
|
346
|
+
.join('|')})(?![\\p{L}\\p{N}])`, 'gu');
|
|
373
347
|
/** Headings under which a link is bookkeeping rather than a commitment. */
|
|
374
348
|
const WEAK_SECTIONS = new Set([
|
|
375
349
|
'see also',
|
|
@@ -392,16 +366,6 @@ const WEAK_SECTIONS = new Set([
|
|
|
392
366
|
'more information',
|
|
393
367
|
'resources',
|
|
394
368
|
'index',
|
|
395
|
-
'參考資料',
|
|
396
|
-
'参考资料',
|
|
397
|
-
'相關文件',
|
|
398
|
-
'相关文件',
|
|
399
|
-
'延伸閱讀',
|
|
400
|
-
'延伸阅读',
|
|
401
|
-
'附錄',
|
|
402
|
-
'附录',
|
|
403
|
-
'修訂紀錄',
|
|
404
|
-
'修订记录',
|
|
405
369
|
]);
|
|
406
370
|
/** Headings whose bullets are obligations even without a checkbox. */
|
|
407
371
|
const OBLIGATION_SECTIONS = new Set([
|
|
@@ -435,14 +399,6 @@ const OBLIGATION_SECTIONS = new Set([
|
|
|
435
399
|
'parking lot',
|
|
436
400
|
'future work',
|
|
437
401
|
'deferred',
|
|
438
|
-
'待決事項',
|
|
439
|
-
'待决事项',
|
|
440
|
-
'未決問題',
|
|
441
|
-
'未决问题',
|
|
442
|
-
'待辦事項',
|
|
443
|
-
'待办事项',
|
|
444
|
-
'後續工作',
|
|
445
|
-
'后续工作',
|
|
446
402
|
]);
|
|
447
403
|
/**
|
|
448
404
|
* Prefixes that look like specification identifiers but never are.
|
|
@@ -840,11 +796,11 @@ function readStatus(scanned, byKey, nodeDirective, index, file, regions) {
|
|
|
840
796
|
return { raw: null, at: null, phase: 'unknown' };
|
|
841
797
|
}
|
|
842
798
|
/** The left cells that make a two-column table's row the document's status. */
|
|
843
|
-
const STATUS_TABLE_KEYS = new Set(['status', 'state'
|
|
799
|
+
const STATUS_TABLE_KEYS = new Set(['status', 'state']);
|
|
844
800
|
/**
|
|
845
801
|
* The status a key-value table at the top of a document gives:
|
|
846
|
-
* `|
|
|
847
|
-
*
|
|
802
|
+
* `| Status | Accepted |`, as the right cell of the first row whose left cell
|
|
803
|
+
* is a status key, the header row included.
|
|
848
804
|
*
|
|
849
805
|
* Read only where a document describes itself. A table under a heading below
|
|
850
806
|
* the title is a legend or a register, and one with more than two columns is
|
|
@@ -1265,9 +1221,6 @@ export function classifyReference(text, start, end, section) {
|
|
|
1265
1221
|
// negation in there reverses the claim the phrase would otherwise make.
|
|
1266
1222
|
if (NEGATION.test(before.slice(end)))
|
|
1267
1223
|
continue;
|
|
1268
|
-
// Chinese negates the phrase itself, directly before it: `未移交給`.
|
|
1269
|
-
if (negatedAt(before, m.index))
|
|
1270
|
-
continue;
|
|
1271
1224
|
// Always found: the pattern was compiled from this table's own keys, and a
|
|
1272
1225
|
// lower-cased search matches them only as written. The check is for types.
|
|
1273
1226
|
const rule = VERB_LOOKUP.get(phrase);
|
|
@@ -1309,9 +1262,11 @@ export function classifyReference(text, start, end, section) {
|
|
|
1309
1262
|
* following row's link into an `assumes` edge, and so turned every archived
|
|
1310
1263
|
* document it listed into a stale premise.
|
|
1311
1264
|
*
|
|
1312
|
-
* A Chinese
|
|
1313
|
-
* Chinese writes none.
|
|
1314
|
-
*
|
|
1265
|
+
* A sentence written in Chinese ends at `。?!;`, with a space after it or
|
|
1266
|
+
* none, since Chinese writes none. A stop only ends a statement sooner, so it
|
|
1267
|
+
* reads fewer relations and never more: without it,
|
|
1268
|
+
* `Deferred to later。另見 ADR-0002` handed the question to ADR-0002 from the
|
|
1269
|
+
* sentence before.
|
|
1315
1270
|
*/
|
|
1316
1271
|
const STATEMENT_BREAK = /[.?!;]\s|[。?!;]|\n\s*\n|\n\s*[-*+>#]|\|/g;
|
|
1317
1272
|
/**
|
|
@@ -1335,7 +1290,8 @@ function sentenceBefore(text, start) {
|
|
|
1335
1290
|
.replace(/\s+/g, ' ');
|
|
1336
1291
|
}
|
|
1337
1292
|
/**
|
|
1338
|
-
* The statement after a reference, to the first stop,
|
|
1293
|
+
* The statement after a reference, to the first stop, the stops of a sentence
|
|
1294
|
+
* written in Chinese included.
|
|
1339
1295
|
*
|
|
1340
1296
|
* Only its start is read. A line break matters as a stop, since the trim
|
|
1341
1297
|
* below would otherwise bring the next line's phrase to the start. A Chinese
|
|
@@ -1452,5 +1408,5 @@ function renderLink(link) {
|
|
|
1452
1408
|
}
|
|
1453
1409
|
}
|
|
1454
1410
|
/** Exposed for tests and for callers that classify their own sections. */
|
|
1455
|
-
export { OBLIGATION_SECTIONS, sectionPathAt,
|
|
1411
|
+
export { OBLIGATION_SECTIONS, sectionPathAt, WEAK_SECTIONS };
|
|
1456
1412
|
//# sourceMappingURL=extract.js.map
|