From 273ab8e95a768139b90895f229ad374e402608e3 Mon Sep 17 00:00:00 2001 From: Zach Date: Wed, 12 Oct 2022 21:13:45 -0700 Subject: [PATCH] Add support for partial blocks * Supports partial blocks for use with fallbacks * Supports partial blocks with the {{> @partial-block }} template --- pybars/_compiler.py | 32 ++++++++++++++++++++++++++++---- tests/test_acceptance.py | 36 ++++++++++++++++++++++++++++++++++++ 2 files changed, 64 insertions(+), 4 deletions(-) diff --git a/pybars/_compiler.py b/pybars/_compiler.py index becc692..445282c 100644 --- a/pybars/_compiler.py +++ b/pybars/_compiler.py @@ -72,6 +72,7 @@ | | | + | start ::= '{' '{' finish ::= '}' '}' comment ::= '!' (~() )* => ('comment', ) @@ -124,6 +125,9 @@ | '.' => u'' pathfinish :expected ::= '/' :found ?(found == expected) symbolfinish :expected ::= '/' :found ?(found == expected) +partialfinish :expected ::= '>' :found ?(found == expected) +partialblockrule ::= '#' '>' :i +