@heroiclands/package-build 23.2.1 → 23.3.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 +25 -0
- package/ci/content-format-reference.mjs +28 -5
- package/content-config.mjs +15 -0
- package/docs/api.md +37 -23
- package/docs/authoring/frontmatter.md +2 -0
- package/docs/configuration.md +10 -0
- package/docs/content-format.md +4 -0
- package/docs/guides/book.md +10 -0
- package/docs/guides/e2e.md +8 -1
- package/docs/reference/format-details.md +260 -7
- package/docs/reference/note-types.md +27 -27
- package/e2e.mjs +37 -10
- package/engine/content-format.yaml +6 -0
- package/engine/data-keys.mjs +6 -2
- package/engine/index.mjs +3 -0
- package/engine/infobox.mjs +1 -1
- package/engine/note-vocabulary.mjs +209 -17
- package/engine/pdf-build.mjs +10 -9
- package/engine/pdf-index.mjs +15 -2
- package/engine/pdf-pages.mjs +29 -6
- package/engine/settlement-tables.mjs +777 -0
- package/hugo-theme/layouts/_default/baseof.html +1 -1
- package/package.json +1 -1
- package/types/e2e.d.mts +5 -1
- package/types/engine/index.d.mts +1 -0
- package/types/engine/infobox.d.mts +1 -1
- package/types/engine/note-vocabulary.d.mts +31 -0
- package/types/engine/pdf-index.d.mts +5 -1
- package/types/engine/pdf-pages.d.mts +20 -0
- package/types/engine/settlement-tables.d.mts +164 -0
package/engine/pdf-pages.mjs
CHANGED
|
@@ -66,6 +66,34 @@ export function evalArgs(typPath, fontArgs) {
|
|
|
66
66
|
return ["eval", "--in", typPath, ...fontArgs, PAGES_EXPRESSION];
|
|
67
67
|
}
|
|
68
68
|
|
|
69
|
+
/**
|
|
70
|
+
* Say why a finished Typst process failed.
|
|
71
|
+
*
|
|
72
|
+
* A process killed by a signal has no exit status and prints nothing, so the
|
|
73
|
+
* signal is named; `SIGKILL` is the kernel's out-of-memory kill. Otherwise the
|
|
74
|
+
* first line the compiler printed is the reason, and the exit code stands in
|
|
75
|
+
* when it printed none.
|
|
76
|
+
*
|
|
77
|
+
* @param {{status: number | null, signal: string | null, stderr?: string | null, stdout?: string | null}} result -
|
|
78
|
+
* The finished process.
|
|
79
|
+
* @param {string} binary - The Typst binary.
|
|
80
|
+
* @param {string} subcommand - The Typst subcommand that ran.
|
|
81
|
+
* @returns {string} The reason, ready to follow the failing command's name.
|
|
82
|
+
*/
|
|
83
|
+
export function typstFailure(result, binary, subcommand) {
|
|
84
|
+
const command = `\`${binary} ${subcommand}\``;
|
|
85
|
+
if (result.signal) {
|
|
86
|
+
const hint = result.signal === "SIGKILL" ? " (most often the memory limit)" : "";
|
|
87
|
+
return `${command} was killed by ${result.signal}${hint}`;
|
|
88
|
+
}
|
|
89
|
+
const detail = String(result.stderr || result.stdout || "")
|
|
90
|
+
.trim()
|
|
91
|
+
.split("\n")[0];
|
|
92
|
+
return detail ?
|
|
93
|
+
`${command} failed: ${detail}`
|
|
94
|
+
: `${command} exited with code ${result.status} and printed nothing`;
|
|
95
|
+
}
|
|
96
|
+
|
|
69
97
|
/**
|
|
70
98
|
* Measure the page each labelled entry of a book starts on.
|
|
71
99
|
*
|
|
@@ -87,12 +115,7 @@ export function readEntryPages(typPath, fontArgs, binary = "typst") {
|
|
|
87
115
|
return fail(`could not run \`${binary}\`: ${err.message}`);
|
|
88
116
|
}
|
|
89
117
|
if (result.error) return fail(`could not run \`${binary}\`: ${result.error.message}`);
|
|
90
|
-
if (result.status !== 0)
|
|
91
|
-
const detail = String(result.stderr || result.stdout || "")
|
|
92
|
-
.trim()
|
|
93
|
-
.split("\n")[0];
|
|
94
|
-
return fail(`\`${binary} eval\` failed: ${detail}`);
|
|
95
|
-
}
|
|
118
|
+
if (result.status !== 0) return fail(typstFailure(result, binary, "eval"));
|
|
96
119
|
let rows;
|
|
97
120
|
try {
|
|
98
121
|
rows = JSON.parse(result.stdout);
|