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]
|
[package]
|
||||||
name = "karnaugh"
|
name = "karnaugh"
|
||||||
version = "0.1.4"
|
version = "0.1.5"
|
||||||
edition = "2024"
|
edition = "2024"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
axum = "0.8.7"
|
axum = "0.8.9"
|
||||||
flate2 = "1.1.5"
|
flate2 = "1.1.9"
|
||||||
itertools = "0.14.0"
|
itertools = "0.15.0"
|
||||||
tar = "0.4.44"
|
tar = "0.4.46"
|
||||||
time = "0.3.47"
|
time = "0.3.53"
|
||||||
tokio = { version = "1.48.0", features = ["macros", "rt-multi-thread"] }
|
tokio = { version = "1.53.0", features = ["macros", "rt-multi-thread"] }
|
||||||
tower-http = { version = "0.6.8", features = ["compression-br", "fs", "trace", "set-header"] }
|
tower-http = { version = "0.7.0", features = [
|
||||||
tracing = "0.1.43"
|
"compression-br",
|
||||||
tracing-subscriber = "0.3.22"
|
"fs",
|
||||||
typst-html = { git = "https://github.com/mkorje/typst.git", branch = "mathml" }
|
"trace",
|
||||||
typst-kit = { git = "https://github.com/mkorje/typst.git", branch = "mathml" }
|
"set-header",
|
||||||
typst = { git = "https://github.com/mkorje/typst.git", branch = "mathml" }
|
] }
|
||||||
ureq = "3.1.4"
|
tracing = "0.1.44"
|
||||||
clap = { version = "4.6.0", features = ["derive"] }
|
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": {
|
"nixpkgs": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1773821835,
|
"lastModified": 1784120854,
|
||||||
"narHash": "sha256-TJ3lSQtW0E2JrznGVm8hOQGVpXjJyXY2guAxku2O9A4=",
|
"narHash": "sha256-KesHgItiZPgGX740axSiQLcIQ8D24MDqNpkKYWIek8k=",
|
||||||
"owner": "nixos",
|
"owner": "nixos",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"rev": "b40629efe5d6ec48dd1efba650c797ddbd39ace0",
|
"rev": "753cc8a3a87467296ddd1fa93f0cc3e81120ee46",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
|||||||
@ -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.4";
|
version = "0.1.5";
|
||||||
src = self;
|
src = self;
|
||||||
cargoHash = "sha256-pwZOy+9cnpEskNf4HYC81UbXPJIOnUCtxEKzEVTrNyQ=";
|
cargoLock.lockFile = ./Cargo.lock;
|
||||||
});
|
});
|
||||||
packages.container = pkgs.dockerTools.buildImage {
|
packages.container = pkgs.dockerTools.buildImage {
|
||||||
name = "karnaugh";
|
name = "karnaugh";
|
||||||
@ -47,6 +47,8 @@
|
|||||||
rustc
|
rustc
|
||||||
rustfmt
|
rustfmt
|
||||||
clippy
|
clippy
|
||||||
|
cargo-edit
|
||||||
|
cargo-audit
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@ -10,6 +10,7 @@ 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;
|
||||||
@ -41,12 +42,14 @@ 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))
|
.and_then(|doc| typst_html::html(&doc, &html_options))
|
||||||
.map_err(|err| err.into_iter().collect())
|
.map_err(|err| err.into_iter().collect())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -116,7 +119,8 @@ impl<'a> DocumentWorld<'a> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn resolve_project_file(&self, path: &VirtualPath) -> FileResult<PathBuf> {
|
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> {
|
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> {
|
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);
|
||||||
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> {
|
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)?;
|
||||||
Ok(path.realize(&package_path))
|
path.realize(&package_path).map_err(FileError::Realize)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn get_package(&self, spec: &PackageSpec) -> PackageResult<PathBuf> {
|
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"),
|
&VirtualPath::new("").expect("Failed to create empty virtual path"),
|
||||||
spec,
|
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() {
|
if path.exists() {
|
||||||
return Ok(path);
|
return Ok(path);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user