From d36937d17f18e076412cef4a1a5acbe418ce9dd0 Mon Sep 17 00:00:00 2001 From: Marco Concetto Rudilosso Date: Tue, 25 Jun 2024 11:44:12 +0200 Subject: [PATCH 1/2] Add named? method to Cycle class for checking if the cycle is named --- lib/liquid/tags/cycle.rb | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/liquid/tags/cycle.rb b/lib/liquid/tags/cycle.rb index 00695265d..2514bf3ba 100644 --- a/lib/liquid/tags/cycle.rb +++ b/lib/liquid/tags/cycle.rb @@ -26,14 +26,20 @@ def initialize(tag_name, markup, options) when NamedSyntax @variables = variables_from_string(Regexp.last_match(2)) @name = parse_expression(Regexp.last_match(1)) + @is_named = true when SimpleSyntax @variables = variables_from_string(markup) @name = @variables.to_s + @is_named = !@name.match?(/\w+:0x\h{8}/) else raise SyntaxError, options[:locale].t("errors.syntax.cycle") end end + def named? + @is_named + end + def render_to_output_buffer(context, output) context.registers[:cycle] ||= {} From d6ca569e8a33604681a1c7da3449906df92bffbb Mon Sep 17 00:00:00 2001 From: Ian Ker-Seymer Date: Tue, 16 Jul 2024 15:55:49 -0400 Subject: [PATCH 2/2] Require `base64` --- Gemfile | 2 ++ Gemfile.lock | 2 ++ 2 files changed, 4 insertions(+) diff --git a/Gemfile b/Gemfile index b5881c4a2..509316c1a 100644 --- a/Gemfile +++ b/Gemfile @@ -7,6 +7,8 @@ end gemspec +gem "base64" + group :benchmark, :test do gem 'benchmark-ips' gem 'memory_profiler' diff --git a/Gemfile.lock b/Gemfile.lock index 66ff47345..cbfda8d4d 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -15,6 +15,7 @@ GEM remote: https://rubygems.org/ specs: ast (2.4.2) + base64 (0.2.0) benchmark-ips (2.13.0) json (2.7.2) language_server-protocol (3.17.0.3) @@ -57,6 +58,7 @@ PLATFORMS ruby DEPENDENCIES + base64 benchmark-ips liquid! liquid-c!