From 203d859eec69b78ddd1e5169d3a0f8613a31eb88 Mon Sep 17 00:00:00 2001 From: norohind <60548839+norohind@users.noreply.github.com> Date: Thu, 16 Dec 2021 14:47:52 +0300 Subject: [PATCH] templates_engine: regexp, don't be greedy --- templates_engine.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/templates_engine.py b/templates_engine.py index 7324d4e..00957aa 100644 --- a/templates_engine.py +++ b/templates_engine.py @@ -7,8 +7,8 @@ from os.path import join import re templates_dir = 'templates' -variable_pattern: re.Pattern = re.compile(r'\{\{ .* }}') -include_pattern: re.Pattern = re.compile(r'\{\{ @.* }}') +variable_pattern: re.Pattern = re.compile(r'{{ .*? }}') +include_pattern: re.Pattern = re.compile(r'{{ @.*? }}') def render(template_name: str, context: dict):