fix: string element parsing
This commit is contained in:
parent
8a3a3dc099
commit
55130db04a
6 changed files with 22 additions and 3 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -1 +1,2 @@
|
||||||
/target
|
/target
|
||||||
|
*.html
|
||||||
|
|
2
Cargo.lock
generated
2
Cargo.lock
generated
|
@ -4,4 +4,4 @@ version = 4
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "bberry"
|
name = "bberry"
|
||||||
version = "0.1.0"
|
version = "0.1.1"
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
[package]
|
[package]
|
||||||
name = "bberry"
|
name = "bberry"
|
||||||
description = "lisp-like dsl which \"compiles\" into html"
|
description = "lisp-like dsl which \"compiles\" into html"
|
||||||
version = "0.1.0"
|
version = "0.1.1"
|
||||||
edition = "2024"
|
edition = "2024"
|
||||||
authors = ["trisuaso"]
|
authors = ["trisuaso"]
|
||||||
repository = "https://trisua.com/t/bberry.git"
|
repository = "https://trisua.com/t/bberry.git"
|
||||||
|
|
2
examples/string_escape.lisp
Normal file
2
examples/string_escape.lisp
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
('"\"Hello,\" world!")
|
||||||
|
(' "Hello, \"w\"orld!")
|
|
@ -94,7 +94,7 @@ pub fn expr_parser(buf: &str) -> Element {
|
||||||
|
|
||||||
// parse tag first as it is the first thing
|
// parse tag first as it is the first thing
|
||||||
if !finished_parsing_tag {
|
if !finished_parsing_tag {
|
||||||
if (char == ' ') | (char == '\n') {
|
if (char == ' ') | (char == '\n') | (char == '"') {
|
||||||
finished_parsing_tag = true;
|
finished_parsing_tag = true;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
16
src/lib.rs
16
src/lib.rs
|
@ -1,2 +1,18 @@
|
||||||
pub mod core;
|
pub mod core;
|
||||||
pub use core::parser::document as parse;
|
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();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue