@@ -688,9 +688,12 @@ impl Renderable for TemplateElement {
688
688
}
689
689
}
690
690
DirectiveExpression ( _) |
691
- DirectiveBlock ( _) |
692
- PartialExpression ( _) |
693
- PartialBlock ( _) => self . eval ( registry, rc) ,
691
+ DirectiveBlock ( _) => self . eval ( registry, rc) ,
692
+ #[ cfg( not( feature="partial_legacy" ) ) ]
693
+ PartialExpression ( ref dt) | PartialBlock ( ref dt) => {
694
+ Directive :: from_template ( dt, registry, rc)
695
+ . and_then ( |di| partial:: expand_partial ( & di, registry, rc) )
696
+ }
694
697
_ => Ok ( ( ) ) ,
695
698
}
696
699
}
@@ -710,11 +713,6 @@ impl Evaluable for TemplateElement {
710
713
}
711
714
} )
712
715
}
713
- #[ cfg( not( feature="partial_legacy" ) ) ]
714
- PartialExpression ( ref dt) | PartialBlock ( ref dt) => {
715
- Directive :: from_template ( dt, registry, rc)
716
- . and_then ( |di| partial:: expand_partial ( & di, registry, rc) )
717
- }
718
716
_ => Ok ( ( ) ) ,
719
717
}
720
718
}
@@ -907,3 +905,16 @@ fn test_render_error_line_no() {
907
905
panic ! ( "Error expected" ) ;
908
906
}
909
907
}
908
+
909
+ #[ test]
910
+ #[ cfg( not( feature="partial_legacy" ) ) ]
911
+ fn test_partial_failback_render ( ) {
912
+ let mut r = Registry :: new ( ) ;
913
+
914
+ assert ! ( r. register_template_string( "parent" , "<html>{{> layout}}</html>" ) . is_ok( ) ) ;
915
+ assert ! ( r. register_template_string( "child" , "{{#*inline \" layout\" }}content{{/inline}}{{#> parent}}{{> seg}}{{/parent}}" ) . is_ok( ) ) ;
916
+ assert ! ( r. register_template_string( "seg" , "1234" ) . is_ok( ) ) ;
917
+
918
+ let r = r. render ( "child" , & true ) . expect ( "should work" ) ;
919
+ assert_eq ! ( r, "<html>content</html>" ) ;
920
+ }
0 commit comments