Make the dust template parser all_consuming.

This commit is contained in:
Tom Alexander 2020-05-25 14:17:38 -04:00
parent 5b2ac7c2c2
commit 8121c93392
Signed by: talexander
GPG Key ID: D3A179C9A53C0EDE
2 changed files with 1 additions and 2 deletions

View File

@ -698,7 +698,7 @@ fn body(i: &str) -> IResult<&str, Body> {
pub fn template(i: &str) -> IResult<&str, Template> {
// DustJS ignores all preceding whitespace (tabs, newlines, spaces) but only ignores trailing newlines
let (remaining, contents) = delimited(multispace0, body, eof_whitespace)(i)?;
let (remaining, contents) = all_consuming(delimited(multispace0, body, eof_whitespace))(i)?;
Ok((remaining, Template { contents: contents }))
}

View File

@ -33,7 +33,6 @@ pub fn compile_template<'a>(
source: &'a str,
name: String,
) -> Result<CompiledTemplate<'a>, CompileError> {
// TODO: Make this all consuming
// TODO: This could use better error management
let (_remaining, parsed_template) = template(source).expect("Failed to compile template");
Ok(CompiledTemplate {