Commit edf6e01
Fix single quote issue
Changed files (4)
Diff
@@ -4,7 +4,7 @@ version = 4 [[package]] name = "kaja-html-macro"-version = "1.0.4"+version = "1.0.5" dependencies = [ "proc-macro-error", "proc-macro2",@@ -1,6 +1,6 @@ [package] name = "kaja-html-macro"-version = "1.0.4"+version = "1.0.5" edition = "2024" description = "HTML macro" license = "MIT"@@ -30,6 +30,7 @@ pub enum TokenType { OtherText, Dollar, Quote,+ SingleQuote, Slash, Period, None,@@ -94,6 +95,7 @@ impl<'a> HtmlDynamicLexer<'a> { next if Self::is_other_text(next) => TokenType::OtherText, '$' => TokenType::Dollar, '"' => TokenType::Quote,+ '\'' => TokenType::SingleQuote, '{' => TokenType::StartBracket, '}' => TokenType::EndBracket, '<' => TokenType::StartTag,@@ -129,6 +131,7 @@ impl<'a> HtmlDynamicLexer<'a> { fn is_other_text(character: char) -> bool { match character { '"' => false,+ '\'' => false, '{' => false, '}' => false, '<' => false,@@ -304,3 +304,17 @@ fn test_space_after_var() { println!("Content {}", content); assert!(content.contains("1 minutes")); }++#[test]+fn test_break_quote() {+ let id = "testid";++ let content = html! {{+ <p>+ <button onclick="increment('$id');">Increment</button>+ </p>+ }};++ println!("Content {}", content);+ assert!(content.contains("increment('testid');"));+}