Clone in a terminal:
Commit f7aa71a
Johan Mattsson - 2026-05-26T04:23:57+00:00
f7aa71a1606e41a645133cbeb1ad9aa2952db68ejohan.mattsson.m@gmail.com

Fix white space issue

Changed files (2)

Diff

diff --git a/src/htmlquotes.rs b/src/htmlquotes.rsindex 8e0c955..ae2f294 100644--- a/src/htmlquotes.rs+++ b/src/htmlquotes.rs@@ -2,6 +2,7 @@ // License: MIT  use quote::quote;+use std::alloc::Layout; use std::usize;  use crate::htmlcontentbuilder::{ErrType, HtmlError};@@ -57,6 +58,12 @@ impl<'a> HtmlQuotes<'a> {                 self.add_pass_through(&mut pass_through);                 let variable_expression_tokens = self.process_variables_expression()?;                 self.result.push_str(variable_expression_tokens.as_str());++                if self.current_index > 0 {+                    let last = self.get(self.current_index - 1).unwrap();+                    pass_through.push_str(last.white_space_after.clone().as_str());+                }+                 // advance past  $ ( identifier ) is done in process_variables_expression             } else if self.next_is_variable() {                 self.add_pass_through(&mut pass_through);diff --git a/tests/other.rs b/tests/other.rsindex 7262b77..8fe06b3 100644--- a/tests/other.rs+++ b/tests/other.rs@@ -210,3 +210,27 @@ fn test_include_fn() {      assert!(content.contains("TEST")); }++#[test]+fn test_space() {+    struct Response {+        status: u16,+        elapsed: u64,+    }++    let resp = Response {+        status: 200,+        elapsed: 100,+    };++    let content = html! {{+        <div>Status: $(resp.status) Elapsed: $(resp.elapsed)ms</div>+    }};++    let expected = "Status: 200 Elapsed: 100ms";++    println!("Got: {}", content);+    println!("Expected: {}", expected);++    assert!(content.contains(expected));+}

Contact

Email: johan.mattsson.m@gmail.com
Mastodon: typo.social/@birdfont
GitHub: johanmattssonm
LinkedIn: johan-mattsson-2ab324112