feat: Migrate to typst 0.15.0
This commit is contained in:
parent
e193f96709
commit
1efb44206b
893
Cargo.lock
generated
893
Cargo.lock
generated
File diff suppressed because it is too large
Load Diff
@ -13,8 +13,8 @@ tokio = { version = "1.48.0", features = ["macros", "rt-multi-thread"] }
|
||||
tower-http = { version = "0.6.8", features = ["compression-br", "fs", "trace", "set-header"] }
|
||||
tracing = "0.1.43"
|
||||
tracing-subscriber = "0.3.22"
|
||||
typst-html = { git = "https://github.com/mkorje/typst.git", branch = "mathml" }
|
||||
typst-kit = { git = "https://github.com/mkorje/typst.git", branch = "mathml" }
|
||||
typst = { git = "https://github.com/mkorje/typst.git", branch = "mathml" }
|
||||
typst-html = "0.15.0"
|
||||
typst-kit = "0.15.0"
|
||||
typst = "0.15.0"
|
||||
ureq = "3.1.4"
|
||||
clap = { version = "4.6.0", features = ["derive"] }
|
||||
|
||||
@ -10,6 +10,7 @@ use typst::{
|
||||
text::{Font, FontBook},
|
||||
utils::LazyHash,
|
||||
};
|
||||
use typst_html::HtmlOptions;
|
||||
use typst_kit::fonts::FontStore;
|
||||
|
||||
use crate::AppConfig;
|
||||
@ -41,12 +42,14 @@ impl TypstContext {
|
||||
let world = DocumentWorld::new(path, self);
|
||||
let compiled = typst::compile(&world);
|
||||
|
||||
let html_options = HtmlOptions::default();
|
||||
|
||||
// TODO: Log warnings
|
||||
|
||||
// TODO: Log errors
|
||||
compiled
|
||||
.output
|
||||
.and_then(|doc| typst_html::html(&doc))
|
||||
.and_then(|doc| typst_html::html(&doc, &html_options))
|
||||
.map_err(|err| err.into_iter().collect())
|
||||
}
|
||||
}
|
||||
@ -116,7 +119,8 @@ impl<'a> DocumentWorld<'a> {
|
||||
}
|
||||
|
||||
fn resolve_project_file(&self, path: &VirtualPath) -> FileResult<PathBuf> {
|
||||
Ok(path.realize(&self.context.config.content_root))
|
||||
path.realize(&self.context.config.content_root)
|
||||
.map_err(FileError::Realize)
|
||||
}
|
||||
|
||||
fn resolve_package_file(&self, path: &VirtualPath, spec: &PackageSpec) -> FileResult<PathBuf> {
|
||||
@ -129,12 +133,13 @@ impl<'a> DocumentWorld<'a> {
|
||||
|
||||
fn resolve_common_file(&self, path: &VirtualPath, spec: &PackageSpec) -> FileResult<PathBuf> {
|
||||
let path = get_package_path(path, spec);
|
||||
Ok(path.realize(&self.context.config.get_full_common_path()))
|
||||
path.realize(&self.context.config.get_full_common_path())
|
||||
.map_err(FileError::Realize)
|
||||
}
|
||||
|
||||
fn resolve_preview_file(&self, path: &VirtualPath, spec: &PackageSpec) -> FileResult<PathBuf> {
|
||||
let package_path = self.get_package(spec)?;
|
||||
Ok(path.realize(&package_path))
|
||||
path.realize(&package_path).map_err(FileError::Realize)
|
||||
}
|
||||
|
||||
fn get_package(&self, spec: &PackageSpec) -> PackageResult<PathBuf> {
|
||||
@ -142,7 +147,9 @@ impl<'a> DocumentWorld<'a> {
|
||||
&VirtualPath::new("").expect("Failed to create empty virtual path"),
|
||||
spec,
|
||||
);
|
||||
let path = path.realize(&self.context.config.packages_root);
|
||||
let path = path
|
||||
.realize(&self.context.config.packages_root)
|
||||
.map_err(|_| PackageError::NotFound(spec.clone()))?;
|
||||
|
||||
if path.exists() {
|
||||
return Ok(path);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user