typst 0.0.5 → 0.13.1
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.
- checksums.yaml +4 -4
- data/README.md +38 -4
- data/README.typ +38 -4
- data/ext/typst/Cargo.toml +30 -15
- data/ext/typst/src/compiler-new.rs +771 -0
- data/ext/typst/src/compiler.rs +100 -39
- data/ext/typst/src/download.rs +11 -71
- data/ext/typst/src/lib.rs +218 -21
- data/ext/typst/src/query.rs +131 -0
- data/ext/typst/src/world.rs +130 -136
- data/lib/typst.rb +61 -2
- metadata +19 -9
- data/ext/typst/Cargo.lock +0 -2840
- data/ext/typst/src/lib.wip.rs +0 -203
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 880dbd16bacd894d910728407dbc9465317f64ab4c7c20993e0882764fd75019
|
4
|
+
data.tar.gz: 6d446dfd48e83e560dd889cd9d5f67ce66cb42356dad3697324135daf66a1ecc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9c8045304a0a676621f3f2384d1ffed27e5222bc29a9c0e20d5257806e0158b1130630ba7663fcf41d6def7e103e8cd5faa9092349eee3bb82043f286a7715bf
|
7
|
+
data.tar.gz: 8adb1272c9725712007cc80199d156b61fdc91d3ef8df95076595c4be5855b55269991e235ac439102f05a9ffb826e87a3d8593d25e198cbada7845d3a6962d0
|
data/README.md
CHANGED
@@ -25,29 +25,49 @@ pdf_bytes = Typst::Pdf.new("readme.typ").bytes
|
|
25
25
|
document = Typst::Pdf.new("readme.typ").document
|
26
26
|
# => "%PDF-1.7\n%\x80\x80\x80\x80\n\n4 0 obj\n<<\n /Type /Font\n /Subtype ..."
|
27
27
|
|
28
|
-
# Compile `readme.typ` to SVG and save as `
|
28
|
+
# Compile `readme.typ` to SVG and save as `readme_0.svg`, `readme_1.svg`
|
29
29
|
Typst::Svg.new("readme.typ").write("readme.svg")
|
30
30
|
|
31
31
|
# Or return SVG content as an array of pages
|
32
32
|
pages = Typst::Svg.new("readme.typ").pages
|
33
33
|
# => ["<svg class=\"typst-doc\" viewBox=\"0 0 595.2764999999999 841.89105\" ..."
|
34
34
|
|
35
|
+
# Compile `readme.typ` to PNG and save as `readme_0.png`, `readme_1.png`
|
36
|
+
Typst::Png.new("readme.typ").write("readme.png")
|
37
|
+
|
38
|
+
# Or return PNG content as an array of pages
|
39
|
+
pages = Typst::Png.new("readme.typ").pages
|
40
|
+
# => ["\x89PNG\r\n\x1A\n\x00\x00\x00\rIHDR\x00\x00\x04\xA7\x00\x00\x06\x94\b\ ...
|
41
|
+
|
35
42
|
# Compile `readme.typ` to SVG and save as `readme.html`
|
36
|
-
Typst::Html.new("readme.typ", "README").write("readme.html")
|
43
|
+
Typst::Html.new("readme.typ", title: "README").write("readme.html")
|
37
44
|
|
38
45
|
# Or return HTML content
|
39
|
-
markup = Typst::Html.new("readme.typ", title: "README").
|
46
|
+
markup = Typst::Html.new("readme.typ", title: "README").document
|
40
47
|
# => "\n<!DOCTYPE html>\n<html>\n<head>\n<title>README</title>\n</head>\n<bo..."
|
41
48
|
|
49
|
+
# Use native Typst experimental HTML feature to write single frame HTML file
|
50
|
+
Typst::HtmlExperimental.new("readme.typ").write("readme.html")
|
51
|
+
|
52
|
+
# Or return single frame HTML content (using native Typst experimental HTML feature)
|
53
|
+
markup = Typst::HtmlExperimental.new("readme.typ").document
|
54
|
+
# => "<!DOCTYPE html>\n<html>\n <head>\n <meta charset=\"utf-8\">\n..."
|
55
|
+
|
42
56
|
# Compile from a string to PDF
|
43
57
|
t = Typst::Pdf.from_s(%{hello world})
|
44
58
|
|
45
59
|
# Compile from a string to SVG
|
46
60
|
t = Typst::Svg.from_s(%{hello world})
|
47
61
|
|
48
|
-
# Compile from a string to
|
62
|
+
# Compile from a string to PNG
|
63
|
+
t = Typst::Png.from_s(%{hello world})
|
64
|
+
|
65
|
+
# Compile from a string to SVG multi-frame/pages wrapped in HTML (non-native Typst)
|
49
66
|
t = Typst::Html.from_s(%{hello world})
|
50
67
|
|
68
|
+
# Compile from a string to single frame HTML (native Typst experimental feature)
|
69
|
+
t = Typst::HtmlExperimental.from_s(%{hello world})
|
70
|
+
|
51
71
|
# A more complex example of compiling from string
|
52
72
|
main = %{
|
53
73
|
#import "template.typ": *
|
@@ -77,6 +97,20 @@ Typst::Pdf::from_zip("working_directory.zip")
|
|
77
97
|
|
78
98
|
# From a zip with a named main typst file
|
79
99
|
Typst::Pdf::from_zip("working_directory.zip", "hello.typ")
|
100
|
+
|
101
|
+
Typst::Query.new("heading", "readme.typ").result
|
102
|
+
# =>
|
103
|
+
# [{"func" => "heading",
|
104
|
+
# "level" => 1,
|
105
|
+
# "depth" => 1,
|
106
|
+
# ...
|
107
|
+
|
108
|
+
Typst::Query.new("heading", "readme.typ", format: "json").result(raw: true)
|
109
|
+
# => "[\n {\n \"func\": \"heading\",\n \"level\": 1,\n \"depth\": ..."
|
110
|
+
|
111
|
+
Typst::Query.new("heading", "readme.typ", format: "yaml").result(raw: true)
|
112
|
+
# => "- func: heading\n level: 1\n depth: 1\n offset: 0\n numbering: ..."
|
113
|
+
|
80
114
|
```
|
81
115
|
|
82
116
|
## Contributors & Acknowledgements
|
data/README.typ
CHANGED
@@ -28,29 +28,49 @@ pdf_bytes = Typst::Pdf.new("readme.typ").bytes
|
|
28
28
|
document = Typst::Pdf.new("readme.typ").document
|
29
29
|
# => "%PDF-1.7\n%\x80\x80\x80\x80\n\n4 0 obj\n<<\n /Type /Font\n /Subtype ..."
|
30
30
|
|
31
|
-
# Compile `readme.typ` to SVG and save as `
|
31
|
+
# Compile `readme.typ` to SVG and save as `readme_0.svg`, `readme_1.svg`
|
32
32
|
Typst::Svg.new("readme.typ").write("readme.svg")
|
33
33
|
|
34
34
|
# Or return SVG content as an array of pages
|
35
35
|
pages = Typst::Svg.new("readme.typ").pages
|
36
36
|
# => ["<svg class=\"typst-doc\" viewBox=\"0 0 595.2764999999999 841.89105\" ..."
|
37
37
|
|
38
|
+
# Compile `readme.typ` to PNG and save as `readme_0.png`, `readme_1.png`
|
39
|
+
Typst::Png.new("readme.typ").write("readme.png")
|
40
|
+
|
41
|
+
# Or return PNG content as an array of pages
|
42
|
+
pages = Typst::Png.new("readme.typ").pages
|
43
|
+
# => ["\x89PNG\r\n\x1A\n\x00\x00\x00\rIHDR\x00\x00\x04\xA7\x00\x00\x06\x94\b\ ...
|
44
|
+
|
38
45
|
# Compile `readme.typ` to SVG and save as `readme.html`
|
39
|
-
Typst::Html.new("readme.typ", "README").write("readme.html")
|
46
|
+
Typst::Html.new("readme.typ", title: "README").write("readme.html")
|
40
47
|
|
41
48
|
# Or return HTML content
|
42
|
-
markup = Typst::Html.new("readme.typ", title: "README").
|
49
|
+
markup = Typst::Html.new("readme.typ", title: "README").document
|
43
50
|
# => "\n<!DOCTYPE html>\n<html>\n<head>\n<title>README</title>\n</head>\n<bo..."
|
44
51
|
|
52
|
+
# Use native Typst experimental HTML feature to write single frame HTML file
|
53
|
+
Typst::HtmlExperimental.new("readme.typ").write("readme.html")
|
54
|
+
|
55
|
+
# Or return single frame HTML content (using native Typst experimental HTML feature)
|
56
|
+
markup = Typst::HtmlExperimental.new("readme.typ").document
|
57
|
+
# => "<!DOCTYPE html>\n<html>\n <head>\n <meta charset=\"utf-8\">\n..."
|
58
|
+
|
45
59
|
# Compile from a string to PDF
|
46
60
|
t = Typst::Pdf.from_s(%{hello world})
|
47
61
|
|
48
62
|
# Compile from a string to SVG
|
49
63
|
t = Typst::Svg.from_s(%{hello world})
|
50
64
|
|
51
|
-
# Compile from a string to
|
65
|
+
# Compile from a string to PNG
|
66
|
+
t = Typst::Png.from_s(%{hello world})
|
67
|
+
|
68
|
+
# Compile from a string to SVG multi-frame/pages wrapped in HTML (non-native Typst)
|
52
69
|
t = Typst::Html.from_s(%{hello world})
|
53
70
|
|
71
|
+
# Compile from a string to single frame HTML (native Typst experimental feature)
|
72
|
+
t = Typst::HtmlExperimental.from_s(%{hello world})
|
73
|
+
|
54
74
|
# A more complex example of compiling from string
|
55
75
|
main = %{
|
56
76
|
#import "template.typ": *
|
@@ -80,6 +100,20 @@ Typst::Pdf::from_zip("working_directory.zip")
|
|
80
100
|
|
81
101
|
# From a zip with a named main typst file
|
82
102
|
Typst::Pdf::from_zip("working_directory.zip", "hello.typ")
|
103
|
+
|
104
|
+
Typst::Query.new("heading", "readme.typ").result
|
105
|
+
# =>
|
106
|
+
# [{"func" => "heading",
|
107
|
+
# "level" => 1,
|
108
|
+
# "depth" => 1,
|
109
|
+
# ...
|
110
|
+
|
111
|
+
Typst::Query.new("heading", "readme.typ", format: "json").result(raw: true)
|
112
|
+
# => "[\n {\n \"func\": \"heading\",\n \"level\": 1,\n \"depth\": ..."
|
113
|
+
|
114
|
+
Typst::Query.new("heading", "readme.typ", format: "yaml").result(raw: true)
|
115
|
+
# => "- func: heading\n level: 1\n depth: 1\n offset: 0\n numbering: ..."
|
116
|
+
|
83
117
|
```
|
84
118
|
|
85
119
|
== Contributors & Acknowledgements
|
data/ext/typst/Cargo.toml
CHANGED
@@ -1,33 +1,48 @@
|
|
1
1
|
[package]
|
2
2
|
name = "typst"
|
3
|
-
version = "0.0
|
3
|
+
version = "0.13.0"
|
4
4
|
edition = "2021"
|
5
5
|
|
6
6
|
[lib]
|
7
7
|
crate-type = ["cdylib"]
|
8
8
|
|
9
9
|
[dependencies]
|
10
|
-
chrono = { version = "0.4.
|
10
|
+
chrono = { version = "0.4.38", default-features = false, features = [
|
11
11
|
"clock",
|
12
12
|
"std",
|
13
13
|
] }
|
14
14
|
codespan-reporting = "0.11"
|
15
|
-
comemo = "0.
|
16
|
-
dirs = "5"
|
15
|
+
comemo = "0.4"
|
16
|
+
dirs = "5" #
|
17
17
|
ecow = "0.2"
|
18
|
-
env_logger = "0.10.1"
|
19
|
-
env_proxy = "0.4"
|
20
|
-
filetime = "0.2.22"
|
21
|
-
flate2 = "1"
|
22
|
-
fontdb = "0.15.0"
|
23
|
-
log = "0.4.20"
|
18
|
+
env_logger = "0.10.1" #
|
19
|
+
env_proxy = "0.4" #
|
20
|
+
filetime = "0.2.22" #
|
21
|
+
flate2 = "1" #
|
22
|
+
fontdb = "0.15.0" #
|
23
|
+
log = "0.4.20" #
|
24
24
|
magnus = { version = "0.6" }
|
25
25
|
pathdiff = "0.2"
|
26
|
-
same-file = "1"
|
27
|
-
siphasher = "1.0"
|
28
|
-
tar = "0.4"
|
29
|
-
typst = { git = "https://github.com/typst/typst.git", tag = "v0.
|
30
|
-
typst-library = { git = "https://github.com/typst/typst.git", tag = "v0.
|
26
|
+
same-file = "1" #
|
27
|
+
siphasher = "1.0" #
|
28
|
+
tar = "0.4" #
|
29
|
+
#typst = { git = "https://github.com/typst/typst.git", tag = "v0.13.0" }
|
30
|
+
#typst-library = { git = "https://github.com/typst/typst.git", tag = "v0.13.0" }
|
31
|
+
serde = { version = "1.0.217", features = ["derive"] }
|
32
|
+
serde_json = "1"
|
33
|
+
serde_yaml = "0.9"
|
34
|
+
typst = "0.13.0"
|
35
|
+
typst-library = "0.13.0"
|
36
|
+
typst-kit = { version = "0.13.0", features = [
|
37
|
+
"downloads",
|
38
|
+
"embed-fonts",
|
39
|
+
"vendor-openssl",
|
40
|
+
] }
|
41
|
+
typst-pdf = "0.13.0"
|
42
|
+
typst-svg = "0.13.0"
|
43
|
+
typst-html = "0.13.0"
|
44
|
+
typst-render = "0.13.0"
|
45
|
+
typst-eval = "0.13.0"
|
31
46
|
ureq = { version = "2", default-features = false, features = [
|
32
47
|
"gzip",
|
33
48
|
"socks-proxy",
|