fix: string element parsing

This commit is contained in:
trisua 2025-05-30 21:06:35 -04:00
parent 8a3a3dc099
commit 55130db04a
6 changed files with 22 additions and 3 deletions

1
.gitignore vendored
View file

@ -1 +1,2 @@
/target
*.html

2
Cargo.lock generated
View file

@ -4,4 +4,4 @@ version = 4
[[package]]
name = "bberry"
version = "0.1.0"
version = "0.1.1"

View file

@ -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"

View file

@ -0,0 +1,2 @@
('"\"Hello,\" world!")
(' "Hello, \"w\"orld!")

View file

@ -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;
}

View file

@ -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();
}
}