diff --git a/.gitignore b/.gitignore index ea8c4bf..6bae391 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ /target +*.html diff --git a/Cargo.lock b/Cargo.lock index d075642..67d8bce 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4,4 +4,4 @@ version = 4 [[package]] name = "bberry" -version = "0.1.0" +version = "0.1.1" diff --git a/Cargo.toml b/Cargo.toml index 7072194..2e9aaaf 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "bberry" description = "lisp-like dsl which \"compiles\" into html" -version = "0.1.0" +version = "0.1.1" edition = "2024" authors = ["trisuaso"] repository = "https://trisua.com/t/bberry.git" diff --git a/examples/string_escape.lisp b/examples/string_escape.lisp new file mode 100644 index 0000000..2e5ea26 --- /dev/null +++ b/examples/string_escape.lisp @@ -0,0 +1,2 @@ +('"\"Hello,\" world!") +(' "Hello, \"w\"orld!") diff --git a/src/core/parser.rs b/src/core/parser.rs index 4384e02..1cf2951 100644 --- a/src/core/parser.rs +++ b/src/core/parser.rs @@ -94,7 +94,7 @@ pub fn expr_parser(buf: &str) -> Element { // parse tag first as it is the first thing if !finished_parsing_tag { - if (char == ' ') | (char == '\n') { + if (char == ' ') | (char == '\n') | (char == '"') { finished_parsing_tag = true; continue; } diff --git a/src/lib.rs b/src/lib.rs index 9300be0..b682f4c 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,2 +1,18 @@ pub mod core; pub use core::parser::document as parse; + +#[cfg(test)] +mod test { + use crate::{core::element::Render, parse}; + + #[test] + fn string_escape() { + std::fs::write( + "string_escape.html", + parse(&std::fs::read_to_string("examples/string_escape.lisp").unwrap()) + .0 + .render(), + ) + .unwrap(); + } +}