generated from SillyFreak/typst-package-template
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge package history from monorepo into new template
- Loading branch information
Showing
18 changed files
with
297 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
[build] | ||
target = ["wasm32-unknown-unknown"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
target/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
[workspace] | ||
resolver = "2" | ||
|
||
members = [ | ||
"plugin", | ||
] | ||
|
||
[profile.release] | ||
lto = true # Enable link-time optimization | ||
strip = true # Strip symbols from binary* | ||
opt-level = 'z' # Optimize for size | ||
codegen-units = 1 # Reduce number of codegen units to increase optimizations | ||
panic = 'abort' # Abort on panic |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
assets/ |
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
// make the PDF reproducible to ease version control | ||
#set document(date: none) | ||
|
||
#import "/src/lib.typ": plantuml-url, plantuml-source | ||
#import "@preview/prequery:0.1.0" | ||
// #import "@preview/pre-plantuml:0.0.1": plantuml-url, plantuml-source | ||
|
||
// toggle this comment or pass `--input prequery-fallback=true` to enable fallback | ||
// #prequery.fallback.update(true) | ||
|
||
#let plantuml = plantuml-url.with("https://www.plantuml.com/plantuml/png/") | ||
|
||
= Test | ||
|
||
#plantuml("assets/uml.png", ``` | ||
@startuml | ||
PUML -> RUST: HELLO | ||
@enduml | ||
```) | ||
|
||
#plantuml-source("assets/uml.png", ``` | ||
@startuml | ||
PUML -> RUST: HELLO | ||
@enduml | ||
```) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
[package] | ||
name = "plantuml-url" | ||
version = "0.1.0" | ||
edition = "2021" | ||
|
||
[lib] | ||
crate-type = ["cdylib"] | ||
|
||
[dependencies] | ||
wasm-minimal-protocol = { git = "https://github.com/astrale-sharp/wasm-minimal-protocol" } | ||
plantuml_encoding = "2.0.3" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
use std::str; | ||
|
||
use wasm_minimal_protocol::*; | ||
use plantuml_encoding::encode_plantuml_deflate; | ||
|
||
initiate_protocol!(); | ||
|
||
#[wasm_func] | ||
pub fn encode(source: &[u8]) -> Vec<u8> { | ||
match encode_impl(source) { | ||
Ok(result) => { | ||
let mut result = result.into_bytes(); | ||
result.insert(0, 1u8); | ||
result | ||
} | ||
Err(result) => { | ||
let mut result = result.into_bytes(); | ||
result.insert(0, 0u8); | ||
result | ||
} | ||
} | ||
} | ||
|
||
fn encode_impl(source: &[u8]) -> Result<String, String> { | ||
let source = str::from_utf8(source).map_err(|err| format!("{:?}", err))?; | ||
let encoded = encode_plantuml_deflate(source).map_err(|err| err.0)?; | ||
|
||
Ok(encoded) | ||
} |
Oops, something went wrong.