@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
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Read one authored row.
|
|
3
|
+
*
|
|
4
|
+
* @param {unknown} row - The row as YAML gave it.
|
|
5
|
+
* @returns {{row: MapRow}|{problem: string, key?: string}} The row, or what is
|
|
6
|
+
* wrong with it and the key the fault sits at.
|
|
7
|
+
*/
|
|
8
|
+
export function readMapRow(row: unknown): {
|
|
9
|
+
row: MapRow;
|
|
10
|
+
} | {
|
|
11
|
+
problem: string;
|
|
12
|
+
key?: string;
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* Compile a `data.map` value, keeping its well-formed rows.
|
|
16
|
+
*
|
|
17
|
+
* @param {unknown} value - The note's `data.map`.
|
|
18
|
+
* @returns {TextMap|undefined} The map, or `undefined` when it has no valid name.
|
|
19
|
+
*/
|
|
20
|
+
export function compileMap(value: unknown): TextMap | undefined;
|
|
21
|
+
/**
|
|
22
|
+
* A native form found for a word in lowercase, given the word's capital as the
|
|
23
|
+
* rows write it: the rows map the word's first sound as written and in
|
|
24
|
+
* lowercase, and where the native form begins with the lowercase result, that
|
|
25
|
+
* beginning becomes the capital one.
|
|
26
|
+
*
|
|
27
|
+
* @param {TextMap} map - The map.
|
|
28
|
+
* @param {string|undefined} font - The face.
|
|
29
|
+
* @param {string} word - The word as written.
|
|
30
|
+
* @param {string} native - The native form of its lowercase.
|
|
31
|
+
* @returns {string|undefined} The native form, capitalised; `undefined` where
|
|
32
|
+
* it does not begin as the rows begin the word, so the rows cannot say how.
|
|
33
|
+
*/
|
|
34
|
+
export function capitalNative(map: TextMap, font: string | undefined, word: string, native: string): string | undefined;
|
|
35
|
+
/**
|
|
36
|
+
* Apply a map to text.
|
|
37
|
+
*
|
|
38
|
+
* @param {TextMap|undefined} map - The map; without one the text is returned
|
|
39
|
+
* as it is.
|
|
40
|
+
* @param {string} text - The text, with no escapes in it.
|
|
41
|
+
* @param {MapOptions} [options] - The face, and the native forms of words.
|
|
42
|
+
* @returns {{text: string, pieces: Array<{at: number, from: string, to: string, row: boolean, native?: boolean}>}}
|
|
43
|
+
* The rewritten text, and each piece of it with the UTF-16 offset in `text`
|
|
44
|
+
* it came from: a matched row's `from` and what it wrote, a word and its
|
|
45
|
+
* native form (`native: true`), or one character that passed through. A
|
|
46
|
+
* capitalised word whose native form the rows cannot capitalise is written
|
|
47
|
+
* as stated and carries `uncapitalised`, the lowercase form it was found by.
|
|
48
|
+
*/
|
|
49
|
+
export function applyMap(map: TextMap | undefined, text: string, { font, native }?: MapOptions): {
|
|
50
|
+
text: string;
|
|
51
|
+
pieces: Array<{
|
|
52
|
+
at: number;
|
|
53
|
+
from: string;
|
|
54
|
+
to: string;
|
|
55
|
+
row: boolean;
|
|
56
|
+
native?: boolean;
|
|
57
|
+
}>;
|
|
58
|
+
};
|
|
59
|
+
/**
|
|
60
|
+
* Every map the index records declare, by name. The first note to declare a
|
|
61
|
+
* name keeps it; the duplicate is the lint's to report.
|
|
62
|
+
*
|
|
63
|
+
* @param {Iterable<Record<string, any>>|undefined} records - Index records.
|
|
64
|
+
* @returns {Map<string, TextMap>} The maps.
|
|
65
|
+
*/
|
|
66
|
+
export function mapsFromRecords(records: Iterable<Record<string, any>> | undefined): Map<string, TextMap>;
|
|
67
|
+
/**
|
|
68
|
+
* One row per well-formed map row, for the `maps` relation: the shared rows
|
|
69
|
+
* with no `font`, then each listed face's own rows with its slug.
|
|
70
|
+
*
|
|
71
|
+
* @param {Iterable<Record<string, any>>} records - Index records.
|
|
72
|
+
* @param {(record: Record<string, any>) => string|null} ownerOf - A record's
|
|
73
|
+
* page Address.
|
|
74
|
+
* @returns {Array<Record<string, string|number|null>>} The rows, in record
|
|
75
|
+
* then authored order; `row` is the row's 1-based place in its list.
|
|
76
|
+
*/
|
|
77
|
+
export function mapRows(records: Iterable<Record<string, any>>, ownerOf: (record: Record<string, any>) => string | null): Array<Record<string, string | number | null>>;
|
|
78
|
+
/**
|
|
79
|
+
* Check a note's `data.map`: its name, that no other note declares it, each
|
|
80
|
+
* row written as a list, a `before` condition on a map with no `vowels`, an
|
|
81
|
+
* empty `fonts`, and a generic family in it. The data-key check owns every
|
|
82
|
+
* key, its kind and the words a condition takes; whether a listed face is
|
|
83
|
+
* installed, and draws what the map writes, is
|
|
84
|
+
* {@link module:engine/map-lexicon.checkMapFonts}'s.
|
|
85
|
+
*
|
|
86
|
+
* @param {{file: string, raw?: string, fm?: Record<string, any>}} note - The note.
|
|
87
|
+
* @param {{index?: {notes?: Iterable<object>}}} [context] - The lint index.
|
|
88
|
+
* @returns {object[]} The findings, each at its key.
|
|
89
|
+
*/
|
|
90
|
+
export function checkMapField(note: {
|
|
91
|
+
file: string;
|
|
92
|
+
raw?: string;
|
|
93
|
+
fm?: Record<string, any>;
|
|
94
|
+
}, { index }?: {
|
|
95
|
+
index?: {
|
|
96
|
+
notes?: Iterable<object>;
|
|
97
|
+
};
|
|
98
|
+
}): object[];
|
|
99
|
+
/** What a map's `name` may be. */
|
|
100
|
+
export const MAP_NAME: RegExp;
|
|
101
|
+
/** Each condition a row may carry, and the values it takes. */
|
|
102
|
+
export const MAP_CONDITIONS: Readonly<{
|
|
103
|
+
before: readonly string[];
|
|
104
|
+
at: readonly string[];
|
|
105
|
+
}>;
|
|
106
|
+
/** The generic families, which a map's `fonts` may not list. */
|
|
107
|
+
export const GENERIC_FAMILIES: readonly string[];
|
|
108
|
+
/** Every column of the `maps` relation, in order. */
|
|
109
|
+
export const MAP_COLUMNS: readonly string[];
|
|
110
|
+
/**
|
|
111
|
+
* One row, read.
|
|
112
|
+
*/
|
|
113
|
+
export type MapRow = {
|
|
114
|
+
/**
|
|
115
|
+
* - The characters it matches.
|
|
116
|
+
*/
|
|
117
|
+
from: string;
|
|
118
|
+
/**
|
|
119
|
+
* - What it writes in their place.
|
|
120
|
+
*/
|
|
121
|
+
to: string;
|
|
122
|
+
/**
|
|
123
|
+
* - What must follow the match.
|
|
124
|
+
*/
|
|
125
|
+
before?: "vowel" | "consonant" | undefined;
|
|
126
|
+
/**
|
|
127
|
+
* - Where the match must sit.
|
|
128
|
+
*/
|
|
129
|
+
at?: "end" | "start" | undefined;
|
|
130
|
+
};
|
|
131
|
+
/**
|
|
132
|
+
* A map ready to apply.
|
|
133
|
+
*/
|
|
134
|
+
export type TextMap = {
|
|
135
|
+
/**
|
|
136
|
+
* - Its name.
|
|
137
|
+
*/
|
|
138
|
+
name: string;
|
|
139
|
+
/**
|
|
140
|
+
* - The characters `before: vowel` reads.
|
|
141
|
+
*/
|
|
142
|
+
vowels: ReadonlySet<string>;
|
|
143
|
+
/**
|
|
144
|
+
* - Its well-formed shared rows, in authored order.
|
|
145
|
+
*/
|
|
146
|
+
rows: readonly MapRow[];
|
|
147
|
+
/**
|
|
148
|
+
* - Its shared rows
|
|
149
|
+
* by the first character of `from`, longest first, conditioned before plain.
|
|
150
|
+
*/
|
|
151
|
+
byFirst: ReadonlyMap<string, readonly MapRow[]>;
|
|
152
|
+
/**
|
|
153
|
+
* -
|
|
154
|
+
* Each listed face by slug, in listed order, with its own rows.
|
|
155
|
+
*/
|
|
156
|
+
fonts: ReadonlyMap<string, {
|
|
157
|
+
rows: readonly MapRow[];
|
|
158
|
+
byFirst: ReadonlyMap<string, readonly MapRow[]>;
|
|
159
|
+
}>;
|
|
160
|
+
};
|
|
161
|
+
/**
|
|
162
|
+
* How a text is mapped beyond the rows.
|
|
163
|
+
*/
|
|
164
|
+
export type MapOptions = {
|
|
165
|
+
/**
|
|
166
|
+
* - The face the text is set in, whose own rows are
|
|
167
|
+
* tried first.
|
|
168
|
+
*/
|
|
169
|
+
font?: string | undefined;
|
|
170
|
+
/**
|
|
171
|
+
* - A word's native
|
|
172
|
+
* form, for the word exactly as given, or `undefined` where it states none.
|
|
173
|
+
*/
|
|
174
|
+
native?: ((word: string) => string | undefined) | undefined;
|
|
175
|
+
};
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A stated verb pattern, as its readers use it.
|
|
3
|
+
*
|
|
4
|
+
* @typedef {object} VerbPattern
|
|
5
|
+
* @property {boolean} invariant - Whether verbs keep the citation form for
|
|
6
|
+
* every person.
|
|
7
|
+
* @property {string|undefined} replaces - The letters each ending takes the
|
|
8
|
+
* place of, where the pattern states them.
|
|
9
|
+
* @property {Array<{name: string, label: string, ending: string}>} endings -
|
|
10
|
+
* The six endings in presentation order; empty for an invariant pattern.
|
|
11
|
+
*/
|
|
12
|
+
/**
|
|
13
|
+
* Read a language's verb pattern.
|
|
14
|
+
*
|
|
15
|
+
* @param {unknown} verbs - The language's `data.grammar.verbs`, as authored or
|
|
16
|
+
* as a SQL row carries it (absent fields `null`).
|
|
17
|
+
* @returns {VerbPattern|undefined} The pattern, or `undefined` where none is
|
|
18
|
+
* stated in full.
|
|
19
|
+
*/
|
|
20
|
+
export function verbPattern(verbs: unknown): VerbPattern | undefined;
|
|
21
|
+
/**
|
|
22
|
+
* A stem with its closing letters swapped for an ending, or with the ending
|
|
23
|
+
* added where the stem does not close on them.
|
|
24
|
+
*
|
|
25
|
+
* @param {string} stem - The stem.
|
|
26
|
+
* @param {string} ending - The ending.
|
|
27
|
+
* @param {string|undefined} letters - The closing letters the ending takes
|
|
28
|
+
* the place of; none adds the ending.
|
|
29
|
+
* @returns {string} The form.
|
|
30
|
+
*/
|
|
31
|
+
export function replaceClosing(stem: string, ending: string, letters: string | undefined): string;
|
|
32
|
+
/**
|
|
33
|
+
* The present form of a verb for one ending.
|
|
34
|
+
*
|
|
35
|
+
* @param {string} citation - The citation form.
|
|
36
|
+
* @param {string} ending - The person's ending; empty leaves the citation
|
|
37
|
+
* form, less any closing `replaces`.
|
|
38
|
+
* @param {string} [replaces] - The pattern's `replaces`.
|
|
39
|
+
* @returns {string} The form.
|
|
40
|
+
*/
|
|
41
|
+
export function verbForm(citation: string, ending: string, replaces?: string): string;
|
|
42
|
+
/**
|
|
43
|
+
* A stated verb pattern, as its readers use it.
|
|
44
|
+
*/
|
|
45
|
+
export type VerbPattern = {
|
|
46
|
+
/**
|
|
47
|
+
* - Whether verbs keep the citation form for
|
|
48
|
+
* every person.
|
|
49
|
+
*/
|
|
50
|
+
invariant: boolean;
|
|
51
|
+
/**
|
|
52
|
+
* - The letters each ending takes the
|
|
53
|
+
* place of, where the pattern states them.
|
|
54
|
+
*/
|
|
55
|
+
replaces: string | undefined;
|
|
56
|
+
/**
|
|
57
|
+
* -
|
|
58
|
+
* The six endings in presentation order; empty for an invariant pattern.
|
|
59
|
+
*/
|
|
60
|
+
endings: Array<{
|
|
61
|
+
name: string;
|
|
62
|
+
label: string;
|
|
63
|
+
ending: string;
|
|
64
|
+
}>;
|
|
65
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* **What a word is in running text.** A word is a maximal run of letters,
|
|
3
|
+
* combining marks and digits, and an apostrophe (`'` or `’`), a hyphen or an
|
|
4
|
+
* en dash joins two such runs into one word: `k'aralzon`, `Arzen-Thalor`.
|
|
5
|
+
* Anything else, whitespace and punctuation included, sits between words.
|
|
6
|
+
*
|
|
7
|
+
* The name catalog reads a label's last word by it, and a mapped run reads
|
|
8
|
+
* each word it looks up in a lexicon by it.
|
|
9
|
+
*
|
|
10
|
+
* @module
|
|
11
|
+
*/
|
|
12
|
+
/** One word; global, so `matchAll` walks every word of a text. */
|
|
13
|
+
export const WORD: RegExp;
|
|
@@ -64,6 +64,12 @@ export const BORROWED_SOURCE_KIND: "borrowed";
|
|
|
64
64
|
* @type {readonly import("./data-keys.mjs").InnerKeySpec[]}
|
|
65
65
|
*/
|
|
66
66
|
export const WORD_SOURCE_FIELDS: readonly import("./data-keys.mjs").InnerKeySpec[];
|
|
67
|
+
/**
|
|
68
|
+
* The keys of one entry of a word's `native`.
|
|
69
|
+
*
|
|
70
|
+
* @type {readonly import("./data-keys.mjs").InnerKeySpec[]}
|
|
71
|
+
*/
|
|
72
|
+
export const WORD_NATIVE_FIELDS: readonly import("./data-keys.mjs").InnerKeySpec[];
|
|
67
73
|
/**
|
|
68
74
|
* The keys one word of a language note's `data.words` carries.
|
|
69
75
|
*
|