Reorganize document lib
This change reduces the amount of symlinks required per document.
This commit is contained in:
parent
24c84801f1
commit
4bd6eb9dca
16 changed files with 14 additions and 15 deletions
|
|
@ -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"),
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
1
showbits-thermal-printer/src/documents/egg/lib
Symbolic link
1
showbits-thermal-printer/src/documents/egg/lib
Symbolic link
|
|
@ -0,0 +1 @@
|
||||||
|
../lib
|
||||||
|
|
@ -1 +0,0 @@
|
||||||
../lib.typ
|
|
||||||
|
|
@ -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")
|
||||||
|
|
|
||||||
|
|
@ -1 +0,0 @@
|
||||||
../plugin.wasm
|
|
||||||
1
showbits-thermal-printer/src/documents/image/lib
Symbolic link
1
showbits-thermal-printer/src/documents/image/lib
Symbolic link
|
|
@ -0,0 +1 @@
|
||||||
|
../lib
|
||||||
|
|
@ -1 +0,0 @@
|
||||||
../lib.typ
|
|
||||||
|
|
@ -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,
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -1 +0,0 @@
|
||||||
../plugin.wasm
|
|
||||||
|
|
@ -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),
|
||||||
1
showbits-thermal-printer/src/documents/lib/plugin.wasm
Symbolic link
1
showbits-thermal-printer/src/documents/lib/plugin.wasm
Symbolic link
|
|
@ -0,0 +1 @@
|
||||||
|
../../../../showbits-typst-plugin/target/wasm32-unknown-unknown/release/showbits_typst_plugin.wasm
|
||||||
|
|
@ -1 +0,0 @@
|
||||||
../../../showbits-typst-plugin/target/wasm32-unknown-unknown/release/showbits_typst_plugin.wasm
|
|
||||||
1
showbits-thermal-printer/src/documents/text/lib
Symbolic link
1
showbits-thermal-printer/src/documents/text/lib
Symbolic link
|
|
@ -0,0 +1 @@
|
||||||
|
../lib
|
||||||
|
|
@ -1 +0,0 @@
|
||||||
../lib.typ
|
|
||||||
|
|
@ -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")
|
||||||
|
|
|
||||||
|
|
@ -1 +0,0 @@
|
||||||
../plugin.wasm
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue