aboutsummaryrefslogtreecommitdiffstats
path: root/askama_derive
diff options
context:
space:
mode:
authorLibravatar Dirkjan Ochtman <dirkjan@ochtman.nl>2018-06-22 20:23:38 +0200
committerLibravatar Dirkjan Ochtman <dirkjan@ochtman.nl>2018-06-22 20:23:38 +0200
commitafb44f01576d5a1cae7fbbed145f5af6f176536b (patch)
tree667532170ea17290aad7b18c684b0a7dcfd50233 /askama_derive
parent845a33d4327a2a4b59edc4af115a80ef4ca3d09c (diff)
downloadaskama-afb44f01576d5a1cae7fbbed145f5af6f176536b.tar.gz
askama-afb44f01576d5a1cae7fbbed145f5af6f176536b.tar.bz2
askama-afb44f01576d5a1cae7fbbed145f5af6f176536b.zip
Disallow user-defined macros named 'super'
Diffstat (limited to 'askama_derive')
-rw-r--r--askama_derive/src/parser.rs23
1 files changed, 14 insertions, 9 deletions
diff --git a/askama_derive/src/parser.rs b/askama_derive/src/parser.rs
index fb591d4..96e0f09 100644
--- a/askama_derive/src/parser.rs
+++ b/askama_derive/src/parser.rs
@@ -623,15 +623,20 @@ named!(block_macro<Input, Node>, do_parse!(
pws2: opt!(tag_s!("-")) >>
ws!(tag_s!("endmacro")) >>
nws2: opt!(tag_s!("-")) >>
- (Node::Macro(
- name,
- Macro {
- ws1: WS(pws1.is_some(), nws1.is_some()),
- args: params,
- nodes: contents,
- ws2: WS(pws2.is_some(), nws2.is_some())
- }
- ))
+ ({
+ if name == "super" {
+ panic!("invalid macro name 'super'");
+ }
+ Node::Macro(
+ name,
+ Macro {
+ ws1: WS(pws1.is_some(), nws1.is_some()),
+ args: params,
+ nodes: contents,
+ ws2: WS(pws2.is_some(), nws2.is_some())
+ }
+ )
+ })
));
named!(block_node<Input, Node>, do_parse!(