Compare commits
4 Commits
e6cc71fa47
...
51173860be
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
51173860be | ||
|
|
b157941d5e | ||
|
|
1efb44206b | ||
|
|
e193f96709 |
1320
Cargo.lock
generated
1320
Cargo.lock
generated
File diff suppressed because it is too large
Load Diff
35
Cargo.toml
35
Cargo.toml
@ -1,20 +1,25 @@
|
||||
[package]
|
||||
name = "karnaugh"
|
||||
version = "0.1.4"
|
||||
version = "0.1.5"
|
||||
edition = "2024"
|
||||
|
||||
[dependencies]
|
||||
axum = "0.8.7"
|
||||
flate2 = "1.1.5"
|
||||
itertools = "0.14.0"
|
||||
tar = "0.4.44"
|
||||
time = "0.3.47"
|
||||
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" }
|
||||
ureq = "3.1.4"
|
||||
clap = { version = "4.6.0", features = ["derive"] }
|
||||
axum = "0.8.9"
|
||||
flate2 = "1.1.9"
|
||||
itertools = "0.15.0"
|
||||
tar = "0.4.46"
|
||||
time = "0.3.53"
|
||||
tokio = { version = "1.53.0", features = ["macros", "rt-multi-thread"] }
|
||||
tower-http = { version = "0.7.0", features = [
|
||||
"compression-br",
|
||||
"fs",
|
||||
"trace",
|
||||
"set-header",
|
||||
] }
|
||||
tracing = "0.1.44"
|
||||
tracing-subscriber = "0.3.23"
|
||||
typst-html = "0.15.1"
|
||||
typst-kit = "0.15.1"
|
||||
typst = "0.15.1"
|
||||
ureq = "3.3.0"
|
||||
clap = { version = "4.6.2", features = ["derive"] }
|
||||
|
||||
6
flake.lock
generated
6
flake.lock
generated
@ -20,11 +20,11 @@
|
||||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1773821835,
|
||||
"narHash": "sha256-TJ3lSQtW0E2JrznGVm8hOQGVpXjJyXY2guAxku2O9A4=",
|
||||
"lastModified": 1784120854,
|
||||
"narHash": "sha256-KesHgItiZPgGX740axSiQLcIQ8D24MDqNpkKYWIek8k=",
|
||||
"owner": "nixos",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "b40629efe5d6ec48dd1efba650c797ddbd39ace0",
|
||||
"rev": "753cc8a3a87467296ddd1fa93f0cc3e81120ee46",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
||||
@ -21,9 +21,9 @@
|
||||
rec {
|
||||
packages.karnaugh = pkgs.rustPlatform.buildRustPackage (final: {
|
||||
pname = "karnaugh";
|
||||
version = "0.1.4";
|
||||
version = "0.1.5";
|
||||
src = self;
|
||||
cargoHash = "sha256-pwZOy+9cnpEskNf4HYC81UbXPJIOnUCtxEKzEVTrNyQ=";
|
||||
cargoLock.lockFile = ./Cargo.lock;
|
||||
});
|
||||
packages.container = pkgs.dockerTools.buildImage {
|
||||
name = "karnaugh";
|
||||
@ -47,6 +47,8 @@
|
||||
rustc
|
||||
rustfmt
|
||||
clippy
|
||||
cargo-edit
|
||||
cargo-audit
|
||||
];
|
||||
};
|
||||
}
|
||||
|
||||
@ -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