Compare commits

..

No commits in common. "51173860be8513cffd04671df64f893772bd1c3d" and "e6cc71fa47abf23063b0c3f3665a228cfd7b08ae" have entirely different histories.

5 changed files with 696 additions and 676 deletions

1308
Cargo.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -1,25 +1,20 @@
[package] [package]
name = "karnaugh" name = "karnaugh"
version = "0.1.5" version = "0.1.4"
edition = "2024" edition = "2024"
[dependencies] [dependencies]
axum = "0.8.9" axum = "0.8.7"
flate2 = "1.1.9" flate2 = "1.1.5"
itertools = "0.15.0" itertools = "0.14.0"
tar = "0.4.46" tar = "0.4.44"
time = "0.3.53" time = "0.3.47"
tokio = { version = "1.53.0", features = ["macros", "rt-multi-thread"] } tokio = { version = "1.48.0", features = ["macros", "rt-multi-thread"] }
tower-http = { version = "0.7.0", features = [ tower-http = { version = "0.6.8", features = ["compression-br", "fs", "trace", "set-header"] }
"compression-br", tracing = "0.1.43"
"fs", tracing-subscriber = "0.3.22"
"trace", typst-html = { git = "https://github.com/mkorje/typst.git", branch = "mathml" }
"set-header", typst-kit = { git = "https://github.com/mkorje/typst.git", branch = "mathml" }
] } typst = { git = "https://github.com/mkorje/typst.git", branch = "mathml" }
tracing = "0.1.44" ureq = "3.1.4"
tracing-subscriber = "0.3.23" clap = { version = "4.6.0", features = ["derive"] }
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
View File

@ -20,11 +20,11 @@
}, },
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1784120854, "lastModified": 1773821835,
"narHash": "sha256-KesHgItiZPgGX740axSiQLcIQ8D24MDqNpkKYWIek8k=", "narHash": "sha256-TJ3lSQtW0E2JrznGVm8hOQGVpXjJyXY2guAxku2O9A4=",
"owner": "nixos", "owner": "nixos",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "753cc8a3a87467296ddd1fa93f0cc3e81120ee46", "rev": "b40629efe5d6ec48dd1efba650c797ddbd39ace0",
"type": "github" "type": "github"
}, },
"original": { "original": {

View File

@ -21,9 +21,9 @@
rec { rec {
packages.karnaugh = pkgs.rustPlatform.buildRustPackage (final: { packages.karnaugh = pkgs.rustPlatform.buildRustPackage (final: {
pname = "karnaugh"; pname = "karnaugh";
version = "0.1.5"; version = "0.1.4";
src = self; src = self;
cargoLock.lockFile = ./Cargo.lock; cargoHash = "sha256-pwZOy+9cnpEskNf4HYC81UbXPJIOnUCtxEKzEVTrNyQ=";
}); });
packages.container = pkgs.dockerTools.buildImage { packages.container = pkgs.dockerTools.buildImage {
name = "karnaugh"; name = "karnaugh";
@ -47,8 +47,6 @@
rustc rustc
rustfmt rustfmt
clippy clippy
cargo-edit
cargo-audit
]; ];
}; };
} }

View File

@ -10,7 +10,6 @@ use typst::{
text::{Font, FontBook}, text::{Font, FontBook},
utils::LazyHash, utils::LazyHash,
}; };
use typst_html::HtmlOptions;
use typst_kit::fonts::FontStore; use typst_kit::fonts::FontStore;
use crate::AppConfig; use crate::AppConfig;
@ -42,14 +41,12 @@ impl TypstContext {
let world = DocumentWorld::new(path, self); let world = DocumentWorld::new(path, self);
let compiled = typst::compile(&world); let compiled = typst::compile(&world);
let html_options = HtmlOptions::default();
// TODO: Log warnings // TODO: Log warnings
// TODO: Log errors // TODO: Log errors
compiled compiled
.output .output
.and_then(|doc| typst_html::html(&doc, &html_options)) .and_then(|doc| typst_html::html(&doc))
.map_err(|err| err.into_iter().collect()) .map_err(|err| err.into_iter().collect())
} }
} }
@ -119,8 +116,7 @@ impl<'a> DocumentWorld<'a> {
} }
fn resolve_project_file(&self, path: &VirtualPath) -> FileResult<PathBuf> { fn resolve_project_file(&self, path: &VirtualPath) -> FileResult<PathBuf> {
path.realize(&self.context.config.content_root) Ok(path.realize(&self.context.config.content_root))
.map_err(FileError::Realize)
} }
fn resolve_package_file(&self, path: &VirtualPath, spec: &PackageSpec) -> FileResult<PathBuf> { fn resolve_package_file(&self, path: &VirtualPath, spec: &PackageSpec) -> FileResult<PathBuf> {
@ -133,13 +129,12 @@ impl<'a> DocumentWorld<'a> {
fn resolve_common_file(&self, path: &VirtualPath, spec: &PackageSpec) -> FileResult<PathBuf> { fn resolve_common_file(&self, path: &VirtualPath, spec: &PackageSpec) -> FileResult<PathBuf> {
let path = get_package_path(path, spec); let path = get_package_path(path, spec);
path.realize(&self.context.config.get_full_common_path()) Ok(path.realize(&self.context.config.get_full_common_path()))
.map_err(FileError::Realize)
} }
fn resolve_preview_file(&self, path: &VirtualPath, spec: &PackageSpec) -> FileResult<PathBuf> { fn resolve_preview_file(&self, path: &VirtualPath, spec: &PackageSpec) -> FileResult<PathBuf> {
let package_path = self.get_package(spec)?; let package_path = self.get_package(spec)?;
path.realize(&package_path).map_err(FileError::Realize) Ok(path.realize(&package_path))
} }
fn get_package(&self, spec: &PackageSpec) -> PackageResult<PathBuf> { fn get_package(&self, spec: &PackageSpec) -> PackageResult<PathBuf> {
@ -147,9 +142,7 @@ impl<'a> DocumentWorld<'a> {
&VirtualPath::new("").expect("Failed to create empty virtual path"), &VirtualPath::new("").expect("Failed to create empty virtual path"),
spec, spec,
); );
let path = path let path = path.realize(&self.context.config.packages_root);
.realize(&self.context.config.packages_root)
.map_err(|_| PackageError::NotFound(spec.clone()))?;
if path.exists() { if path.exists() {
return Ok(path); return Ok(path);