@heroiclands/package-build 23.12.5 → 23.12.7
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 +22 -0
- package/assets/styles/content-base.css +25 -0
- package/bin/content-commands.mjs +264 -3
- package/bin/package-build.mjs +25 -0
- package/content-config.mjs +98 -0
- package/docs/api.md +18 -14
- package/docs/authoring/dates-and-calendars.md +29 -1
- package/docs/authoring/links-and-markup.md +442 -50
- package/docs/commands.md +127 -0
- package/docs/configuration.md +90 -3
- package/docs/content-format.md +3 -1
- package/docs/guides/book.md +11 -0
- package/docs/guides/module-project.md +17 -1
- package/docs/guides/site.md +19 -0
- package/docs/reference/format-details.md +434 -23
- package/docs/reference/note-types.md +45 -21
- package/engine/base-compiler.mjs +2 -0
- package/engine/bundles.mjs +7 -2
- package/engine/compile-corpus.mjs +3 -1
- package/engine/content-charset.mjs +21 -2
- package/engine/content-format.yaml +1 -2
- package/engine/content-index.mjs +33 -2
- package/engine/content-links.mjs +3 -0
- package/engine/content-poetry.mjs +22 -4
- package/engine/content-scripts.mjs +1219 -0
- package/engine/content-session.mjs +2 -0
- package/engine/data-keys.mjs +5 -1
- package/engine/dictionary-layout.mjs +18 -12
- package/engine/dictionary-rows.mjs +11 -2
- package/engine/event-rows.mjs +63 -18
- package/engine/event-views.mjs +28 -15
- package/engine/helpers.mjs +8 -2
- package/engine/index-records.mjs +2 -0
- package/engine/infobox.mjs +4 -8
- package/engine/journals.mjs +14 -3
- package/engine/language-data.mjs +137 -1
- package/engine/language-tag.mjs +103 -0
- package/engine/language-terms.mjs +16 -4
- package/engine/map-lexicon.mjs +762 -0
- package/engine/markdown-expressions.mjs +72 -17
- package/engine/markup-validation.mjs +17 -3
- package/engine/names.mjs +1 -1
- package/engine/note-calendars.mjs +314 -0
- package/engine/note-vocabulary.mjs +124 -16
- package/engine/pdf-build.mjs +28 -10
- package/engine/pdf-render.mjs +116 -11
- package/engine/reckoning-markers.mjs +63 -3
- package/engine/run-rows.mjs +119 -0
- package/engine/run-words.mjs +266 -0
- package/engine/scenes.mjs +1 -0
- package/engine/script-font-delivery.mjs +321 -0
- package/engine/script-fonts.mjs +172 -0
- package/engine/site-build.mjs +10 -3
- package/engine/site-config.mjs +5 -0
- package/engine/site-root.mjs +19 -5
- package/engine/sql-tables.mjs +120 -4
- package/engine/text-maps.mjs +607 -0
- package/engine/verb-pattern.mjs +99 -0
- package/engine/word-pattern.mjs +27 -0
- package/engine/word-rows.mjs +8 -2
- package/engine/word-terms.mjs +44 -0
- package/hugo-theme/layouts/_default/baseof.html +3 -0
- package/hugo-theme/static/css/style.css +10 -0
- package/manifest.mjs +9 -1
- package/package.json +1 -1
- package/types/content-config.d.mts +38 -0
- package/types/engine/compile-corpus.d.mts +2 -1
- package/types/engine/content-index.d.mts +17 -3
- package/types/engine/content-poetry.d.mts +7 -0
- package/types/engine/content-scripts.d.mts +226 -0
- package/types/engine/data-keys.d.mts +2 -2
- package/types/engine/dictionary-rows.d.mts +15 -0
- package/types/engine/event-rows.d.mts +16 -1
- package/types/engine/event-views.d.mts +2 -1
- package/types/engine/helpers.d.mts +5 -1
- package/types/engine/journals.d.mts +7 -2
- package/types/engine/language-data.d.mts +2 -0
- package/types/engine/language-tag.d.mts +8 -0
- package/types/engine/language-terms.d.mts +2 -1
- package/types/engine/map-lexicon.d.mts +274 -0
- package/types/engine/markup-validation.d.mts +7 -2
- package/types/engine/note-calendars.d.mts +60 -0
- package/types/engine/pdf-build.d.mts +26 -3
- package/types/engine/pdf-render.d.mts +17 -2
- package/types/engine/reckoning-markers.d.mts +32 -1
- package/types/engine/run-rows.d.mts +89 -0
- package/types/engine/run-words.d.mts +86 -0
- package/types/engine/script-font-delivery.d.mts +134 -0
- package/types/engine/script-fonts.d.mts +168 -0
- package/types/engine/site-build.d.mts +2 -1
- package/types/engine/site-root.d.mts +11 -3
- package/types/engine/text-maps.d.mts +175 -0
- package/types/engine/verb-pattern.d.mts +65 -0
- package/types/engine/word-pattern.d.mts +13 -0
- package/types/engine/word-terms.d.mts +6 -0
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* @property {string} name - The key as an author writes it.
|
|
6
6
|
* @property {string} [kind] - Its value's shape: `string`, `date`, `number`,
|
|
7
7
|
* `integer`, `boolean`, `address`, `list`, `map`, `scalar-or-map`,
|
|
8
|
-
* `string-or-list`,
|
|
8
|
+
* `string-or-list`, `string-list-or-map` or `list-or-map` — see {@link fitsKind}. Absent, the check
|
|
9
9
|
* makes no claim about the value.
|
|
10
10
|
* @property {readonly string[]} [allowed] - The closed set a present value is
|
|
11
11
|
* one of, where the key takes a fixed word.
|
|
@@ -97,7 +97,7 @@ export type InnerKeySpec = {
|
|
|
97
97
|
/**
|
|
98
98
|
* - Its value's shape: `string`, `date`, `number`,
|
|
99
99
|
* `integer`, `boolean`, `address`, `list`, `map`, `scalar-or-map`,
|
|
100
|
-
* `string-or-list`,
|
|
100
|
+
* `string-or-list`, `string-list-or-map` or `list-or-map` — see {@link fitsKind}. Absent, the check
|
|
101
101
|
* makes no claim about the value.
|
|
102
102
|
*/
|
|
103
103
|
kind?: string | undefined;
|
|
@@ -1,3 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A noun's stated plural, or the first literal ending replacement that fits.
|
|
3
|
+
*
|
|
4
|
+
* @param {{form: string, class?: unknown, plural?: unknown}} word - A word of
|
|
5
|
+
* `data.words`.
|
|
6
|
+
* @param {Record<string, any>|undefined} grammar - Its language's
|
|
7
|
+
* `data.grammar`.
|
|
8
|
+
* @returns {string|null} The plural, or `null` for a word that is no noun or
|
|
9
|
+
* that no rule fits.
|
|
10
|
+
*/
|
|
11
|
+
export function pluralOf(word: {
|
|
12
|
+
form: string;
|
|
13
|
+
class?: unknown;
|
|
14
|
+
plural?: unknown;
|
|
15
|
+
}, grammar: Record<string, any> | undefined): string | null;
|
|
1
16
|
/**
|
|
2
17
|
* The stable prose anchor of a word in one language's dictionary. The exact
|
|
3
18
|
* language and NFC form identify it, including case and accents.
|
|
@@ -1,15 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Every calendar a set of records can print an event's date in: each calendar
|
|
3
|
+
* note's canonical Address, and every calendar a note resolves to.
|
|
4
|
+
*
|
|
5
|
+
* @param {Iterable<Record<string, any>>} records - Index records, every
|
|
6
|
+
* Address a string.
|
|
7
|
+
* @returns {string[]} The calendars, sorted.
|
|
8
|
+
*/
|
|
9
|
+
export function eventCalendars(records: Iterable<Record<string, any>>): string[];
|
|
1
10
|
/**
|
|
2
11
|
* The `events` rows of a set of index records.
|
|
3
12
|
*
|
|
4
13
|
* @param {Iterable<Record<string, any>>} records - Index records, every
|
|
5
14
|
* Address a string, already narrowed to the audience being published to.
|
|
6
15
|
* @param {object} [dates] - The reckoning context the dates are printed in.
|
|
16
|
+
* @param {readonly string[]} [calendars] - The calendars `whenIn` and
|
|
17
|
+
* `untilIn` are keyed by: {@link eventCalendars} of every record of the
|
|
18
|
+
* corpus, whatever the audience, so every surface's relation has the same
|
|
19
|
+
* keys. Absent, those of `records`.
|
|
7
20
|
* @returns {object[]} One row per event entry, in record then entry order.
|
|
8
21
|
*/
|
|
9
|
-
export function eventRows(records: Iterable<Record<string, any>>, dates?: object): object[];
|
|
22
|
+
export function eventRows(records: Iterable<Record<string, any>>, dates?: object, calendars?: readonly string[]): object[];
|
|
10
23
|
/** The sort keys a row carries, after the event's own keys. */
|
|
11
24
|
export const EVENT_SORT_COLUMNS: readonly string[];
|
|
12
25
|
/** The printed dates a row carries, after the sort keys. */
|
|
13
26
|
export const EVENT_TEXT_COLUMNS: readonly string[];
|
|
27
|
+
/** The dates a row carries in every calendar, after the printed ones. */
|
|
28
|
+
export const EVENT_CALENDAR_COLUMNS: readonly string[];
|
|
14
29
|
/** Every column of the `events` relation, in order. */
|
|
15
30
|
export const EVENT_COLUMNS: any;
|
|
@@ -34,7 +34,7 @@ export function eventViewSections(db: object, records: Iterable<object>, fileOf:
|
|
|
34
34
|
*
|
|
35
35
|
* @type {ReadonlyArray<Readonly<{slug: string, heading: string,
|
|
36
36
|
* applies: (record: object) => boolean,
|
|
37
|
-
* query: (self: string[], shape: CorpusShape, columns?: {felt?: boolean}) => {fence: string, own?: string}|null,
|
|
37
|
+
* query: (self: string[], shape: CorpusShape, columns?: {felt?: boolean, calendar?: string}) => {fence: string, own?: string}|null,
|
|
38
38
|
* owners?: (db: object, selves: string[][], shape: CorpusShape) => Promise<Set<string>>,
|
|
39
39
|
* felt?: (db: object, selves: string[][], shape: CorpusShape) => Promise<Set<string>>}>>}
|
|
40
40
|
*/
|
|
@@ -44,6 +44,7 @@ export const EVENT_VIEWS: ReadonlyArray<Readonly<{
|
|
|
44
44
|
applies: (record: object) => boolean;
|
|
45
45
|
query: (self: string[], shape: CorpusShape, columns?: {
|
|
46
46
|
felt?: boolean;
|
|
47
|
+
calendar?: string;
|
|
47
48
|
}) => {
|
|
48
49
|
fence: string;
|
|
49
50
|
own?: string;
|
|
@@ -10,12 +10,16 @@
|
|
|
10
10
|
* @param {(address: string) => string|undefined} [resolveRole] - From a
|
|
11
11
|
* picture's address to the role its asset declares — see
|
|
12
12
|
* {@link module:engine/content-figures.scanFigures}.
|
|
13
|
+
* @param {import("./content-scripts.mjs").RunContext} [runs] - The package's
|
|
14
|
+
* languages, faces and maps. Given, text marked with `lang=`, `font=` and
|
|
15
|
+
* `map=` is rewritten first, so it is tagged for its language, mapped and
|
|
16
|
+
* set in its font.
|
|
13
17
|
* @returns {string} The rendered HTML.
|
|
14
18
|
*/
|
|
15
19
|
export function renderFoundryMarkdown(body: string, figures?: Array<{
|
|
16
20
|
id: string;
|
|
17
21
|
label: string;
|
|
18
|
-
}>, footnoteNumbers?: Map<string, number>, docId?: string, resolveRole?: (address: string) => string | undefined): string;
|
|
22
|
+
}>, footnoteNumbers?: Map<string, number>, docId?: string, resolveRole?: (address: string) => string | undefined, runs?: import("./content-scripts.mjs").RunContext): string;
|
|
19
23
|
/**
|
|
20
24
|
* Parses a markdown file with LF or CRLF YAML frontmatter delimiters.
|
|
21
25
|
*
|
|
@@ -134,13 +134,15 @@ export function journalPageId(entryId: string, page: {
|
|
|
134
134
|
* carries its own figure already, from {@link splitPages}.
|
|
135
135
|
* @param {(address: string) => string|undefined} [resolveRole] - See
|
|
136
136
|
* {@link splitPages}.
|
|
137
|
+
* @param {import("./content-scripts.mjs").RunContext} [runs] - The package's
|
|
138
|
+
* languages, faces and maps — see {@link module:engine/helpers.renderFoundryMarkdown}.
|
|
137
139
|
* @returns {Array<{_id: string, name: string, type: string,
|
|
138
140
|
* title: {show: boolean, level: number},
|
|
139
141
|
* text: {format: number, content: string}, _key: string,
|
|
140
142
|
* ownership?: {default: number}}>} The page documents, in order.
|
|
141
143
|
* @throws {Error} When the note has no content at all, or repeats an anchor.
|
|
142
144
|
*/
|
|
143
|
-
export function buildPages(rawPages: Array<object>, entryId: string, noteName: string, figures: Array<object>, resolveRole?: (address: string) => string | undefined): Array<{
|
|
145
|
+
export function buildPages(rawPages: Array<object>, entryId: string, noteName: string, figures: Array<object>, resolveRole?: (address: string) => string | undefined, runs?: import("./content-scripts.mjs").RunContext): Array<{
|
|
144
146
|
_id: string;
|
|
145
147
|
name: string;
|
|
146
148
|
type: string;
|
|
@@ -192,9 +194,11 @@ export function buildPages(rawPages: Array<object>, entryId: string, noteName: s
|
|
|
192
194
|
* name reads `Map 1` rather than `Figure 1` where it is due — see
|
|
193
195
|
* {@link module:engine/content-figures.scanFigures}.
|
|
194
196
|
* @param {import("./content-session.mjs").ContentSyntax} [params.syntax] - Session scanner projections.
|
|
197
|
+
* @param {import("./content-scripts.mjs").RunContext} [params.runs] - The package's
|
|
198
|
+
* languages, faces and maps — see {@link module:engine/helpers.renderFoundryMarkdown}.
|
|
195
199
|
* @returns {object} The JournalEntry document, keyed for the pack.
|
|
196
200
|
*/
|
|
197
|
-
export function buildJournalEntry({ id, name, markdown, leadName, folder, stats, infoboxes, notice, resolveRole, syntax, }: {
|
|
201
|
+
export function buildJournalEntry({ id, name, markdown, leadName, folder, stats, infoboxes, notice, resolveRole, syntax, runs, }: {
|
|
198
202
|
id: string;
|
|
199
203
|
name: string;
|
|
200
204
|
markdown: string;
|
|
@@ -209,6 +213,7 @@ export function buildJournalEntry({ id, name, markdown, leadName, folder, stats,
|
|
|
209
213
|
notice?: string | undefined;
|
|
210
214
|
resolveRole?: ((address: string) => string | undefined) | undefined;
|
|
211
215
|
syntax?: import("./content-session.mjs").ContentSyntax | undefined;
|
|
216
|
+
runs?: import("./content-scripts.mjs").RunContext | undefined;
|
|
212
217
|
}): object;
|
|
213
218
|
/**
|
|
214
219
|
* Journals pack compiler.
|
|
@@ -20,3 +20,5 @@ export function checkLanguageData(note: object, { index, types }?: {
|
|
|
20
20
|
index?: object | undefined;
|
|
21
21
|
types?: readonly string[] | undefined;
|
|
22
22
|
}): object[];
|
|
23
|
+
/** How a foreign row that its tongue's register does not bear out is reported. */
|
|
24
|
+
export const FOREIGN_ROW_SEVERITY: "warning";
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Whether a value is a BCP 47 language tag.
|
|
3
|
+
*
|
|
4
|
+
* @param {unknown} value - The value to test.
|
|
5
|
+
* @returns {boolean} Whether it is a well-formed tag with no repeated variant
|
|
6
|
+
* or extension singleton.
|
|
7
|
+
*/
|
|
8
|
+
export function isLanguageTag(value: unknown): boolean;
|
|
@@ -321,7 +321,8 @@ export const NEAR_NAME_FIELDS: readonly import("./data-keys.mjs").InnerKeySpec[]
|
|
|
321
321
|
export const NAMING_FIELDS: readonly import("./data-keys.mjs").InnerKeySpec[];
|
|
322
322
|
/**
|
|
323
323
|
* The six present persons of the one optional regular verb pattern, in
|
|
324
|
-
* presentation order.
|
|
324
|
+
* presentation order. Each ending is added to the citation form, or takes the
|
|
325
|
+
* place of its closing `replaces`; an empty ending adds nothing.
|
|
325
326
|
*
|
|
326
327
|
* @type {readonly import("./data-keys.mjs").InnerKeySpec[]}
|
|
327
328
|
*/
|
|
@@ -0,0 +1,274 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Each configured language's lexicon, read from the language note its `note`
|
|
3
|
+
* names. A language with no `note`, or one naming no language note, has none.
|
|
4
|
+
*
|
|
5
|
+
* @param {Iterable<Record<string, any>>|undefined} records - Index records.
|
|
6
|
+
* @param {{languages?: Readonly<Record<string, {tag: string, note?: string}>>, contentPackage?: string}} config -
|
|
7
|
+
* The resolved configuration.
|
|
8
|
+
* @returns {Map<string, Lexicon>} The lexicons by language name.
|
|
9
|
+
*/
|
|
10
|
+
export function lexiconsFromRecords(records: Iterable<Record<string, any>> | undefined, config?: {
|
|
11
|
+
languages?: Readonly<Record<string, {
|
|
12
|
+
tag: string;
|
|
13
|
+
note?: string;
|
|
14
|
+
}>>;
|
|
15
|
+
contentPackage?: string;
|
|
16
|
+
}): Map<string, Lexicon>;
|
|
17
|
+
/**
|
|
18
|
+
* The language note each configured language's `note` names, by language
|
|
19
|
+
* name. A language with no `note`, or one naming no language note, is absent.
|
|
20
|
+
*
|
|
21
|
+
* @param {Iterable<Record<string, any>>|undefined} records - Index records.
|
|
22
|
+
* @param {{languages?: Readonly<Record<string, {tag: string, note?: string}>>, contentPackage?: string}} config -
|
|
23
|
+
* The resolved configuration.
|
|
24
|
+
* @returns {Map<string, Record<string, any>>} The records.
|
|
25
|
+
*/
|
|
26
|
+
export function languageRecordsByName(records: Iterable<Record<string, any>> | undefined, { languages, contentPackage }?: {
|
|
27
|
+
languages?: Readonly<Record<string, {
|
|
28
|
+
tag: string;
|
|
29
|
+
note?: string;
|
|
30
|
+
}>>;
|
|
31
|
+
contentPackage?: string;
|
|
32
|
+
}): Map<string, Record<string, any>>;
|
|
33
|
+
/**
|
|
34
|
+
* Each `languages.<name>.note` that names no language note, at its key.
|
|
35
|
+
*
|
|
36
|
+
* @param {{languages?: Readonly<Record<string, {tag: string, note?: string}>>, contentPackage?: string, configFile?: string, configText?: string}} config -
|
|
37
|
+
* The resolved configuration, and where it was read from.
|
|
38
|
+
* @param {Iterable<Record<string, any>>} records - Index records.
|
|
39
|
+
* @returns {object[]} The findings.
|
|
40
|
+
*/
|
|
41
|
+
export function languageNoteFindings(config: {
|
|
42
|
+
languages?: Readonly<Record<string, {
|
|
43
|
+
tag: string;
|
|
44
|
+
note?: string;
|
|
45
|
+
}>>;
|
|
46
|
+
contentPackage?: string;
|
|
47
|
+
configFile?: string;
|
|
48
|
+
configText?: string;
|
|
49
|
+
}, records: Iterable<Record<string, any>>): object[];
|
|
50
|
+
/**
|
|
51
|
+
* A lookup of a word's native form under one map in one face: the form stated
|
|
52
|
+
* for the face, else the one stated for no face.
|
|
53
|
+
*
|
|
54
|
+
* @param {Lexicon|undefined} lexicon - The lexicon.
|
|
55
|
+
* @param {string} map - The map's name.
|
|
56
|
+
* @param {string|undefined} font - The face.
|
|
57
|
+
* @returns {((word: string) => string|undefined)|undefined} The lookup, or
|
|
58
|
+
* `undefined` with no lexicon.
|
|
59
|
+
*/
|
|
60
|
+
export function nativeLookup(lexicon: Lexicon | undefined, map: string, font: string | undefined): ((word: string) => string | undefined) | undefined;
|
|
61
|
+
/**
|
|
62
|
+
* What a run, a passage or a listing is mapped by.
|
|
63
|
+
*
|
|
64
|
+
* @typedef {object} Mapping
|
|
65
|
+
* @property {import("./text-maps.mjs").TextMap} map - The map.
|
|
66
|
+
* @property {string|undefined} font - The face, whose own rows come first.
|
|
67
|
+
* @property {((word: string) => string|undefined)|undefined} native - The
|
|
68
|
+
* language's native forms under the map in the face.
|
|
69
|
+
*/
|
|
70
|
+
/**
|
|
71
|
+
* The one path from a map, a face and a language to what rewrites the text.
|
|
72
|
+
*
|
|
73
|
+
* @param {{maps?: ReadonlyMap<string, import("./text-maps.mjs").TextMap>, lexicons?: ReadonlyMap<string, Lexicon>}} ctx -
|
|
74
|
+
* The run context.
|
|
75
|
+
* @param {{map: string, font?: string, lang?: string}} keys - The map, the face
|
|
76
|
+
* and the language.
|
|
77
|
+
* @returns {Mapping|undefined} The mapping, or `undefined` for an unknown map.
|
|
78
|
+
*/
|
|
79
|
+
export function mappingFor(ctx: {
|
|
80
|
+
maps?: ReadonlyMap<string, import("./text-maps.mjs").TextMap>;
|
|
81
|
+
lexicons?: ReadonlyMap<string, Lexicon>;
|
|
82
|
+
}, { map, font, lang }: {
|
|
83
|
+
map: string;
|
|
84
|
+
font?: string;
|
|
85
|
+
lang?: string;
|
|
86
|
+
}): Mapping | undefined;
|
|
87
|
+
/**
|
|
88
|
+
* Why a face is not one a map is for, or `undefined` where it is.
|
|
89
|
+
*
|
|
90
|
+
* @param {import("./text-maps.mjs").TextMap} map - The map.
|
|
91
|
+
* @param {string} font - The face's slug.
|
|
92
|
+
* @returns {string|undefined} The problem.
|
|
93
|
+
*/
|
|
94
|
+
export function fontProblem(map: import("./text-maps.mjs").TextMap, font: string): string | undefined;
|
|
95
|
+
/**
|
|
96
|
+
* What is wrong with a capitalised word whose native form the rows cannot
|
|
97
|
+
* capitalise.
|
|
98
|
+
*
|
|
99
|
+
* @param {string} word - The word as written.
|
|
100
|
+
* @param {string} lower - The lowercase form the lexicon states.
|
|
101
|
+
* @param {string|undefined} lang - The language.
|
|
102
|
+
* @param {string} map - The map's name.
|
|
103
|
+
* @returns {string} The message.
|
|
104
|
+
*/
|
|
105
|
+
export function uncapitalisedMessage(word: string, lower: string, lang: string | undefined, map: string): string;
|
|
106
|
+
/**
|
|
107
|
+
* Map a passage exactly as the build maps a run with the same keys.
|
|
108
|
+
*
|
|
109
|
+
* @param {object} ctx - The run context.
|
|
110
|
+
* @param {{map: string, font?: string, lang?: string}} keys - The map, the face
|
|
111
|
+
* and the language.
|
|
112
|
+
* @param {string} text - The passage, with no escapes.
|
|
113
|
+
* @returns {{text: string}|{problem: string, about: string}} The mapped text, or the problem.
|
|
114
|
+
*/
|
|
115
|
+
export function transliterate(ctx: object, keys: {
|
|
116
|
+
map: string;
|
|
117
|
+
font?: string;
|
|
118
|
+
lang?: string;
|
|
119
|
+
}, text: string): {
|
|
120
|
+
text: string;
|
|
121
|
+
} | {
|
|
122
|
+
problem: string;
|
|
123
|
+
about: string;
|
|
124
|
+
};
|
|
125
|
+
/**
|
|
126
|
+
* Every word of a language's lexicon with its native form under a map: the
|
|
127
|
+
* stated exception, else the rows' spelling, each exactly as the build gives
|
|
128
|
+
* it.
|
|
129
|
+
*
|
|
130
|
+
* @param {object} ctx - The run context.
|
|
131
|
+
* @param {{lang: string, map: string, font?: string}} keys - The language, the
|
|
132
|
+
* map and the face.
|
|
133
|
+
* @returns {{entries: Array<{form: string, native: string, exception: boolean, class: string|null, gloss: string|null}>}|{problem: string, about: string}}
|
|
134
|
+
* The words in `data.words` order, or the problem.
|
|
135
|
+
*/
|
|
136
|
+
export function lexiconEntries(ctx: object, { lang, map, font }: {
|
|
137
|
+
lang: string;
|
|
138
|
+
map: string;
|
|
139
|
+
font?: string;
|
|
140
|
+
}): {
|
|
141
|
+
entries: Array<{
|
|
142
|
+
form: string;
|
|
143
|
+
native: string;
|
|
144
|
+
exception: boolean;
|
|
145
|
+
class: string | null;
|
|
146
|
+
gloss: string | null;
|
|
147
|
+
}>;
|
|
148
|
+
} | {
|
|
149
|
+
problem: string;
|
|
150
|
+
about: string;
|
|
151
|
+
};
|
|
152
|
+
/**
|
|
153
|
+
* Check a mapping note's `fonts` against the installed faces: an unknown face
|
|
154
|
+
* and a face listed twice, at the entry, and each code point a listed face
|
|
155
|
+
* lacks, at the row that writes it.
|
|
156
|
+
*
|
|
157
|
+
* @param {{file: string, raw?: string, fm?: Record<string, any>}} note - The note.
|
|
158
|
+
* @param {{faces?: ReadonlyMap<string, import("./script-fonts.mjs").Face>, maps?: ReadonlyMap<string, import("./text-maps.mjs").TextMap>}} ctx -
|
|
159
|
+
* The run context.
|
|
160
|
+
* @returns {object[]} The findings.
|
|
161
|
+
*/
|
|
162
|
+
export function checkMapFonts(note: {
|
|
163
|
+
file: string;
|
|
164
|
+
raw?: string;
|
|
165
|
+
fm?: Record<string, any>;
|
|
166
|
+
}, ctx: {
|
|
167
|
+
faces?: ReadonlyMap<string, import("./script-fonts.mjs").Face>;
|
|
168
|
+
maps?: ReadonlyMap<string, import("./text-maps.mjs").TextMap>;
|
|
169
|
+
}): object[];
|
|
170
|
+
/**
|
|
171
|
+
* Check a language note's native forms against the maps and faces: an unknown
|
|
172
|
+
* map, a face the map is not for, a second form for one map and face, a form
|
|
173
|
+
* that states what the rows already give, and a code point a face it applies
|
|
174
|
+
* in does not draw. The shape of each entry is the data-key check's.
|
|
175
|
+
*
|
|
176
|
+
* @param {{file: string, raw?: string, fm?: Record<string, any>}} note - The note.
|
|
177
|
+
* @param {{faces?: ReadonlyMap<string, import("./script-fonts.mjs").Face>, maps?: ReadonlyMap<string, import("./text-maps.mjs").TextMap>}} ctx -
|
|
178
|
+
* The run context.
|
|
179
|
+
* @returns {object[]} The findings.
|
|
180
|
+
*/
|
|
181
|
+
export function checkLexiconNatives(note: {
|
|
182
|
+
file: string;
|
|
183
|
+
raw?: string;
|
|
184
|
+
fm?: Record<string, any>;
|
|
185
|
+
}, ctx: {
|
|
186
|
+
faces?: ReadonlyMap<string, import("./script-fonts.mjs").Face>;
|
|
187
|
+
maps?: ReadonlyMap<string, import("./text-maps.mjs").TextMap>;
|
|
188
|
+
}): object[];
|
|
189
|
+
/**
|
|
190
|
+
* One row per native form of a language note's word, for the `natives`
|
|
191
|
+
* relation: a text is a value of a row, never a struct key, so forms that
|
|
192
|
+
* differ only in case stay apart.
|
|
193
|
+
*
|
|
194
|
+
* @param {Iterable<Record<string, any>>} records - Index records.
|
|
195
|
+
* @returns {Array<Record<string, string|number|null>>} The rows; `word` is the
|
|
196
|
+
* word's 0-based place in `data.words`, `native` the form's in its `native`.
|
|
197
|
+
*/
|
|
198
|
+
export function nativeRows(records: Iterable<Record<string, any>>): Array<Record<string, string | number | null>>;
|
|
199
|
+
/** Every column of the `natives` relation, in order. */
|
|
200
|
+
export const NATIVE_COLUMNS: readonly string[];
|
|
201
|
+
/**
|
|
202
|
+
* One native form, read.
|
|
203
|
+
*/
|
|
204
|
+
export type NativeForm = {
|
|
205
|
+
/**
|
|
206
|
+
* - The map it is written for.
|
|
207
|
+
*/
|
|
208
|
+
map: string;
|
|
209
|
+
/**
|
|
210
|
+
* - The one face it is for.
|
|
211
|
+
*/
|
|
212
|
+
font: string | undefined;
|
|
213
|
+
/**
|
|
214
|
+
* - The word in the script.
|
|
215
|
+
*/
|
|
216
|
+
text: string;
|
|
217
|
+
};
|
|
218
|
+
/**
|
|
219
|
+
* One word of a lexicon.
|
|
220
|
+
*/
|
|
221
|
+
export type LexiconWord = {
|
|
222
|
+
/**
|
|
223
|
+
* - The word as cited.
|
|
224
|
+
*/
|
|
225
|
+
form: string;
|
|
226
|
+
/**
|
|
227
|
+
* - Its class.
|
|
228
|
+
*/
|
|
229
|
+
class: string | null;
|
|
230
|
+
/**
|
|
231
|
+
* - Its senses, joined by `; `.
|
|
232
|
+
*/
|
|
233
|
+
gloss: string | null;
|
|
234
|
+
/**
|
|
235
|
+
* - Its native forms.
|
|
236
|
+
*/
|
|
237
|
+
natives: readonly NativeForm[];
|
|
238
|
+
};
|
|
239
|
+
/**
|
|
240
|
+
* A language's lexicon.
|
|
241
|
+
*/
|
|
242
|
+
export type Lexicon = {
|
|
243
|
+
/**
|
|
244
|
+
* - The language's configured name.
|
|
245
|
+
*/
|
|
246
|
+
language: string;
|
|
247
|
+
/**
|
|
248
|
+
* - Its words, in `data.words` order.
|
|
249
|
+
*/
|
|
250
|
+
words: readonly LexiconWord[];
|
|
251
|
+
/**
|
|
252
|
+
* - The native
|
|
253
|
+
* forms by the word's form, NFC; the first word of a form keeps it.
|
|
254
|
+
*/
|
|
255
|
+
byForm: ReadonlyMap<string, readonly NativeForm[]>;
|
|
256
|
+
};
|
|
257
|
+
/**
|
|
258
|
+
* What a run, a passage or a listing is mapped by.
|
|
259
|
+
*/
|
|
260
|
+
export type Mapping = {
|
|
261
|
+
/**
|
|
262
|
+
* - The map.
|
|
263
|
+
*/
|
|
264
|
+
map: import("./text-maps.mjs").TextMap;
|
|
265
|
+
/**
|
|
266
|
+
* - The face, whose own rows come first.
|
|
267
|
+
*/
|
|
268
|
+
font: string | undefined;
|
|
269
|
+
/**
|
|
270
|
+
* - The
|
|
271
|
+
* language's native forms under the map in the face.
|
|
272
|
+
*/
|
|
273
|
+
native: ((word: string) => string | undefined) | undefined;
|
|
274
|
+
};
|
|
@@ -4,9 +4,14 @@
|
|
|
4
4
|
* @param {string} source - Complete Markdown source, optionally with frontmatter.
|
|
5
5
|
* @param {string} file - Diagnostic filename.
|
|
6
6
|
* @param {import("./content-session.mjs").ContentSyntax} [syntax] - Exact-text scanner projections.
|
|
7
|
-
* @
|
|
7
|
+
* @param {import("./content-scripts.mjs").RunContext} [runs] - The package's
|
|
8
|
+
* languages, faces and maps. Given, text marked with `lang=`, `font=` and
|
|
9
|
+
* `map=` is checked against them; a caller with no package configuration
|
|
10
|
+
* leaves it out.
|
|
11
|
+
* @returns {Array<{file: string, line: number, column: number, severity: string, message: string}>} Syntax errors,
|
|
12
|
+
* then warnings.
|
|
8
13
|
*/
|
|
9
|
-
export function markupFindings(source: string, file: string, syntax?: import("./content-session.mjs").ContentSyntax): Array<{
|
|
14
|
+
export function markupFindings(source: string, file: string, syntax?: import("./content-session.mjs").ContentSyntax, runs?: import("./content-scripts.mjs").RunContext): Array<{
|
|
10
15
|
file: string;
|
|
11
16
|
line: number;
|
|
12
17
|
column: number;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Write each note's resolved calendar into its record, as `resolvedCalendar`.
|
|
3
|
+
*
|
|
4
|
+
* Reads each note's authored `data.calendar`, `data.culture` and
|
|
5
|
+
* `data.parents`, so it runs before the index writes a resolved culture over
|
|
6
|
+
* `data.culture`. A culture or parent in another package contributes the
|
|
7
|
+
* calendar its published entry states in `data.calendar`, and nothing else.
|
|
8
|
+
*
|
|
9
|
+
* @param {Array<Record<string, any>>} records - Index records, every Address a
|
|
10
|
+
* tuple. Records that are not notes are passed over.
|
|
11
|
+
* @param {object} options - Options.
|
|
12
|
+
* @param {string} options.contentPackage - The package the records belong to.
|
|
13
|
+
* @param {string} [options.defaultCalendar] - The configured calendar of last
|
|
14
|
+
* resort, a calendar note's shortcode.
|
|
15
|
+
* @param {string} [options.configFile] - The configuration file, where an
|
|
16
|
+
* unknown `defaultCalendar` is reported.
|
|
17
|
+
* @param {string} [options.contentBase] - The content tree, for opening a note
|
|
18
|
+
* to locate a finding.
|
|
19
|
+
* @param {(key: string) => Record<string, any>|undefined} [options.foreignRecord] -
|
|
20
|
+
* Another package's entry for a canonical address.
|
|
21
|
+
* @param {object[]} [options.problems] - Receives each finding. Omitted, the
|
|
22
|
+
* findings are collected and one Error lists them all.
|
|
23
|
+
* @param {Map<string, {raw: string}>} [options.parsed] - Notes already read, keyed by file.
|
|
24
|
+
* @returns {Array<Record<string, any>>} The same records.
|
|
25
|
+
* @throws {Error} When `problems` is omitted and anything is reported.
|
|
26
|
+
*/
|
|
27
|
+
export function resolveNoteCalendars(records: Array<Record<string, any>>, { contentPackage, defaultCalendar, configFile, contentBase, foreignRecord, problems, parsed }: {
|
|
28
|
+
contentPackage: string;
|
|
29
|
+
defaultCalendar?: string | undefined;
|
|
30
|
+
configFile?: string | undefined;
|
|
31
|
+
contentBase?: string | undefined;
|
|
32
|
+
foreignRecord?: ((key: string) => Record<string, any> | undefined) | undefined;
|
|
33
|
+
problems?: object[] | undefined;
|
|
34
|
+
parsed?: Map<string, {
|
|
35
|
+
raw: string;
|
|
36
|
+
}> | undefined;
|
|
37
|
+
}): Array<Record<string, any>>;
|
|
38
|
+
/**
|
|
39
|
+
* The configuration file in a package root, where a configured value is
|
|
40
|
+
* reported.
|
|
41
|
+
*
|
|
42
|
+
* @param {string|undefined} rootDir - The package root.
|
|
43
|
+
* @param {readonly string[]} names - The file names a configuration may take.
|
|
44
|
+
* @returns {string|undefined} The first that exists.
|
|
45
|
+
*/
|
|
46
|
+
export function configFileIn(rootDir: string | undefined, names: readonly string[]): string | undefined;
|
|
47
|
+
/**
|
|
48
|
+
* The calendar a note's dates print in: the one the content index resolved for
|
|
49
|
+
* it, where the reckoning context carries it, else the note's own
|
|
50
|
+
* `data.calendar`.
|
|
51
|
+
*
|
|
52
|
+
* @param {object|undefined} fm - The note's frontmatter.
|
|
53
|
+
* @param {{noteCalendars?: Map<string, string>}} [dates] - The reckoning context.
|
|
54
|
+
* @returns {string|undefined} The calendar's Address or shortcode.
|
|
55
|
+
*/
|
|
56
|
+
export function noteCalendar(fm: object | undefined, dates?: {
|
|
57
|
+
noteCalendars?: Map<string, string>;
|
|
58
|
+
}): string | undefined;
|
|
59
|
+
/** The configuration key naming the calendar of last resort. */
|
|
60
|
+
export const DEFAULT_CALENDAR_KEY: "defaultCalendar";
|
|
@@ -184,17 +184,33 @@ export function buildPdf({ config, configPath, book, out, version, compile, read
|
|
|
184
184
|
* @param {string} typPath - The `.typ` file.
|
|
185
185
|
* @param {string} pdfPath - Where the PDF goes.
|
|
186
186
|
* @param {object} [pdf] - The resolved `pdf:` block.
|
|
187
|
+
* @param {{rootDir?: string, paths?: {content?: string}}} [config] - The
|
|
188
|
+
* resolved configuration; the installed faces are searched when a note sets
|
|
189
|
+
* text in one.
|
|
187
190
|
* @returns {string[]} The arguments, in order.
|
|
188
191
|
*/
|
|
189
|
-
export function typstArgs(typPath: string, pdfPath: string, pdf?: object
|
|
192
|
+
export function typstArgs(typPath: string, pdfPath: string, pdf?: object, config?: {
|
|
193
|
+
rootDir?: string;
|
|
194
|
+
paths?: {
|
|
195
|
+
content?: string;
|
|
196
|
+
};
|
|
197
|
+
}): string[];
|
|
190
198
|
/**
|
|
191
199
|
* The flags that decide which faces a layout uses, shared by the compile and by
|
|
192
200
|
* the page measurement so both lay the book out in the same metrics.
|
|
193
201
|
*
|
|
194
202
|
* @param {object} [pdf] - The resolved `pdf:` block.
|
|
203
|
+
* @param {{rootDir?: string, paths?: {content?: string}}} [config] - The
|
|
204
|
+
* resolved configuration; the installed faces are searched when a note sets
|
|
205
|
+
* text in one.
|
|
195
206
|
* @returns {string[]} The arguments, in order.
|
|
196
207
|
*/
|
|
197
|
-
export function typstFontArgs(pdf?: object
|
|
208
|
+
export function typstFontArgs(pdf?: object, config?: {
|
|
209
|
+
rootDir?: string;
|
|
210
|
+
paths?: {
|
|
211
|
+
content?: string;
|
|
212
|
+
};
|
|
213
|
+
}): string[];
|
|
198
214
|
/**
|
|
199
215
|
* The compiler's own warnings, as findings.
|
|
200
216
|
*
|
|
@@ -224,10 +240,17 @@ export function typstWarnings(output: string): Array<{
|
|
|
224
240
|
* @param {string} typPath - The `.typ` file.
|
|
225
241
|
* @param {string} pdfPath - Where the PDF goes.
|
|
226
242
|
* @param {object} pdf - The resolved `pdf:` block.
|
|
243
|
+
* @param {{rootDir?: string, paths?: {content?: string}}} [config] - The
|
|
244
|
+
* resolved configuration, for the installed faces.
|
|
227
245
|
* @returns {{ok: boolean, message: string, findings: object[]}} What happened,
|
|
228
246
|
* and what the compiler warned about on the way.
|
|
229
247
|
*/
|
|
230
|
-
export function compileTypst(typPath: string, pdfPath: string, pdf?: object
|
|
248
|
+
export function compileTypst(typPath: string, pdfPath: string, pdf?: object, config?: {
|
|
249
|
+
rootDir?: string;
|
|
250
|
+
paths?: {
|
|
251
|
+
content?: string;
|
|
252
|
+
};
|
|
253
|
+
}): {
|
|
231
254
|
ok: boolean;
|
|
232
255
|
message: string;
|
|
233
256
|
findings: object[];
|
|
@@ -85,6 +85,9 @@ export function stripHtmlComments(markdown: string): string;
|
|
|
85
85
|
* Typst and is told nothing.
|
|
86
86
|
* @param {string} [opts.file] - The file the markdown came from, named in every
|
|
87
87
|
* finding.
|
|
88
|
+
* @param {import("./content-scripts.mjs").RunContext} [opts.runs] - The
|
|
89
|
+
* package's languages, faces and maps, which text marked with `lang=`,
|
|
90
|
+
* `font=` and `map=` is checked against and set by.
|
|
88
91
|
* @param {number} [opts.bodyLine] - The 1-based file line the body starts on, so
|
|
89
92
|
* a finding's line is the file's rather than the body's.
|
|
90
93
|
* @param {number} [opts.bodyColumn] - The 1-based column the body starts at.
|
|
@@ -124,6 +127,7 @@ export function markdownToTypst(markdown: string, opts?: {
|
|
|
124
127
|
anchorPrefix?: string | undefined;
|
|
125
128
|
findings?: object[] | undefined;
|
|
126
129
|
file?: string | undefined;
|
|
130
|
+
runs?: import("./content-scripts.mjs").RunContext | undefined;
|
|
127
131
|
bodyLine?: number | undefined;
|
|
128
132
|
bodyColumn?: number | undefined;
|
|
129
133
|
lineMap?: {
|
|
@@ -228,9 +232,17 @@ export function crossBookReference(inner: string, away: {
|
|
|
228
232
|
* carries are not the same set, and a missing glyph on 2,000 feet is a
|
|
229
233
|
* tofu box on every page of the book.
|
|
230
234
|
*
|
|
235
|
+
* @param {import("./content-scripts.mjs").RunContext} [runs] - The installed
|
|
236
|
+
* faces, each of whose classes sets its family.
|
|
237
|
+
* @param {{serif?: string, sans?: string, mono?: string}} [families] - The
|
|
238
|
+
* book's own serif, sans and mono, which `font=serif`, `sans` and `mono` set.
|
|
231
239
|
* @returns {string} Typst markup.
|
|
232
240
|
*/
|
|
233
|
-
export function bookTypstPreamble()
|
|
241
|
+
export function bookTypstPreamble(runs?: import("./content-scripts.mjs").RunContext, families?: {
|
|
242
|
+
serif?: string;
|
|
243
|
+
sans?: string;
|
|
244
|
+
mono?: string;
|
|
245
|
+
}): string;
|
|
234
246
|
/**
|
|
235
247
|
* The whole book, as one Typst document.
|
|
236
248
|
*
|
|
@@ -345,9 +357,11 @@ export function bookTypstPreamble(): string;
|
|
|
345
357
|
* @param {object} [opts.index] - As {@link module:engine/pdf-index.indexTerms}:
|
|
346
358
|
* `owns` limits the index to the notes this book is home to, and `foreign`
|
|
347
359
|
* (present only under `pdf.indexSeeAlso`) lists notes another book prints.
|
|
360
|
+
* @param {import("./content-scripts.mjs").RunContext} [opts.runs] - The
|
|
361
|
+
* installed faces, which the preamble maps to font families.
|
|
348
362
|
* @returns {string} A complete `.typ` document.
|
|
349
363
|
*/
|
|
350
|
-
export function renderBook({ plan, bodies, title, subtitle, front, fonts, version, preamble, banners, maps, coverImage, authors, copyright, license, index, }?: {
|
|
364
|
+
export function renderBook({ plan, bodies, title, subtitle, front, fonts, version, preamble, banners, maps, coverImage, authors, copyright, license, index, runs, }?: {
|
|
351
365
|
plan: object;
|
|
352
366
|
bodies: Map<string, string>;
|
|
353
367
|
title: string;
|
|
@@ -369,6 +383,7 @@ export function renderBook({ plan, bodies, title, subtitle, front, fonts, versio
|
|
|
369
383
|
copyright?: string | undefined;
|
|
370
384
|
license?: string | undefined;
|
|
371
385
|
index?: object | undefined;
|
|
386
|
+
runs?: import("./content-scripts.mjs").RunContext | undefined;
|
|
372
387
|
}): string;
|
|
373
388
|
/**
|
|
374
389
|
* Point every internal link at a label the document actually declares.
|