@heroiclands/package-build 23.9.0 → 23.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 +33 -0
- package/README.md +2 -0
- package/bin/content-commands.mjs +197 -68
- package/docs/api.md +365 -70
- package/docs/authoring/first-note.md +10 -0
- package/docs/authoring/frontmatter.md +1 -1
- package/docs/authoring/links-and-markup.md +186 -49
- package/docs/commands.md +92 -3
- package/docs/content-format.md +10 -3
- package/docs/design.md +18 -0
- package/docs/guides/book.md +7 -0
- package/docs/guides/site.md +7 -0
- package/docs/reference/format-details.md +186 -15
- package/docs/reference/note-types.md +4 -4
- package/engine/anchors.mjs +43 -9
- package/engine/base-compiler.mjs +6 -4
- package/engine/changelog-group.mjs +58 -34
- package/engine/changelog-lint.mjs +6 -2
- package/engine/compendiums.mjs +15 -1
- package/engine/compile-corpus.mjs +14 -1
- package/engine/content-charset.mjs +13 -1
- package/engine/content-html.mjs +18 -4
- package/engine/content-icons.mjs +15 -1
- package/engine/content-images.mjs +28 -9
- package/engine/content-index.mjs +102 -23
- package/engine/content-links.mjs +68 -30
- package/engine/content-session.mjs +247 -0
- package/engine/content-sources.mjs +110 -0
- package/engine/content-spans.mjs +118 -14
- package/engine/content-tables.mjs +1 -0
- package/engine/content-tasklists.mjs +20 -4
- package/engine/diagnostics.mjs +17 -6
- package/engine/extension-attributes.mjs +28 -5
- package/engine/first-use.mjs +371 -0
- package/engine/foundry-entries.mjs +12 -9
- package/engine/generate.mjs +13 -4
- package/engine/helpers.mjs +47 -16
- package/engine/index-records.mjs +1 -0
- package/engine/index.mjs +3 -0
- package/engine/journals.mjs +9 -5
- package/engine/language-data.mjs +2 -2
- package/engine/language-rows.mjs +4 -4
- package/engine/language-terms.mjs +4 -4
- package/engine/lexical-sections.mjs +5 -5
- package/engine/markup-validation.mjs +7 -2
- package/engine/metadata-index.mjs +1 -0
- package/engine/name-markup.mjs +114 -0
- package/engine/name-rows.mjs +70 -0
- package/engine/names.mjs +460 -0
- package/engine/note-addresses.mjs +25 -4
- package/engine/path-charset.mjs +24 -1
- package/engine/pdf-render.mjs +15 -1
- package/engine/site-index.mjs +25 -2
- package/engine/sql-tables.mjs +76 -15
- package/engine/stub-lint.mjs +4 -3
- package/engine/web-wikilinks.mjs +33 -12
- package/engine/wikilink-syntax.mjs +65 -8
- package/engine/wikilinks.mjs +29 -11
- package/engine/yaml-lint.mjs +3 -5
- package/hugo-theme/layouts/partials/footer.html +2 -0
- package/hugo-theme/static/css/style.css +20 -0
- package/hugo-theme/static/js/inline-spoilers.js +23 -0
- package/package.json +1 -1
- package/types/engine/anchors.d.mts +6 -3
- package/types/engine/compendiums.d.mts +5 -1
- package/types/engine/compile-corpus.d.mts +5 -2
- package/types/engine/content-charset.d.mts +5 -1
- package/types/engine/content-html.d.mts +5 -1
- package/types/engine/content-icons.d.mts +5 -1
- package/types/engine/content-images.d.mts +5 -1
- package/types/engine/content-index.d.mts +39 -19
- package/types/engine/content-links.d.mts +22 -8
- package/types/engine/content-session.d.mts +108 -0
- package/types/engine/content-sources.d.mts +32 -0
- package/types/engine/content-spans.d.mts +8 -6
- package/types/engine/content-tasklists.d.mts +5 -1
- package/types/engine/diagnostics.d.mts +10 -0
- package/types/engine/extension-attributes.d.mts +16 -2
- package/types/engine/first-use.d.mts +31 -0
- package/types/engine/foundry-entries.d.mts +11 -4
- package/types/engine/generate.d.mts +5 -1
- package/types/engine/helpers.d.mts +30 -7
- package/types/engine/index.d.mts +1 -0
- package/types/engine/journals.d.mts +5 -2
- package/types/engine/lexical-sections.d.mts +3 -2
- package/types/engine/markup-validation.d.mts +2 -1
- package/types/engine/name-markup.d.mts +176 -0
- package/types/engine/name-rows.d.mts +35 -0
- package/types/engine/names.d.mts +356 -0
- package/types/engine/note-addresses.d.mts +3 -3
- package/types/engine/path-charset.d.mts +16 -1
- package/types/engine/site-build.d.mts +2 -2
- package/types/engine/site-index.d.mts +3 -1
- package/types/engine/sql-tables.d.mts +7 -2
- package/types/engine/stub-lint.d.mts +3 -1
- package/types/engine/wikilink-syntax.d.mts +40 -3
|
@@ -13,9 +13,10 @@
|
|
|
13
13
|
* @param {string} entryId - The entry's id, which page ids hash against.
|
|
14
14
|
* @param {string} body - The note's markdown body.
|
|
15
15
|
* @param {string} name - The note's name, used as the lead page's title.
|
|
16
|
+
* @param {import("./content-session.mjs").ContentSyntax} [syntax] - Session scanner projections.
|
|
16
17
|
* @returns {Record<string, string>} The anchors.
|
|
17
18
|
*/
|
|
18
|
-
export function anchorsOf(entryUuid: string, entryId: string, body: string, name: string): Record<string, string>;
|
|
19
|
+
export function anchorsOf(entryUuid: string, entryId: string, body: string, name: string, syntax?: import("./content-session.mjs").ContentSyntax): Record<string, string>;
|
|
19
20
|
/**
|
|
20
21
|
* The manifest entries a single note produces.
|
|
21
22
|
*
|
|
@@ -37,11 +38,17 @@ export function anchorsOf(entryUuid: string, entryId: string, body: string, name
|
|
|
37
38
|
* documentation journal's is {@link itemDocEntryId} of that. Stating it here is
|
|
38
39
|
* what lets the content index publish an identity it did not re-derive.
|
|
39
40
|
*
|
|
40
|
-
* @param {object} ctx - Resolved identities
|
|
41
|
-
* foundryPackageId, packRouter }`.
|
|
41
|
+
* @param {{contentPackage: string, foundryPackageId: string, packRouter: object, web?: boolean, skipDirectories?: readonly string[], syntax?: import("./content-session.mjs").ContentSyntax}} ctx - Resolved identities and optional session scanner projections.
|
|
42
42
|
* @returns {Array<object>} One or two entries, in {@link buildManifest}'s shape.
|
|
43
43
|
*/
|
|
44
|
-
export function entriesForNote(fm: object, name: string, address: string, body: string, ctx:
|
|
44
|
+
export function entriesForNote(fm: object, name: string, address: string, body: string, ctx: {
|
|
45
|
+
contentPackage: string;
|
|
46
|
+
foundryPackageId: string;
|
|
47
|
+
packRouter: object;
|
|
48
|
+
web?: boolean;
|
|
49
|
+
skipDirectories?: readonly string[];
|
|
50
|
+
syntax?: import("./content-session.mjs").ContentSyntax;
|
|
51
|
+
}): Array<object>;
|
|
45
52
|
/**
|
|
46
53
|
* Every note this package publishes, as manifest entries.
|
|
47
54
|
*
|
|
@@ -201,12 +201,16 @@ export function emptyPassErrors(passes: Array<{
|
|
|
201
201
|
* package's tree — and how the guard-order test below induces id drift, now
|
|
202
202
|
* that the manifest is located by configuration rather than by the working
|
|
203
203
|
* directory.
|
|
204
|
+
* @param {import("./content-session.mjs").ContentSession} [opts.session] - Same configuration, root and scope as this generation.
|
|
205
|
+
* @param {boolean} [opts.reportPreparation=true] - Emit shared preparation findings; false when already reported by the caller.
|
|
204
206
|
* @returns {Promise<number>} Total error count across the generated packs.
|
|
205
207
|
* @throws {Error} If the configured Foundry package id has drifted from the
|
|
206
208
|
* shipped manifest's `id` (see `package-manifest.mjs`).
|
|
207
209
|
*/
|
|
208
|
-
export function generatePacksJson({ only, config }?: {
|
|
210
|
+
export function generatePacksJson({ only, config, session, reportPreparation, }?: {
|
|
209
211
|
only?: string | undefined;
|
|
210
212
|
config?: object | undefined;
|
|
213
|
+
session?: import("./content-session.mjs").ContentSession | undefined;
|
|
214
|
+
reportPreparation?: boolean | undefined;
|
|
211
215
|
}): Promise<number>;
|
|
212
216
|
export function packJsonDir(name: string, config?: object): string;
|
|
@@ -17,7 +17,7 @@ export function renderFoundryMarkdown(body: string, figures?: Array<{
|
|
|
17
17
|
label: string;
|
|
18
18
|
}>, footnoteNumbers?: Map<string, number>, docId?: string, resolveRole?: (address: string) => string | undefined): string;
|
|
19
19
|
/**
|
|
20
|
-
* Parses a markdown file with YAML frontmatter.
|
|
20
|
+
* Parses a markdown file with LF or CRLF YAML frontmatter delimiters.
|
|
21
21
|
*
|
|
22
22
|
* Returns `{ frontmatter, body, description, bodyLine, bodyColumn, raw }` where
|
|
23
23
|
* `body` is the trimmed raw markdown after the frontmatter block, and
|
|
@@ -29,13 +29,19 @@ export function renderFoundryMarkdown(body: string, figures?: Array<{
|
|
|
29
29
|
* `{ frontmatter: null, body: "", description: "", raw }` and no
|
|
30
30
|
* position: there is no body to have one.
|
|
31
31
|
* @param {string} filePath - Markdown file to read.
|
|
32
|
-
* @param {
|
|
32
|
+
* @param {object} [opts]
|
|
33
|
+
* @param {object} [opts.addressContext] - Address defaults for decoded fields.
|
|
34
|
+
* @param {string} [opts.raw] - Exact captured source; omitted, reads the file.
|
|
35
|
+
* @param {boolean} [opts.renderDescription=true] - Render the body's HTML description.
|
|
36
|
+
* False leaves `description` empty for readers that only use authored text.
|
|
33
37
|
* @returns {{frontmatter: object|null, body: string, description: string, raw: string,
|
|
34
38
|
* bodyLine?: number, bodyColumn?: number, parseError?: {message: string,
|
|
35
39
|
* line?: number, column?: number}}} Parsed note and body position.
|
|
36
40
|
*/
|
|
37
|
-
export function parseMarkdownFile(filePath: string, { addressContext }?: {
|
|
38
|
-
addressContext?: object;
|
|
41
|
+
export function parseMarkdownFile(filePath: string, { addressContext, raw: capturedRaw, renderDescription }?: {
|
|
42
|
+
addressContext?: object | undefined;
|
|
43
|
+
raw?: string | undefined;
|
|
44
|
+
renderDescription?: boolean | undefined;
|
|
39
45
|
}): {
|
|
40
46
|
frontmatter: object | null;
|
|
41
47
|
body: string;
|
|
@@ -105,17 +111,24 @@ export function assertSuppliedCorpus(records: readonly object[] | undefined, who
|
|
|
105
111
|
* Required: the scope is the caller's to state, so two passes cannot
|
|
106
112
|
* disagree about which files are the corpus.
|
|
107
113
|
* @param {object} [opts.addressContext] - Address resolution context.
|
|
114
|
+
* @param {Map<string, {raw: string}>} [opts.sources] - Selected sources in walk order.
|
|
115
|
+
* Supplied, the walk parses these strings instead of reading the filesystem.
|
|
116
|
+
* @param {boolean} [opts.renderDescription=true] - Render each body's description.
|
|
108
117
|
* @yields {{frontmatter: object|null, body: string, description: string,
|
|
109
118
|
* file: string, absPath: string, bodyLine?: number, bodyColumn?: number}}
|
|
110
119
|
* One entry per `.md` file found.
|
|
111
120
|
* @throws {Error} When `skipDirectories` is not stated — see
|
|
112
121
|
* {@link assertStatedScope}.
|
|
113
122
|
*/
|
|
114
|
-
export function walkMarkdownTree(rootDir: string, { skipDirectories, addressContext }?: {
|
|
123
|
+
export function walkMarkdownTree(rootDir: string, { skipDirectories, addressContext, sources, renderDescription }?: {
|
|
115
124
|
skipDirectories: readonly string[];
|
|
116
125
|
addressContext?: object | undefined;
|
|
126
|
+
sources?: Map<string, {
|
|
127
|
+
raw: string;
|
|
128
|
+
}> | undefined;
|
|
129
|
+
renderDescription?: boolean | undefined;
|
|
117
130
|
}): Generator<{
|
|
118
|
-
file: string
|
|
131
|
+
file: string;
|
|
119
132
|
absPath: string;
|
|
120
133
|
frontmatter: object | null;
|
|
121
134
|
body: string;
|
|
@@ -366,12 +379,22 @@ export function defaultStats(): object;
|
|
|
366
379
|
* compile and handed in. Required: see {@link assertSuppliedCorpus}.
|
|
367
380
|
* @param {Map<string, object[]>} [opts.sqlTables] - Prepared directives,
|
|
368
381
|
* including the anchors and Foundry page maps of their expanded bodies.
|
|
382
|
+
* @param {ReturnType<import("./metadata-index.mjs").loadForeignIndexes>} [opts.foreign] -
|
|
383
|
+
* Captured dependency address and reference views for this context.
|
|
369
384
|
* @returns {{byShortcode: Map, types: Set}} From `buildWikilinkIndex`.
|
|
370
385
|
*/
|
|
371
|
-
export function buildContentLinkIndex(contentBase: string, router?: object, { config, records, sqlTables }?: {
|
|
386
|
+
export function buildContentLinkIndex(contentBase: string, router?: object, { config, records, sqlTables, foreign: capturedForeign }?: {
|
|
372
387
|
config?: object | undefined;
|
|
373
388
|
records?: readonly object[] | undefined;
|
|
374
389
|
sqlTables?: Map<string, object[]> | undefined;
|
|
390
|
+
foreign?: {
|
|
391
|
+
index: Map<string, object>;
|
|
392
|
+
packages: Set<string>;
|
|
393
|
+
stale: Array<{
|
|
394
|
+
package: string;
|
|
395
|
+
reason: string;
|
|
396
|
+
}>;
|
|
397
|
+
} | undefined;
|
|
375
398
|
}): {
|
|
376
399
|
byShortcode: Map<any, any>;
|
|
377
400
|
types: Set<any>;
|
package/types/engine/index.d.mts
CHANGED
|
@@ -50,6 +50,7 @@ export * as noteIds from "./note-ids.mjs";
|
|
|
50
50
|
export * as metadataIndex from "./metadata-index.mjs";
|
|
51
51
|
export * as foundryEntries from "./foundry-entries.mjs";
|
|
52
52
|
export * as contentIndex from "./content-index.mjs";
|
|
53
|
+
export * as contentSession from "./content-session.mjs";
|
|
53
54
|
export * as assetTypes from "./asset-types.mjs";
|
|
54
55
|
export * as assetIndex from "./asset-index.mjs";
|
|
55
56
|
export * as assetShipping from "./asset-shipping.mjs";
|
|
@@ -29,11 +29,12 @@
|
|
|
29
29
|
* picture's address to the role its asset declares, so a figure page's
|
|
30
30
|
* name reads `Map 1` rather than `Figure 1` where it is due — see
|
|
31
31
|
* {@link module:engine/content-figures.scanFigures}.
|
|
32
|
+
* @param {import("./content-session.mjs").ContentSyntax} [syntax] - Session scanner projections.
|
|
32
33
|
* @returns {Array<{name: string, anchorSlug: string|null, level: number,
|
|
33
34
|
* classes: string[], figure: object|null, continues?: string,
|
|
34
35
|
* markdown: string}>} Pages in document order.
|
|
35
36
|
*/
|
|
36
|
-
export function splitPages(body: string, leadName?: string, resolveRole?: (address: string) => string | undefined): Array<{
|
|
37
|
+
export function splitPages(body: string, leadName?: string, resolveRole?: (address: string) => string | undefined, syntax?: import("./content-session.mjs").ContentSyntax): Array<{
|
|
37
38
|
name: string;
|
|
38
39
|
anchorSlug: string | null;
|
|
39
40
|
level: number;
|
|
@@ -190,9 +191,10 @@ export function buildPages(rawPages: Array<object>, entryId: string, noteName: s
|
|
|
190
191
|
* a picture's address to the role its asset declares, so a figure page's
|
|
191
192
|
* name reads `Map 1` rather than `Figure 1` where it is due — see
|
|
192
193
|
* {@link module:engine/content-figures.scanFigures}.
|
|
194
|
+
* @param {import("./content-session.mjs").ContentSyntax} [params.syntax] - Session scanner projections.
|
|
193
195
|
* @returns {object} The JournalEntry document, keyed for the pack.
|
|
194
196
|
*/
|
|
195
|
-
export function buildJournalEntry({ id, name, markdown, leadName, folder, stats, infoboxes, notice, resolveRole, }: {
|
|
197
|
+
export function buildJournalEntry({ id, name, markdown, leadName, folder, stats, infoboxes, notice, resolveRole, syntax, }: {
|
|
196
198
|
id: string;
|
|
197
199
|
name: string;
|
|
198
200
|
markdown: string;
|
|
@@ -206,6 +208,7 @@ export function buildJournalEntry({ id, name, markdown, leadName, folder, stats,
|
|
|
206
208
|
}[] | undefined;
|
|
207
209
|
notice?: string | undefined;
|
|
208
210
|
resolveRole?: ((address: string) => string | undefined) | undefined;
|
|
211
|
+
syntax?: import("./content-session.mjs").ContentSyntax | undefined;
|
|
209
212
|
}): object;
|
|
210
213
|
/**
|
|
211
214
|
* Journals pack compiler.
|
|
@@ -35,15 +35,16 @@ export function lexicalSectionsFor(records: object[], all?: object[]): Map<strin
|
|
|
35
35
|
*
|
|
36
36
|
* @param {string} markdown - The body with authored directives expanded.
|
|
37
37
|
* @param {LexicalSection[]} [sections=[]] - From {@link lexicalSectionsFor}.
|
|
38
|
-
* @param {{authored?: string, lineMap?: object[], generatedFrom?: number}} [context] -
|
|
38
|
+
* @param {{authored?: string, lineMap?: object[], generatedFrom?: number, syntax?: import("./content-session.mjs").ContentSyntax}} [context] -
|
|
39
39
|
* The original authored body, source mappings and the start of appended
|
|
40
40
|
* nonlexical generated sections. Without `authored`, `markdown` is the source.
|
|
41
41
|
* @returns {{markdown: string, lineMap: object[], generatedFrom?: number}}
|
|
42
42
|
*/
|
|
43
|
-
export function insertLexicalSections(markdown: string, sections?: LexicalSection[], { authored, lineMap, generatedFrom }?: {
|
|
43
|
+
export function insertLexicalSections(markdown: string, sections?: LexicalSection[], { authored, lineMap, generatedFrom, syntax }?: {
|
|
44
44
|
authored?: string;
|
|
45
45
|
lineMap?: object[];
|
|
46
46
|
generatedFrom?: number;
|
|
47
|
+
syntax?: import("./content-session.mjs").ContentSyntax;
|
|
47
48
|
}): {
|
|
48
49
|
markdown: string;
|
|
49
50
|
lineMap: object[];
|
|
@@ -3,9 +3,10 @@
|
|
|
3
3
|
* Frontmatter is masked so literal YAML values cannot become body markup.
|
|
4
4
|
* @param {string} source - Complete Markdown source, optionally with frontmatter.
|
|
5
5
|
* @param {string} file - Diagnostic filename.
|
|
6
|
+
* @param {import("./content-session.mjs").ContentSyntax} [syntax] - Exact-text scanner projections.
|
|
6
7
|
* @returns {Array<{file: string, line: number, column: number, severity: string, message: string}>} Syntax errors.
|
|
7
8
|
*/
|
|
8
|
-
export function markupFindings(source: string, file: string): Array<{
|
|
9
|
+
export function markupFindings(source: string, file: string, syntax?: import("./content-session.mjs").ContentSyntax): Array<{
|
|
9
10
|
file: string;
|
|
10
11
|
line: number;
|
|
11
12
|
column: number;
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
/** Pure projections of parsed inline text and original marked-name positions. */
|
|
2
|
+
/**
|
|
3
|
+
* An original source range with its opening file position.
|
|
4
|
+
* @typedef {object} SpanSourceSite
|
|
5
|
+
* @property {number} start - Inclusive UTF-16 source offset.
|
|
6
|
+
* @property {number} end - Exclusive UTF-16 source offset.
|
|
7
|
+
* @property {number} line - Original 1-based source line.
|
|
8
|
+
* @property {number} column - Original 1-based UTF-16 source column.
|
|
9
|
+
*/
|
|
10
|
+
/**
|
|
11
|
+
* The retained attribute key and value at their authored positions.
|
|
12
|
+
* @typedef {object} SpanAttributePosition
|
|
13
|
+
* @property {SpanSourceSite} key - Attribute name, without surrounding whitespace.
|
|
14
|
+
* @property {SpanSourceSite} value - Authored value, without its surrounding quotes.
|
|
15
|
+
*/
|
|
16
|
+
/**
|
|
17
|
+
* One actual bracketed span and its renderer-derived visible text.
|
|
18
|
+
* @typedef {object} ContentSpan
|
|
19
|
+
* @property {string} id - Normalized anchor, or an empty string.
|
|
20
|
+
* @property {number} start - Inclusive UTF-16 offset of the opening bracket.
|
|
21
|
+
* @property {number} end - Exclusive UTF-16 offset after the complete span.
|
|
22
|
+
* @property {number} line - Original 1-based line of the opening bracket.
|
|
23
|
+
* @property {number} column - Original 1-based UTF-16 column of the bracket.
|
|
24
|
+
* @property {string} text - Inline label source passed to the existing parser.
|
|
25
|
+
* @property {number} contentEnd - Original UTF-16 offset of the closing label bracket.
|
|
26
|
+
* @property {string} visible - Visible text from the actual parsed children.
|
|
27
|
+
* @property {ReadonlyArray<readonly [string, string]>} attrs - Retained permitted HTML attributes.
|
|
28
|
+
* @property {Record<string, SpanAttributePosition>} attributePositions - Authored key/value sites by retained attribute name.
|
|
29
|
+
*/
|
|
30
|
+
/**
|
|
31
|
+
* One located span-grammar or refused-attribute finding.
|
|
32
|
+
* @typedef {object} SpanFinding
|
|
33
|
+
* @property {number} line - Original 1-based source line.
|
|
34
|
+
* @property {number} column - Original 1-based UTF-16 source column.
|
|
35
|
+
* @property {string} message - The existing grammar or attribute diagnostic.
|
|
36
|
+
*/
|
|
37
|
+
/**
|
|
38
|
+
* A captured authored span inventory.
|
|
39
|
+
* @typedef {object} SpanScan
|
|
40
|
+
* @property {ContentSpan[]} spans - All actual parsed bracketed spans in source order.
|
|
41
|
+
* @property {ContentSpan[]} names - The same span objects carrying the exact name class.
|
|
42
|
+
* @property {SpanFinding[]} errors - Located diagnostics in source order.
|
|
43
|
+
*/
|
|
44
|
+
/**
|
|
45
|
+
* Visible name text from the renderer's actual parsed children. Footnote
|
|
46
|
+
* markers and images supply no name text; references have already resolved.
|
|
47
|
+
* @param {readonly object[]} tokens - Parsed inline tokens.
|
|
48
|
+
* @returns {string} Text without inline formatting or annotation markers.
|
|
49
|
+
*/
|
|
50
|
+
export function inlineText(tokens: readonly object[]): string;
|
|
51
|
+
/**
|
|
52
|
+
* Rebase an authored body's captured names to its original raw file.
|
|
53
|
+
* The inventory is read only; no source parsing or second marker scan occurs.
|
|
54
|
+
* @template {ContentSpan} Span
|
|
55
|
+
* @param {readonly Span[]} spans - The captured body's name spans.
|
|
56
|
+
* @param {{raw: string, bodyLine?: number, bodyColumn?: number}} source - Original body origin.
|
|
57
|
+
* @returns {Span[]} Copies retaining the span metadata with raw offsets and file coordinates.
|
|
58
|
+
*/
|
|
59
|
+
export function rebaseNameSpans<Span extends ContentSpan>(spans: readonly Span[], { raw, bodyLine, bodyColumn }: {
|
|
60
|
+
raw: string;
|
|
61
|
+
bodyLine?: number;
|
|
62
|
+
bodyColumn?: number;
|
|
63
|
+
}): Span[];
|
|
64
|
+
/**
|
|
65
|
+
* An original source range with its opening file position.
|
|
66
|
+
*/
|
|
67
|
+
export type SpanSourceSite = {
|
|
68
|
+
/**
|
|
69
|
+
* - Inclusive UTF-16 source offset.
|
|
70
|
+
*/
|
|
71
|
+
start: number;
|
|
72
|
+
/**
|
|
73
|
+
* - Exclusive UTF-16 source offset.
|
|
74
|
+
*/
|
|
75
|
+
end: number;
|
|
76
|
+
/**
|
|
77
|
+
* - Original 1-based source line.
|
|
78
|
+
*/
|
|
79
|
+
line: number;
|
|
80
|
+
/**
|
|
81
|
+
* - Original 1-based UTF-16 source column.
|
|
82
|
+
*/
|
|
83
|
+
column: number;
|
|
84
|
+
};
|
|
85
|
+
/**
|
|
86
|
+
* The retained attribute key and value at their authored positions.
|
|
87
|
+
*/
|
|
88
|
+
export type SpanAttributePosition = {
|
|
89
|
+
/**
|
|
90
|
+
* - Attribute name, without surrounding whitespace.
|
|
91
|
+
*/
|
|
92
|
+
key: SpanSourceSite;
|
|
93
|
+
/**
|
|
94
|
+
* - Authored value, without its surrounding quotes.
|
|
95
|
+
*/
|
|
96
|
+
value: SpanSourceSite;
|
|
97
|
+
};
|
|
98
|
+
/**
|
|
99
|
+
* One actual bracketed span and its renderer-derived visible text.
|
|
100
|
+
*/
|
|
101
|
+
export type ContentSpan = {
|
|
102
|
+
/**
|
|
103
|
+
* - Normalized anchor, or an empty string.
|
|
104
|
+
*/
|
|
105
|
+
id: string;
|
|
106
|
+
/**
|
|
107
|
+
* - Inclusive UTF-16 offset of the opening bracket.
|
|
108
|
+
*/
|
|
109
|
+
start: number;
|
|
110
|
+
/**
|
|
111
|
+
* - Exclusive UTF-16 offset after the complete span.
|
|
112
|
+
*/
|
|
113
|
+
end: number;
|
|
114
|
+
/**
|
|
115
|
+
* - Original 1-based line of the opening bracket.
|
|
116
|
+
*/
|
|
117
|
+
line: number;
|
|
118
|
+
/**
|
|
119
|
+
* - Original 1-based UTF-16 column of the bracket.
|
|
120
|
+
*/
|
|
121
|
+
column: number;
|
|
122
|
+
/**
|
|
123
|
+
* - Inline label source passed to the existing parser.
|
|
124
|
+
*/
|
|
125
|
+
text: string;
|
|
126
|
+
/**
|
|
127
|
+
* - Original UTF-16 offset of the closing label bracket.
|
|
128
|
+
*/
|
|
129
|
+
contentEnd: number;
|
|
130
|
+
/**
|
|
131
|
+
* - Visible text from the actual parsed children.
|
|
132
|
+
*/
|
|
133
|
+
visible: string;
|
|
134
|
+
/**
|
|
135
|
+
* - Retained permitted HTML attributes.
|
|
136
|
+
*/
|
|
137
|
+
attrs: ReadonlyArray<readonly [string, string]>;
|
|
138
|
+
/**
|
|
139
|
+
* - Authored key/value sites by retained attribute name.
|
|
140
|
+
*/
|
|
141
|
+
attributePositions: Record<string, SpanAttributePosition>;
|
|
142
|
+
};
|
|
143
|
+
/**
|
|
144
|
+
* One located span-grammar or refused-attribute finding.
|
|
145
|
+
*/
|
|
146
|
+
export type SpanFinding = {
|
|
147
|
+
/**
|
|
148
|
+
* - Original 1-based source line.
|
|
149
|
+
*/
|
|
150
|
+
line: number;
|
|
151
|
+
/**
|
|
152
|
+
* - Original 1-based UTF-16 source column.
|
|
153
|
+
*/
|
|
154
|
+
column: number;
|
|
155
|
+
/**
|
|
156
|
+
* - The existing grammar or attribute diagnostic.
|
|
157
|
+
*/
|
|
158
|
+
message: string;
|
|
159
|
+
};
|
|
160
|
+
/**
|
|
161
|
+
* A captured authored span inventory.
|
|
162
|
+
*/
|
|
163
|
+
export type SpanScan = {
|
|
164
|
+
/**
|
|
165
|
+
* - All actual parsed bracketed spans in source order.
|
|
166
|
+
*/
|
|
167
|
+
spans: ContentSpan[];
|
|
168
|
+
/**
|
|
169
|
+
* - The same span objects carrying the exact name class.
|
|
170
|
+
*/
|
|
171
|
+
names: ContentSpan[];
|
|
172
|
+
/**
|
|
173
|
+
* - Located diagnostics in source order.
|
|
174
|
+
*/
|
|
175
|
+
errors: SpanFinding[];
|
|
176
|
+
};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Project captured occurrences without reading sources or changing records.
|
|
3
|
+
* @param {Iterable<Record<string, any>>} records - Index records, already narrowed
|
|
4
|
+
* to the audience; canonical Addresses may be typed or encoded strings.
|
|
5
|
+
* @returns {NameRow[]} One row per occurrence, in record then source order.
|
|
6
|
+
*/
|
|
7
|
+
export function namesRows(records: Iterable<Record<string, any>>): NameRow[];
|
|
8
|
+
/** Every column of the `names` relation, in order. */
|
|
9
|
+
export const NAME_COLUMNS: readonly string[];
|
|
10
|
+
export type NameRow = {
|
|
11
|
+
/**
|
|
12
|
+
* - Containing authored page's canonical NOTE Address.
|
|
13
|
+
*/
|
|
14
|
+
owner: string | null;
|
|
15
|
+
/**
|
|
16
|
+
* - Rendered visible text of the occurrence.
|
|
17
|
+
*/
|
|
18
|
+
name: string;
|
|
19
|
+
/**
|
|
20
|
+
* - Supplied note type, or null.
|
|
21
|
+
*/
|
|
22
|
+
type: string | null;
|
|
23
|
+
/**
|
|
24
|
+
* - Supplied subtype, or null.
|
|
25
|
+
*/
|
|
26
|
+
subType: string | null;
|
|
27
|
+
/**
|
|
28
|
+
* - Original 1-based source line at the opening bracket.
|
|
29
|
+
*/
|
|
30
|
+
line: number;
|
|
31
|
+
/**
|
|
32
|
+
* - Original 1-based UTF-16 source column at that bracket.
|
|
33
|
+
*/
|
|
34
|
+
column: number;
|
|
35
|
+
};
|