aboutsummaryrefslogtreecommitdiff
path: root/web/mastosan
diff options
context:
space:
mode:
authorXe <me@christine.website>2022-11-22 15:10:07 -0500
committerXe <me@christine.website>2022-11-22 15:10:07 -0500
commitc87eb51e0afe78a958eecaffb83318f91c6f78dd (patch)
tree42c3ee82beae8fb1320dd3e175cf9472b6a8e34e /web/mastosan
parentaf9abc4c341e9dc15b60b315269ffd31ce236ba7 (diff)
downloadx-c87eb51e0afe78a958eecaffb83318f91c6f78dd.tar.xz
x-c87eb51e0afe78a958eecaffb83318f91c6f78dd.zip
web/mastosan: snip use of formatting code
Signed-off-by: Xe <me@christine.website>
Diffstat (limited to 'web/mastosan')
-rw-r--r--web/mastosan/README.md2
-rw-r--r--web/mastosan/mastosan.go2
-rw-r--r--web/mastosan/src/main.rs4
-rw-r--r--web/mastosan/testdata/mastosan.wasmbin460001 -> 402296 bytes
4 files changed, 5 insertions, 3 deletions
diff --git a/web/mastosan/README.md b/web/mastosan/README.md
index f3c5a00..d67fb3a 100644
--- a/web/mastosan/README.md
+++ b/web/mastosan/README.md
@@ -15,7 +15,7 @@ To build the Rust module from inside the Nix flake:
cargo install wasm-snip
cargo build --release
wasm-opt -Oz -o ./testdata/mastosan-pre-snip.wasm
- wasm-snip --skip-producers-section --snip-rust-panicking-code -i ./testdata/mastosan-pre-snip.wasm ./testdata/mastosan.wasm
+ wasm-snip --skip-producers-section --snip-rust-panicking-code --snip-rust-fmt-code -i ./testdata/mastosan-pre-snip.wasm ./testdata/mastosan.wasm
rm ./testdata/mastosan-pre-snip.wasm
This adds about two megabytes to the resulting binary, including the AOT
diff --git a/web/mastosan/mastosan.go b/web/mastosan/mastosan.go
index 87bee1d..5ded39f 100644
--- a/web/mastosan/mastosan.go
+++ b/web/mastosan/mastosan.go
@@ -13,7 +13,7 @@
// cargo install wasm-snip
// cargo build --release
// wasm-opt -Oz -o ./testdata/mastosan-pre-snip.wasm
-// wasm-snip --skip-producers-section --snip-rust-panicking-code -i ./testdata/mastosan-pre-snip.wasm ./testdata/mastosan.wasm
+// wasm-snip --skip-producers-section --snip-rust-panicking-code --snip-rust-fmt-code -i ./testdata/mastosan-pre-snip.wasm ./testdata/mastosan.wasm
// rm ./testdata/mastosan-pre-snip.wasm
//
// This adds about two megabytes to the resulting binary, including the AOT
diff --git a/web/mastosan/src/main.rs b/web/mastosan/src/main.rs
index 7535129..a69e24a 100644
--- a/web/mastosan/src/main.rs
+++ b/web/mastosan/src/main.rs
@@ -22,7 +22,9 @@ fn main() -> io::Result<()> {
}),
element!("a[href]", |el| {
let href = el.get_attribute("href").unwrap();
- el.prepend(&format!("<{href}|"), ContentType::Html);
+ el.prepend("|", ContentType::Html);
+ el.prepend(&href, ContentType::Html);
+ el.prepend("<", ContentType::Html);
el.append(">", ContentType::Html);
el.remove_and_keep_content();
diff --git a/web/mastosan/testdata/mastosan.wasm b/web/mastosan/testdata/mastosan.wasm
index 59f88d0..218ee48 100644
--- a/web/mastosan/testdata/mastosan.wasm
+++ b/web/mastosan/testdata/mastosan.wasm
Binary files differ