This commit is contained in:
2025-11-03 23:10:42 -08:00
parent 265e30f438
commit 8be830d36f
4 changed files with 9 additions and 24 deletions

View File

@@ -4,14 +4,6 @@ version = { workspace = true }
rust-version = { workspace = true } rust-version = { workspace = true }
edition = { workspace = true } edition = { workspace = true }
# Only for ort
[profile.dev]
rpath = true
[profile.release]
rpath = true
[lints] [lints]
workspace = true workspace = true

View File

@@ -86,15 +86,7 @@ use syn::{LitStr, parse_macro_input};
#[proc_macro] #[proc_macro]
pub fn sass(input: TokenStream) -> TokenStream { pub fn sass(input: TokenStream) -> TokenStream {
let input_lit = parse_macro_input!(input as LitStr); let input_lit = parse_macro_input!(input as LitStr);
let file_path = PathBuf::from(input_lit.value());
let file_path = match PathBuf::try_from(input_lit.value()) {
Ok(x) => x,
Err(e) => {
return syn::Error::new(input_lit.span(), format!("Invalid path: {e}"))
.to_compile_error()
.into();
}
};
// Not stable yet, we have to use crate-relative paths :( // Not stable yet, we have to use crate-relative paths :(
//let span = proc_macro::Span::call_site(); //let span = proc_macro::Span::call_site();
@@ -108,7 +100,7 @@ pub fn sass(input: TokenStream) -> TokenStream {
// First, try to read and compile the file at macro expansion time // First, try to read and compile the file at macro expansion time
// The path is interpreted relative to CARGO_MANIFEST_DIR // The path is interpreted relative to CARGO_MANIFEST_DIR
let manifest_dir = std::env::var("CARGO_MANIFEST_DIR").unwrap_or_else(|_| ".".to_string()); let manifest_dir = std::env::var("CARGO_MANIFEST_DIR").unwrap_or_else(|_| ".".to_owned());
let full_path = std::path::Path::new(&manifest_dir).join(&file_path); let full_path = std::path::Path::new(&manifest_dir).join(&file_path);
let css = match grass::from_path(&full_path, &grass::Options::default()) { let css = match grass::from_path(&full_path, &grass::Options::default()) {

View File

@@ -2,8 +2,6 @@ use maud::{Markup, Render, html};
use strum::{Display, EnumString}; use strum::{Display, EnumString};
#[derive(Debug, Clone, Copy, EnumString, Display)] #[derive(Debug, Clone, Copy, EnumString, Display)]
#[expect(clippy::allow_attributes)]
#[allow(dead_code)]
#[strum(serialize_all = "snake_case")] #[strum(serialize_all = "snake_case")]
pub enum FAIcon { pub enum FAIcon {
Github, Github,

View File

@@ -17,7 +17,7 @@ impl Render for Markdown<'_> {
md.inline.add_rule::<InlineEmote>(); md.inline.add_rule::<InlineEmote>();
md.inline.add_rule::<InlineMdx>(); md.inline.add_rule::<InlineMdx>();
let md = md.parse(&self.0); let md = md.parse(self.0);
let html = md.render(); let html = md.render();
return PreEscaped(html); return PreEscaped(html);
@@ -165,14 +165,17 @@ fn mdx_style(mdx: &str, _node: &Node, fmt: &mut dyn Renderer) -> bool {
return false; return false;
} }
#[expect(clippy::unwrap_used)] // Checked previously
let k = k.unwrap().trim(); let k = k.unwrap().trim();
#[expect(clippy::unwrap_used)] // Checked previously
let v = v.unwrap().trim(); let v = v.unwrap().trim();
match k { match k {
"color" => { "color" => {
style_str.push_str("color:"); style_str.push_str("color:");
style_str.push_str(v); style_str.push_str(v);
style_str.push_str(";"); style_str.push(';');
} }
"color_var" => { "color_var" => {
@@ -188,7 +191,7 @@ fn mdx_style(mdx: &str, _node: &Node, fmt: &mut dyn Renderer) -> bool {
// Only works with text, could be reworked to do basic md styling // Only works with text, could be reworked to do basic md styling
// (italics, bold, tab, code) // (italics, bold, tab, code)
fmt.open("span", &[("style", style_str)]); fmt.open("span", &[("style", style_str)]);
fmt.text(&content); fmt.text(content);
fmt.close("span"); fmt.close("span");
return true; return true;
@@ -225,7 +228,7 @@ fn mdx_include(mdx: &str, _node: &Node, fmt: &mut dyn Renderer) -> bool {
let args = mdx[skip..end].trim(); let args = mdx[skip..end].trim();
let trail = mdx[end + 1..].trim(); let trail = mdx[end + 1..].trim();
if trail != "" { if !trail.is_empty() {
return false; return false;
} }