Reorganize document lib

This change reduces the amount of symlinks required per document.
This commit is contained in:
Joscha 2025-03-01 20:36:24 +01:00
parent 24c84801f1
commit 4bd6eb9dca
16 changed files with 14 additions and 15 deletions

View file

@ -6,6 +6,9 @@ pub mod text;
fn typst_with_lib() -> Typst { fn typst_with_lib() -> Typst {
Typst::new() Typst::new()
.with_file("/lib.typ", include_str!("documents/lib.typ")) .with_file("/lib/main.typ", include_str!("documents/lib/main.typ"))
.with_file("/plugin.wasm", include_bytes!("documents/plugin.wasm")) .with_file(
"/lib/plugin.wasm",
include_bytes!("documents/lib/plugin.wasm"),
)
} }

View file

@ -0,0 +1 @@
../lib

View file

@ -1 +0,0 @@
../lib.typ

View file

@ -1,6 +1,6 @@
#import "@preview/oxifmt:0.2.1": strfmt #import "@preview/oxifmt:0.2.1": strfmt
#import "@preview/suiji:0.3.0": * #import "@preview/suiji:0.3.0": *
#import "lib.typ"; #import "lib/main.typ" as lib;
#show: it => lib.init(it) #show: it => lib.init(it)
#let data = json("data.json") #let data = json("data.json")

View file

@ -1 +0,0 @@
../plugin.wasm

View file

@ -0,0 +1 @@
../lib

View file

@ -1 +0,0 @@
../lib.typ

View file

@ -1,10 +1,10 @@
#import "lib.typ"; #import "lib/main.typ" as lib;
#show: it => lib.init(it) #show: it => lib.init(it)
#let data = json("data.json") #let data = json("data.json")
#let dithered = lib.dither( #let dithered = lib.dither(
"image.png", read("image.png", encoding: none),
bright: data.bright, bright: data.bright,
algorithm: data.algo, algorithm: data.algo,
) )

View file

@ -1 +0,0 @@
../plugin.wasm

View file

@ -43,11 +43,10 @@
} }
#let dither( #let dither(
path, data,
bright: true, bright: true,
algorithm: "floyd-steinberg", algorithm: "floyd-steinberg",
) = layout(size => { ) = layout(size => {
let data = read(path, encoding: none)
let dithered = p.dither( let dithered = p.dither(
data, data,
_length_to_bytes(size.width), _length_to_bytes(size.width),

View file

@ -0,0 +1 @@
../../../../showbits-typst-plugin/target/wasm32-unknown-unknown/release/showbits_typst_plugin.wasm

View file

@ -1 +0,0 @@
../../../showbits-typst-plugin/target/wasm32-unknown-unknown/release/showbits_typst_plugin.wasm

View file

@ -0,0 +1 @@
../lib

View file

@ -1 +0,0 @@
../lib.typ

View file

@ -1,4 +1,4 @@
#import "lib.typ"; #import "lib/main.typ" as lib;
#show: it => lib.init(it) #show: it => lib.init(it)
#let data = json("data.json") #let data = json("data.json")

View file

@ -1 +0,0 @@
../plugin.wasm