diff options
author | Guillaume Gomez <guillaume1.gomez@gmail.com> | 2023-10-24 11:06:16 +0200 |
---|---|---|
committer | Dirkjan Ochtman <dirkjan@ochtman.nl> | 2023-10-25 14:30:35 +0200 |
commit | c056d6287b0616aea9bc9fab43bcca97d0e86d23 (patch) | |
tree | c2508394ec80082039e6d2fe1c7217f50c0c98af /askama_parser/src | |
parent | c3281e353d8192e6425f903216eeb6ecf9dd39fc (diff) | |
download | askama-c056d6287b0616aea9bc9fab43bcca97d0e86d23.tar.gz askama-c056d6287b0616aea9bc9fab43bcca97d0e86d23.tar.bz2 askama-c056d6287b0616aea9bc9fab43bcca97d0e86d23.zip |
Improve error for invalid name used in `endmacro`
Diffstat (limited to 'askama_parser/src')
-rw-r--r-- | askama_parser/src/node.rs | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/askama_parser/src/node.rs b/askama_parser/src/node.rs index b321c80..93fca73 100644 --- a/askama_parser/src/node.rs +++ b/askama_parser/src/node.rs @@ -484,7 +484,13 @@ impl<'a> Macro<'a> { |i| s.tag_block_start(i), opt(Whitespace::parse), ws(keyword("endmacro")), - cut(preceded(ws(opt(keyword(name))), opt(Whitespace::parse))), + cut(preceded( + opt(|before| { + let (after, end_name) = ws(identifier)(before)?; + check_end_name(before, after, name, end_name, "macro") + }), + opt(Whitespace::parse), + )), ))), ))); let (i, (contents, (_, pws2, _, nws2))) = end(i)?; |