From ebb8e528a2e35442055b5d3d771a93012e977ba6 Mon Sep 17 00:00:00 2001 From: James Prior Date: Wed, 25 Dec 2024 20:11:24 +0000 Subject: [PATCH] Found a few more --- liquid/builtin/tags/decrement_tag.py | 4 +++- liquid/builtin/tags/increment_tag.py | 4 +++- liquid/builtin/tags/render_tag.py | 5 ++++- liquid/extra/tags/if_not.py | 4 +++- 4 files changed, 13 insertions(+), 4 deletions(-) diff --git a/liquid/builtin/tags/decrement_tag.py b/liquid/builtin/tags/decrement_tag.py index 7874f97..4981cb3 100644 --- a/liquid/builtin/tags/decrement_tag.py +++ b/liquid/builtin/tags/decrement_tag.py @@ -63,7 +63,9 @@ def parse(self, stream: TokenStream) -> DecrementNode: tok=tok, identifier=str( parse_unchained_identifier( - ExprTokenStream(tokenize(stream.current.value)) + ExprTokenStream( + tokenize(stream.current.value, stream.current.linenum) + ) ) ), ) diff --git a/liquid/builtin/tags/increment_tag.py b/liquid/builtin/tags/increment_tag.py index 66b3339..3e2f6e4 100644 --- a/liquid/builtin/tags/increment_tag.py +++ b/liquid/builtin/tags/increment_tag.py @@ -59,7 +59,9 @@ def parse(self, stream: TokenStream) -> IncrementNode: tok=tok, identifier=str( parse_unchained_identifier( - ExprTokenStream(tokenize(stream.current.value)) + ExprTokenStream( + tokenize(stream.current.value, stream.current.linenum) + ) ) ), ) diff --git a/liquid/builtin/tags/render_tag.py b/liquid/builtin/tags/render_tag.py index de58e9e..491f76f 100644 --- a/liquid/builtin/tags/render_tag.py +++ b/liquid/builtin/tags/render_tag.py @@ -1,4 +1,5 @@ """Parse tree node and tag definition for the built in "render" tag.""" + import sys from typing import Dict from typing import List @@ -249,7 +250,9 @@ class RenderTag(Tag): def parse(self, stream: TokenStream) -> Node: tok = next(stream) expect(stream, TOKEN_EXPRESSION) - expr_stream = ExprTokenStream(tokenize(stream.current.value)) + expr_stream = ExprTokenStream( + tokenize(stream.current.value, stream.current.linenum) + ) # Need a string. 'render' does not accept identifiers that resolve to a string. # This is the name of the template to be included. diff --git a/liquid/extra/tags/if_not.py b/liquid/extra/tags/if_not.py index 821db7c..2a31eb6 100644 --- a/liquid/extra/tags/if_not.py +++ b/liquid/extra/tags/if_not.py @@ -20,4 +20,6 @@ class IfNotTag(IfTag): def parse_expression(self, stream: TokenStream) -> Expression: """Pare a boolean expression from a stream of tokens.""" expect(stream, TOKEN_EXPRESSION) - return parse_boolean_expression_with_parens(stream.current.value) + return parse_boolean_expression_with_parens( + stream.current.value, stream.current.linenum + )