Skip to content

Cycle context variables #1519

Open
@jg-rp

Description

@jg-rp

Noting that documentation for the cycle tag only mentions cycling through lists of strings, and existing integration tests cover cycling through lists of integers, is the behaviour demonstrated by the following example considered a bug?

require 'liquid'

template = Liquid::Template.parse(
  "{% cycle a, b, c %} {% cycle a, b, c %} {% cycle a, b, c %}")

puts(template.render!({"a" => 1, "b" => 2, "c" => 3}))

Output:

1 1 1

Expected Output:

1 2 3

I can see that the cycle tag was changed with this commit to parse cycle arguments as expressions, rather than treating them as strings. It appears that a string representation of objects returned from parse_expression() doesn't make a good context key.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions