Implement specials in the renderer.

This commit is contained in:
Tom Alexander 2020-05-03 14:52:08 -04:00
parent 7f65e73229
commit cc6dbefcdb
Signed by: talexander
GPG Key ID: D3A179C9A53C0EDE
2 changed files with 12 additions and 0 deletions

View File

@ -6,5 +6,6 @@ pub use parser::template;
pub use parser::Body; pub use parser::Body;
pub use parser::DustTag; pub use parser::DustTag;
pub use parser::Filter; pub use parser::Filter;
pub use parser::Special;
pub use parser::Template; pub use parser::Template;
pub use parser::TemplateElement; pub use parser::TemplateElement;

View File

@ -1,6 +1,7 @@
use crate::parser::template; use crate::parser::template;
use crate::parser::Body; use crate::parser::Body;
use crate::parser::DustTag; use crate::parser::DustTag;
use crate::parser::Special;
use crate::parser::Template; use crate::parser::Template;
use crate::parser::TemplateElement; use crate::parser::TemplateElement;
use crate::renderer::context_element::ContextElement; use crate::renderer::context_element::ContextElement;
@ -145,6 +146,16 @@ impl<'a> DustRenderer<'a> {
} }
} }
} }
DustTag::DTSpecial(special) => {
return Ok(match special {
Special::Space => " ",
Special::NewLine => "\n",
Special::CarriageReturn => "\r",
Special::LeftCurlyBrace => "{",
Special::RightCurlyBrace => "}",
}
.to_owned())
}
_ => (), // TODO: Implement the rest _ => (), // TODO: Implement the rest
} }
Ok("".to_owned()) Ok("".to_owned())