mirror of
https://github.com/Shopify/liquid.git
synced 2026-09-29 07:05:12 -07:00
wip
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
# @public_docs
|
||||||
module Liquid
|
module Liquid
|
||||||
# Cycle is usually used within a loop to alternate between values, like colors or DOM classes.
|
# Cycle is usually used within a loop to alternate between values, like colors or DOM classes.
|
||||||
#
|
#
|
||||||
@@ -13,6 +14,16 @@ module Liquid
|
|||||||
# <div class="red"> Item four </div>
|
# <div class="red"> Item four </div>
|
||||||
# <div class="green"> Item five</div>
|
# <div class="green"> Item five</div>
|
||||||
#
|
#
|
||||||
|
# @public_docs
|
||||||
|
# @title Cycle
|
||||||
|
# @syntax The syntax
|
||||||
|
# @summary Loops through a group of strings and prints them in the order that they were passed as arguments.
|
||||||
|
# @type tag
|
||||||
|
# @description
|
||||||
|
# Loops through a group of strings and prints them in the order that they were passed as arguments.
|
||||||
|
# Each time `cycle`` is called, the next string argument is printed.
|
||||||
|
#
|
||||||
|
# `cycle` must be used within a `for`` loop block.
|
||||||
class Cycle < Tag
|
class Cycle < Tag
|
||||||
SimpleSyntax = /\A#{QuotedFragment}+/o
|
SimpleSyntax = /\A#{QuotedFragment}+/o
|
||||||
NamedSyntax = /\A(#{QuotedFragment})\s*\:\s*(.*)/om
|
NamedSyntax = /\A(#{QuotedFragment})\s*\:\s*(.*)/om
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
# @public_docs
|
||||||
module Liquid
|
module Liquid
|
||||||
# "For" iterates over an array or collection.
|
# "For" iterates over an array or collection.
|
||||||
# Several useful variables are available to you within the loop.
|
# Several useful variables are available to you within the loop.
|
||||||
@@ -45,6 +46,12 @@ module Liquid
|
|||||||
# forloop.last:: Returns true if the item is the last item.
|
# forloop.last:: Returns true if the item is the last item.
|
||||||
# forloop.parentloop:: Provides access to the parent loop, if present.
|
# forloop.parentloop:: Provides access to the parent loop, if present.
|
||||||
#
|
#
|
||||||
|
# @public_docs
|
||||||
|
# @title For
|
||||||
|
# @syntax The syntax
|
||||||
|
# @summary Repeatedly executes a block of code.
|
||||||
|
# @type tag
|
||||||
|
# @description The description
|
||||||
class For < Block
|
class For < Block
|
||||||
Syntax = /\A(#{VariableSegment}+)\s+in\s+(#{QuotedFragment}+)\s*(reversed)?/o
|
Syntax = /\A(#{VariableSegment}+)\s+in\s+(#{QuotedFragment}+)\s*(reversed)?/o
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user