From 86ce56fa0ec2e9d4aba26fba016e28f00b06307b Mon Sep 17 00:00:00 2001 From: RGBCube Date: Mon, 8 Jan 2024 16:50:42 +0300 Subject: [PATCH] Small experiment --- Cargo.lock | 17 +++++++++++++---- Cargo.toml | 1 + src/routes/markdown.rs | 6 +++--- 3 files changed, 17 insertions(+), 7 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 16bfebd..fa33895 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -376,7 +376,7 @@ checksum = "a26ae43d7bcc3b814de94796a5e736d4029efb0ee900c12e2d54c993ad1a1e07" [[package]] name = "embed" version = "0.1.0" -source = "git+https://github.com/RGBCube/embed-rs#7c41253f4f6006fcc2aad189c19132d2f0cccec2" +source = "git+https://github.com/RGBCube/embed-rs#d1a0e9a7931c65407a9348e980236b58595f21c6" dependencies = [ "embed-macros", ] @@ -384,7 +384,7 @@ dependencies = [ [[package]] name = "embed-macros" version = "0.1.0" -source = "git+https://github.com/RGBCube/embed-rs#7c41253f4f6006fcc2aad189c19132d2f0cccec2" +source = "git+https://github.com/RGBCube/embed-rs#d1a0e9a7931c65407a9348e980236b58595f21c6" dependencies = [ "proc-macro2", "quote", @@ -930,6 +930,14 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" +[[package]] +name = "proc-file" +version = "1.0.0" +source = "git+https://github.com/RGBCube/proc-file#c514ea1841b5ca5f86ecb2fa8173879683824b36" +dependencies = [ + "proc-macro2", +] + [[package]] name = "proc-macro-error" version = "1.0.4" @@ -1222,6 +1230,7 @@ dependencies = [ "maud", "mime_guess", "minify-js", + "proc-file", "pulldown-cmark", "serde", "serde_yaml", @@ -1263,9 +1272,9 @@ checksum = "6980e8d7511241f8acf4aebddbb1ff938df5eebe98691418c4468d0b72a96a67" [[package]] name = "strsim" -version = "0.10.1" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ccbca6f34534eb78dbee83f6b2c9442fea7113f43d9e80ea320f0972ae5dc08d" +checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" [[package]] name = "syn" diff --git a/Cargo.toml b/Cargo.toml index ea1043b..7fbc6aa 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -24,6 +24,7 @@ log = { version = "0.4.20", features = [ "serde" ] } maud = { git = "https://github.com/lambda-fairy/maud", features = [ "axum" ] } mime_guess = "2.0.4" minify-js = "0.6.0" +proc-file = { git = "https://github.com/RGBCube/proc-file" } pulldown-cmark = "0.9.3" serde = { version = "1.0.195", features = [ "derive" ] } serde_yaml = "0.9.30" diff --git a/src/routes/markdown.rs b/src/routes/markdown.rs index f15e5a4..cd9818d 100644 --- a/src/routes/markdown.rs +++ b/src/routes/markdown.rs @@ -26,14 +26,14 @@ pub struct Metadata { } pub static PAGES: LazyLock> = LazyLock::new(|| { - let routes_path = path::Path::new(file!()) + let routes_path = dbg!(path::Path::new(proc_file::file!()) .parent() .unwrap() .canonicalize() - .unwrap(); + .unwrap()); HashMap::from_iter(embed::dir!(".").flatten().iter().filter_map(|file| { - let path = path::Path::new(file.path().as_ref()) + let path = dbg!(path::Path::new(file.path().as_ref())) .strip_prefix(&routes_path) .unwrap() .to_str()