diff options
| author | Ralph Amissah <ralph.amissah@gmail.com> | 2026-09-27 20:40:20 -0400 |
|---|---|---|
| committer | Ralph Amissah <ralph.amissah@gmail.com> | 2026-09-28 13:07:41 -0400 |
| commit | b254c23c56a113bdcdb89f1f7917352baaa1cf0a (patch) | |
| tree | 5103af47460c1a6f0f593177bd1fae76f248bcff /org/default_paths.org | |
| parent | flags: --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 'org/default_paths.org')
| -rw-r--r-- | org/default_paths.org | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/org/default_paths.org b/org/default_paths.org index f10f131..0a4af80 100644 --- a/org/default_paths.org +++ b/org/default_paths.org @@ -1049,6 +1049,7 @@ import sisudoc.ocda.meta.rgx_files; <<template_paths_sqlite_0>> <<template_paths_sqlite_1>> <<template_paths_sqlite_2>> +<<template_paths_typst_pdf>> <<template_paths_text>> <<template_paths_skel>> #+END_SRC @@ -1746,6 +1747,60 @@ template spinePathsSQLite() { } #+END_SRC +** _typst_ :typst:pdf: + +#+NAME: template_paths_typst_pdf +#+BEGIN_SRC d +/+ ↓ where the typst output goes. + One .typ per document-language, because the paper is an input to the + compile rather than a thing compiled in, and the images beside it because a + .typ names them by path. The pdfs go where the latex path's pdfs go, under + the same names, so that a site built either way looks the same. ++/ +template spinePathsTypst() { + import std.conv; + auto spinePathsTypst(M)( + M doc_matters, + ) { + auto out_pth = spineOutPaths!()(doc_matters.output_path, doc_matters.src.language); + struct _PathsStruct { + /+ ↓ as latex: the .typ and the pdfs made from it carry the names the + .tex and its pdfs carried, so that a site built either way is the + same site and the html's pdf links resolve + +/ + string base_filename(string fn_src) { + return fn_src.baseName.stripExtension; + } + string base_pth() { + return (((out_pth.output_root).chainPath("typst")).asNormalizedPath).array; + } + string typst_file() { + // return ((base_pth.chainPath(doc_matters.src.doc_uid_out ~ ".typ")).asNormalizedPath).array; + return ((base_pth.chainPath(base_filename(doc_matters.src.filename) + ~ "." ~ doc_matters.src.language + ~ ".typ") + ).asNormalizedPath).array; + } + string images() { + return (((base_pth).chainPath("image")).asNormalizedPath).array; + } + string pdf_pth() { + return (((out_pth.output_root).chainPath("pdf")).asNormalizedPath).array; + } + string pdf_file_with_path(string paper_size_orientation) { + // return ((pdf_pth.chainPath(doc_matters.src.doc_uid_out + return ((pdf_pth.chainPath(base_filename(doc_matters.src.filename) + ~ "." ~ doc_matters.src.language + ~ "." ~ paper_size_orientation + ~ ".pdf") + ).asNormalizedPath).array; + } + } + return _PathsStruct(); + } +} +#+END_SRC + ** _text_ :text: #+NAME: template_paths_text |
