aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/sisudoc/spine.d
diff options
context:
space:
mode:
authorRalph Amissah <ralph.amissah@gmail.com>2026-09-27 20:40:20 -0400
committerRalph Amissah <ralph.amissah@gmail.com>2026-09-28 13:07:41 -0400
commitb254c23c56a113bdcdb89f1f7917352baaa1cf0a (patch)
tree5103af47460c1a6f0f593177bd1fae76f248bcff /src/sisudoc/spine.d
parentflags: --ocda-db and matching --ocda-db-round-trip (diff)
typst output --typist & --pdf that makes the pdf
typst provides a new pdf build path replacing latex as the primary pdf builder. --typst (--typ) writes the .typ; --pdf writes the .typ and compiles it by spawning `typst compile`. (--pdf is redefined, being typst to pdf rather than latex). --latex is unchanged and writes the .tex; One .typ per document-language (not one per paper size). The paper and the orientation are read from sys.inputs with a default, so the same file compiles to every paper --set-papersize asks for, the pdfs keep their original names. Spine's paper names (derived from what suited latex) and typst's are different vocabularies and are mapped; a paper typst does not have is named and skipped. With the flag --pdf spine invokes a typesetter to generate the pdf output directly, which is new (the latex path writes a .tex and leaves xelatex to the caller). If typst is not available on the machine it is reported absent, naming the binary and printing the command, and the run continues, the .typ is written. Several useful features of an object-centric pdf are easily met, usually being a few lines each. - The object number goes in the margin as one `place` at a coordinate inside the object's own block, carrying the label every citation points at. - A note is a real footnote at the point of reference, with the document's own number and one link back to the object. - The table of contents locates by object number rather than by page, so it holds true across every paper and every setting. That typst compiles silently across the sample set means every internal link in every document resolves (--pdf over the collection with two paper sizes gives 144 pdfs, none skipped and none failed, each the page size its name claims and each tagged). paths: .typ, pdf named in same way as .tex based built pdfs so site linkage works either way flake.nix: added a typst dev shell, for .typ pdf typesetter - dsh-typst-pdf providing a pdf typsetter for spine's .typ. - dsh-latex-pdf provides xelatex for .tex which can still be written. (assisted by Claude-Code)
Diffstat (limited to 'src/sisudoc/spine.d')
-rw-r--r--src/sisudoc/spine.d24
1 files changed, 20 insertions, 4 deletions
diff --git a/src/sisudoc/spine.d b/src/sisudoc/spine.d
index 0494a34..e42a5f1 100644
--- a/src/sisudoc/spine.d
+++ b/src/sisudoc/spine.d
@@ -177,6 +177,8 @@ string program_name = "spine";
"parallel" : false,
"parallel-subprocesses" : false,
"pdf" : false,
+ "typst" : false,
+ "typ" : false,
"pdf-color-links" : false,
"pdf-init" : false,
"po4a-cfg" : false,
@@ -288,7 +290,7 @@ string program_name = "spine";
"html-seg", "process html output", &opts["html-seg"],
"html-scroll", "process html output", &opts["html-scroll"],
"lang", "=[lang code e.g. =en or =en,es]", &settings["lang"],
- "latex", "latex output (for pdfs)", &opts["latex"],
+ "latex", "latex output (.tex, for further processing to a pdf)", &opts["latex"],
"latex-color-links", "mono or color links for pdfs", &opts["latex-color-links"],
"latex-init", "initialise latex shared files (see latex-header-sty)", &opts["latex-init"],
"latex-header-sty", "latex document header sty files", &opts["latex-header-sty"],
@@ -307,7 +309,9 @@ string program_name = "spine";
"abstraction-source", "=/path/to/(.sst|pod|.ssp|.ocda.db) identify it, and load it if it is an abstraction", &settings["abstraction-source"],
"parallel", "parallelise document processing (opt-in; slower than serial)", &opts["parallel"],
"parallel-subprocesses", "nested parallelisation", &opts["parallel-subprocesses"],
- "pdf", "latex output for pdfs", &opts["pdf"],
+ "pdf", "pdf output (writes the .typ and compiles it with typst)", &opts["pdf"],
+ "typst", "typst output (.typ, for further processing to a pdf)", &opts["typst"],
+ "typ", "typst output (--typst)", &opts["typ"],
"pdf-color-links", "mono or color links for pdfs", &opts["pdf-color-links"],
"pdf-init", "initialise latex shared files (see latex-header-sty)", &opts["pdf-init"],
"po4a-cfg", "print the po4a configuration for this document", &opts["po4a-cfg"],
@@ -578,7 +582,7 @@ Verifying:
stdout.flush;
exit(_loaded.loaded ? 0 : 1);
}
- enum outTask { source_or_pod, sqlite, sqlite_multi, latex, odt, epub, html_scroll, html_seg, html_stuff, text, skel }
+ enum outTask { source_or_pod, sqlite, sqlite_multi, latex, typst, odt, epub, html_scroll, html_seg, html_stuff, text, skel }
struct OptActions {
@trusted bool allow_downloads() {
return opts["allow-downloads"];
@@ -703,8 +707,17 @@ Verifying:
@trusted bool html_stuff() {
return (opts["html"] || opts["html-scroll"] || opts["html-seg"]) ? true : false;
}
+ /+ ↓ --pdf is produced via typst (it no longer writes latex: --latex writes .tex, --typst (--typ) writes .typ, and
+ --pdf writes .typ and compiles it.
+ +/
@trusted bool latex() {
- return (opts["latex"] || opts["pdf"]) ? true : false;
+ return opts["latex"];
+ }
+ @trusted bool typst() {
+ return (opts["typst"] || opts["typ"] || opts["pdf"]) ? true : false;
+ }
+ @trusted bool pdf() {
+ return opts["pdf"];
}
@trusted bool latex_color_links() {
return (opts["latex-color-links"] || opts["pdf-color-links"]) ? true : false;
@@ -1060,6 +1073,7 @@ Verifying:
if (html_stuff) schedule ~= outTask.html_stuff;
if (odt) schedule ~= outTask.odt;
if (latex) schedule ~= outTask.latex;
+ if (typst) schedule ~= outTask.typst;
if (text) schedule ~= outTask.text;
if (skel) schedule ~= outTask.skel;
return schedule.sort().uniq;
@@ -1077,6 +1091,7 @@ Verifying:
|| epub
|| odt
|| latex
+ || typst
|| manifest
|| sqlite_discrete
|| sqlite_delete
@@ -1094,6 +1109,7 @@ Verifying:
|| html_seg
|| html_scroll
|| latex
+ || typst
|| odt
|| manifest
|| show_abstraction