mirror of
https://github.com/Shopify/liquid.git
synced 2026-09-15 08:50:45 -07:00
shaina feedback
This commit is contained in:
@@ -25,7 +25,6 @@ module Liquid
|
||||
# @liquid_public_docs
|
||||
# @liquid_type filter
|
||||
# @liquid_category array
|
||||
# @liquid_name size
|
||||
# @liquid_summary
|
||||
# Returns the size of a string or array.
|
||||
# @liquid_description
|
||||
@@ -40,7 +39,6 @@ module Liquid
|
||||
# @liquid_public_docs
|
||||
# @liquid_type filter
|
||||
# @liquid_category string
|
||||
# @liquid_name downcase
|
||||
# @liquid_summary
|
||||
# Converts a string to all lowercase characters.
|
||||
# @liquid_syntax string | downcase
|
||||
@@ -52,7 +50,6 @@ module Liquid
|
||||
# @liquid_public_docs
|
||||
# @liquid_type filter
|
||||
# @liquid_category string
|
||||
# @liquid_name upcase
|
||||
# @liquid_summary
|
||||
# Converts a string to all uppercase characters.
|
||||
# @liquid_syntax string | upcase
|
||||
@@ -64,7 +61,6 @@ module Liquid
|
||||
# @liquid_public_docs
|
||||
# @liquid_type filter
|
||||
# @liquid_category string
|
||||
# @liquid_name capitalize
|
||||
# @liquid_summary
|
||||
# Capitalizes the first word in a string.
|
||||
# @liquid_syntax string | capitalize
|
||||
@@ -76,7 +72,6 @@ module Liquid
|
||||
# @liquid_public_docs
|
||||
# @liquid_type filter
|
||||
# @liquid_category string
|
||||
# @liquid_name escape
|
||||
# @liquid_summary
|
||||
# Escapes a string.
|
||||
# @liquid_syntax string | escape
|
||||
@@ -89,7 +84,6 @@ module Liquid
|
||||
# @liquid_public_docs
|
||||
# @liquid_type filter
|
||||
# @liquid_category string
|
||||
# @liquid_name escape_once
|
||||
# @liquid_summary
|
||||
# Escapes a string without changing characters that have already been escaped.
|
||||
# @liquid_syntax string | escape_once
|
||||
@@ -101,13 +95,12 @@ module Liquid
|
||||
# @liquid_public_docs
|
||||
# @liquid_type filter
|
||||
# @liquid_category string
|
||||
# @liquid_name url_encode
|
||||
# @liquid_summary
|
||||
# Converts any URL-unsafe characters in a string to the
|
||||
# [percent-encoded](https://developer.mozilla.org/en-US/docs/Glossary/percent-encoding) equivalent.
|
||||
# @liquid_description
|
||||
# > Note:
|
||||
# > Spaces are converted to a `+` charcter, instead of a percent-encoded character.
|
||||
# > Spaces are converted to a `+` character, instead of a percent-encoded character.
|
||||
# @liquid_syntax string | url_encode
|
||||
# @liquid_return [string]
|
||||
def url_encode(input)
|
||||
@@ -117,7 +110,6 @@ module Liquid
|
||||
# @liquid_public_docs
|
||||
# @liquid_type filter
|
||||
# @liquid_category string
|
||||
# @liquid_name url_decode
|
||||
# @liquid_summary
|
||||
# Decodes any [percent-encoded](https://developer.mozilla.org/en-US/docs/Glossary/percent-encoding) characters
|
||||
# in a string.
|
||||
@@ -135,7 +127,6 @@ module Liquid
|
||||
# @liquid_public_docs
|
||||
# @liquid_type filter
|
||||
# @liquid_category string
|
||||
# @liquid_name base64_encode
|
||||
# @liquid_summary
|
||||
# Encodes a string to [Base64 format](https://developer.mozilla.org/en-US/docs/Glossary/Base64).
|
||||
# @liquid_syntax string | base64_encode
|
||||
@@ -147,7 +138,6 @@ module Liquid
|
||||
# @liquid_public_docs
|
||||
# @liquid_type filter
|
||||
# @liquid_category string
|
||||
# @liquid_name base64_decode
|
||||
# @liquid_summary
|
||||
# Decodes a string in [Base64 format](https://developer.mozilla.org/en-US/docs/Glossary/Base64).
|
||||
# @liquid_syntax string | base64_decode
|
||||
@@ -161,7 +151,6 @@ module Liquid
|
||||
# @liquid_public_docs
|
||||
# @liquid_type filter
|
||||
# @liquid_category string
|
||||
# @liquid_name base64_url_safe_encode
|
||||
# @liquid_summary
|
||||
# Encodes a string to URL-safe [Base64 format](https://developer.mozilla.org/en-US/docs/Glossary/Base64).
|
||||
# @liquid_syntax string | base64_url_safe_encode
|
||||
@@ -173,7 +162,6 @@ module Liquid
|
||||
# @liquid_public_docs
|
||||
# @liquid_type filter
|
||||
# @liquid_category string
|
||||
# @liquid_name base64_url_safe_decode
|
||||
# @liquid_summary
|
||||
# Decodes a string in URL-safe [Base64 format](https://developer.mozilla.org/en-US/docs/Glossary/Base64).
|
||||
# @liquid_syntax string | base64_url_safe_decode
|
||||
@@ -187,7 +175,6 @@ module Liquid
|
||||
# @liquid_public_docs
|
||||
# @liquid_type filter
|
||||
# @liquid_category string
|
||||
# @liquid_name slice
|
||||
# @liquid_summary
|
||||
# Returns a substring or series of array items, starting at a given 0-based index.
|
||||
# @liquid_description
|
||||
@@ -211,7 +198,6 @@ module Liquid
|
||||
# @liquid_public_docs
|
||||
# @liquid_type filter
|
||||
# @liquid_category string
|
||||
# @liquid_name truncate
|
||||
# @liquid_summary
|
||||
# Truncates a string down to a given number of characters.
|
||||
# @liquid_description
|
||||
@@ -235,7 +221,6 @@ module Liquid
|
||||
# @liquid_public_docs
|
||||
# @liquid_type filter
|
||||
# @liquid_category string
|
||||
# @liquid_name truncatewords
|
||||
# @liquid_summary
|
||||
# Truncates a string down to a given number of words.
|
||||
# @liquid_description
|
||||
@@ -265,7 +250,6 @@ module Liquid
|
||||
# @liquid_public_docs
|
||||
# @liquid_type filter
|
||||
# @liquid_category string
|
||||
# @liquid_name split
|
||||
# @liquid_summary
|
||||
# Splits a string into an array of substrings based on a given separator.
|
||||
# @liquid_syntax string | split: string
|
||||
@@ -277,7 +261,6 @@ module Liquid
|
||||
# @liquid_public_docs
|
||||
# @liquid_type filter
|
||||
# @liquid_category string
|
||||
# @liquid_name strip
|
||||
# @liquid_summary
|
||||
# Strips all whitespace from the left and right of a string.
|
||||
# @liquid_syntax string | strip
|
||||
@@ -289,7 +272,6 @@ module Liquid
|
||||
# @liquid_public_docs
|
||||
# @liquid_type filter
|
||||
# @liquid_category string
|
||||
# @liquid_name lstrip
|
||||
# @liquid_summary
|
||||
# Strips all whitespace from the left of a string.
|
||||
# @liquid_syntax string | lstrip
|
||||
@@ -301,7 +283,6 @@ module Liquid
|
||||
# @liquid_public_docs
|
||||
# @liquid_type filter
|
||||
# @liquid_category string
|
||||
# @liquid_name rstrip
|
||||
# @liquid_summary
|
||||
# Strips all whitespace from the right of a string.
|
||||
# @liquid_syntax string | rstrip
|
||||
@@ -313,7 +294,6 @@ module Liquid
|
||||
# @liquid_public_docs
|
||||
# @liquid_type filter
|
||||
# @liquid_category string
|
||||
# @liquid_name strip_html
|
||||
# @liquid_summary
|
||||
# Strips all HTML tags from a string.
|
||||
# @liquid_syntax string | strip_html
|
||||
@@ -328,7 +308,6 @@ module Liquid
|
||||
# @liquid_public_docs
|
||||
# @liquid_type filter
|
||||
# @liquid_category string
|
||||
# @liquid_name strip_newlines
|
||||
# @liquid_summary
|
||||
# Strips all newline characters (line breaks) from a string.
|
||||
# @liquid_syntax string | strip_newlines
|
||||
@@ -340,7 +319,6 @@ module Liquid
|
||||
# @liquid_public_docs
|
||||
# @liquid_type filter
|
||||
# @liquid_category array
|
||||
# @liquid_name join
|
||||
# @liquid_summary
|
||||
# Combines all the items in an array into a single string, separated by a space.
|
||||
# @liquid_syntax array | join
|
||||
@@ -352,7 +330,6 @@ module Liquid
|
||||
# @liquid_public_docs
|
||||
# @liquid_type filter
|
||||
# @liquid_category array
|
||||
# @liquid_name sort
|
||||
# @liquid_summary
|
||||
# Sorts the items in an array in case-sensitive alphabetical, or numerical, order.
|
||||
# @liquid_syntax array | sort
|
||||
@@ -378,10 +355,9 @@ module Liquid
|
||||
# @liquid_public_docs
|
||||
# @liquid_type filter
|
||||
# @liquid_category array
|
||||
# @liquid_name sort
|
||||
# @liquid_summary
|
||||
# Sorts the items in an array in case-insensitive alphabetical, or numerical, order.
|
||||
# @liquid_syntax array | sort
|
||||
# @liquid_syntax array | sort_natural
|
||||
# @liquid_return [array[untyped]]
|
||||
def sort_natural(input, property = nil)
|
||||
ary = InputIterator.new(input, context)
|
||||
@@ -404,7 +380,6 @@ module Liquid
|
||||
# @liquid_public_docs
|
||||
# @liquid_type filter
|
||||
# @liquid_category array
|
||||
# @liquid_name where
|
||||
# @liquid_summary
|
||||
# Filters an array to include only items with a specific property value.
|
||||
# @liquid_description
|
||||
@@ -443,7 +418,6 @@ module Liquid
|
||||
# @liquid_public_docs
|
||||
# @liquid_type filter
|
||||
# @liquid_category array
|
||||
# @liquid_name uniq
|
||||
# @liquid_summary
|
||||
# Removes any duplicate items in an array.
|
||||
# @liquid_syntax array | uniq
|
||||
@@ -470,7 +444,6 @@ module Liquid
|
||||
# @liquid_public_docs
|
||||
# @liquid_type filter
|
||||
# @liquid_category array
|
||||
# @liquid_name reverse
|
||||
# @liquid_summary
|
||||
# Reverses the order of the items in an array.
|
||||
# @liquid_syntax array | reverse
|
||||
@@ -483,7 +456,6 @@ module Liquid
|
||||
# @liquid_public_docs
|
||||
# @liquid_type filter
|
||||
# @liquid_category array
|
||||
# @liquid_name map
|
||||
# @liquid_summary
|
||||
# Creates an array of values from a specific property of the items in an array.
|
||||
# @liquid_syntax array | map: string
|
||||
@@ -506,7 +478,6 @@ module Liquid
|
||||
# @liquid_public_docs
|
||||
# @liquid_type filter
|
||||
# @liquid_category array
|
||||
# @liquid_name map
|
||||
# @liquid_summary
|
||||
# Removes any `nil` items from an array.
|
||||
# @liquid_syntax array | compact
|
||||
@@ -533,7 +504,6 @@ module Liquid
|
||||
# @liquid_public_docs
|
||||
# @liquid_type filter
|
||||
# @liquid_category string
|
||||
# @liquid_name replace
|
||||
# @liquid_summary
|
||||
# Replaces any instance of a substring inside a string with a given string.
|
||||
# @liquid_syntax string | replace: string, string
|
||||
@@ -545,7 +515,6 @@ module Liquid
|
||||
# @liquid_public_docs
|
||||
# @liquid_type filter
|
||||
# @liquid_category string
|
||||
# @liquid_name replace_first
|
||||
# @liquid_summary
|
||||
# Replaces the first instance of a substring inside a string with a given string.
|
||||
# @liquid_syntax string | replace_first: string, string
|
||||
@@ -557,7 +526,6 @@ module Liquid
|
||||
# @liquid_public_docs
|
||||
# @liquid_type filter
|
||||
# @liquid_category string
|
||||
# @liquid_name replace_last
|
||||
# @liquid_summary
|
||||
# Replaces the last instance of a substring inside a string with a given string.
|
||||
# @liquid_syntax string | replace_last: string, string
|
||||
@@ -579,7 +547,6 @@ module Liquid
|
||||
# @liquid_public_docs
|
||||
# @liquid_type filter
|
||||
# @liquid_category string
|
||||
# @liquid_name replace
|
||||
# @liquid_summary
|
||||
# Removes any instance of a substring inside a string.
|
||||
# @liquid_syntax string | remove: string
|
||||
@@ -591,7 +558,6 @@ module Liquid
|
||||
# @liquid_public_docs
|
||||
# @liquid_type filter
|
||||
# @liquid_category string
|
||||
# @liquid_name remove_first
|
||||
# @liquid_summary
|
||||
# Removes the first instance of a substring inside a string.
|
||||
# @liquid_syntax string | remove_first: string
|
||||
@@ -603,7 +569,6 @@ module Liquid
|
||||
# @liquid_public_docs
|
||||
# @liquid_type filter
|
||||
# @liquid_category string
|
||||
# @liquid_name remove_last
|
||||
# @liquid_summary
|
||||
# Removes the last instance of a substring inside a string.
|
||||
# @liquid_syntax string | remove_last: string
|
||||
@@ -615,7 +580,6 @@ module Liquid
|
||||
# @liquid_public_docs
|
||||
# @liquid_type filter
|
||||
# @liquid_category string
|
||||
# @liquid_name append
|
||||
# @liquid_summary
|
||||
# Adds a given string to the end of a string.
|
||||
# @liquid_syntax string | append: string
|
||||
@@ -627,7 +591,6 @@ module Liquid
|
||||
# @liquid_public_docs
|
||||
# @liquid_type filter
|
||||
# @liquid_category string
|
||||
# @liquid_name concat
|
||||
# @liquid_summary
|
||||
# Concatenates (combines) two arrays.
|
||||
# @liquid_description
|
||||
@@ -646,7 +609,6 @@ module Liquid
|
||||
# @liquid_public_docs
|
||||
# @liquid_type filter
|
||||
# @liquid_category string
|
||||
# @liquid_name prepend
|
||||
# @liquid_summary
|
||||
# Adds a given string to the beginning of a string.
|
||||
# @liquid_syntax string | prepend: string
|
||||
@@ -658,7 +620,6 @@ module Liquid
|
||||
# @liquid_public_docs
|
||||
# @liquid_type filter
|
||||
# @liquid_category string
|
||||
# @liquid_name newline_to_br
|
||||
# @liquid_summary
|
||||
# Converts newlines (`\n`) in a string to HTML line breaks (`<br>`).
|
||||
# @liquid_syntax string | newline_to_br
|
||||
@@ -709,7 +670,6 @@ module Liquid
|
||||
# @liquid_public_docs
|
||||
# @liquid_type filter
|
||||
# @liquid_category array
|
||||
# @liquid_name first
|
||||
# @liquid_summary
|
||||
# Returns the first item in the array.
|
||||
# @liquid_syntax string | first
|
||||
@@ -721,7 +681,6 @@ module Liquid
|
||||
# @liquid_public_docs
|
||||
# @liquid_type filter
|
||||
# @liquid_category array
|
||||
# @liquid_name last
|
||||
# @liquid_summary
|
||||
# Returns the last item in the array.
|
||||
# @liquid_syntax string | last
|
||||
@@ -733,7 +692,6 @@ module Liquid
|
||||
# @liquid_public_docs
|
||||
# @liquid_type filter
|
||||
# @liquid_category math
|
||||
# @liquid_name abs
|
||||
# @liquid_summary
|
||||
# Returns the absolute value of a number.
|
||||
# @liquid_syntax number | abs
|
||||
@@ -746,7 +704,6 @@ module Liquid
|
||||
# @liquid_public_docs
|
||||
# @liquid_type filter
|
||||
# @liquid_category math
|
||||
# @liquid_name plus
|
||||
# @liquid_summary
|
||||
# Adds two numbers.
|
||||
# @liquid_syntax number | plus: number
|
||||
@@ -758,7 +715,6 @@ module Liquid
|
||||
# @liquid_public_docs
|
||||
# @liquid_type filter
|
||||
# @liquid_category math
|
||||
# @liquid_name minus
|
||||
# @liquid_summary
|
||||
# Subtracts a given number from another number.
|
||||
# @liquid_syntax number | minus: number
|
||||
@@ -770,9 +726,8 @@ module Liquid
|
||||
# @liquid_public_docs
|
||||
# @liquid_type filter
|
||||
# @liquid_category math
|
||||
# @liquid_name times
|
||||
# @liquid_summary
|
||||
# Multiplies two numbers.
|
||||
# Multiplies a number by a given number.
|
||||
# @liquid_syntax number | times: number
|
||||
# @liquid_return [number]
|
||||
def times(input, operand)
|
||||
@@ -782,10 +737,9 @@ module Liquid
|
||||
# @liquid_public_docs
|
||||
# @liquid_type filter
|
||||
# @liquid_category math
|
||||
# @liquid_name minus
|
||||
# @liquid_summary
|
||||
# Divides a number by a given number.
|
||||
# @liquid_syntax number | minus: number
|
||||
# @liquid_syntax number | divided_by: number
|
||||
# @liquid_return [number]
|
||||
def divided_by(input, operand)
|
||||
apply_operation(input, operand, :/)
|
||||
@@ -796,7 +750,6 @@ module Liquid
|
||||
# @liquid_public_docs
|
||||
# @liquid_type filter
|
||||
# @liquid_category math
|
||||
# @liquid_name modulo
|
||||
# @liquid_summary
|
||||
# Returns the remainder of dividing a number by a given number.
|
||||
# @liquid_syntax number | modulo: number
|
||||
@@ -810,7 +763,6 @@ module Liquid
|
||||
# @liquid_public_docs
|
||||
# @liquid_type filter
|
||||
# @liquid_category math
|
||||
# @liquid_name round
|
||||
# @liquid_summary
|
||||
# Rounds a number to the nearest integer.
|
||||
# @liquid_syntax number | round
|
||||
@@ -827,7 +779,6 @@ module Liquid
|
||||
# @liquid_public_docs
|
||||
# @liquid_type filter
|
||||
# @liquid_category math
|
||||
# @liquid_name ceil
|
||||
# @liquid_summary
|
||||
# Rounds a number up to the nearest integer.
|
||||
# @liquid_syntax number | ceil
|
||||
@@ -841,7 +792,6 @@ module Liquid
|
||||
# @liquid_public_docs
|
||||
# @liquid_type filter
|
||||
# @liquid_category math
|
||||
# @liquid_name floor
|
||||
# @liquid_summary
|
||||
# Rounds a number down to the nearest integer.
|
||||
# @liquid_syntax number | floor
|
||||
@@ -855,7 +805,6 @@ module Liquid
|
||||
# @liquid_public_docs
|
||||
# @liquid_type filter
|
||||
# @liquid_category math
|
||||
# @liquid_name at_least
|
||||
# @liquid_summary
|
||||
# Limits a number to a minimum value.
|
||||
# @liquid_syntax number | at_least
|
||||
@@ -871,7 +820,6 @@ module Liquid
|
||||
# @liquid_public_docs
|
||||
# @liquid_type filter
|
||||
# @liquid_category math
|
||||
# @liquid_name at_most
|
||||
# @liquid_summary
|
||||
# Limits a number to a maximum value.
|
||||
# @liquid_syntax number | at_most
|
||||
@@ -887,7 +835,6 @@ module Liquid
|
||||
# @liquid_public_docs
|
||||
# @liquid_type filter
|
||||
# @liquid_category array
|
||||
# @liquid_name default
|
||||
# @liquid_summary
|
||||
# Sets a default value for any variable whose value is one of the following:
|
||||
#
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
module Liquid
|
||||
# @liquid_public_docs
|
||||
# @liquid_type object
|
||||
# @liquid_name forloop
|
||||
# @liquid_name tablerow
|
||||
# @liquid_summary
|
||||
# The `tablerow` object contains information about a parent [`tablerow` loop](/api/liquid/tags#tablerow).
|
||||
class TablerowloopDrop < Drop
|
||||
@@ -16,21 +16,18 @@ module Liquid
|
||||
end
|
||||
|
||||
# @liquid_public_docs
|
||||
# @liquid_name tablerow.length
|
||||
# @liquid_summary
|
||||
# The number of iterations.
|
||||
# @liquid_return [number]
|
||||
attr_reader :length
|
||||
|
||||
# @liquid_public_docs
|
||||
# @liquid_name tablerow.col
|
||||
# @liquid_summary
|
||||
# The 1-based index of the current column.
|
||||
# @liquid_return [number]
|
||||
attr_reader :col
|
||||
|
||||
# @liquid_public_docs
|
||||
# @liquid_name tablerow.row
|
||||
# @liquid_summary
|
||||
# The 1-based index of current row.
|
||||
# @liquid_return [number]
|
||||
|
||||
@@ -1,6 +1,15 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Liquid
|
||||
# Break tag to be used to break out of a for loop.
|
||||
#
|
||||
# == Basic Usage:
|
||||
# {% for item in collection %}
|
||||
# {% if item.condition %}
|
||||
# {% break %}
|
||||
# {% endif %}
|
||||
# {% endfor %}
|
||||
#
|
||||
# @liquid_public_docs
|
||||
# @liquid_type tag
|
||||
# @liquid_category iteration
|
||||
|
||||
+10
-7
@@ -9,16 +9,19 @@ module Liquid
|
||||
# Renders a specific expression depending on the value of a specific variable.
|
||||
# @liquid_syntax
|
||||
# {% case variable %}
|
||||
# {% when value %}
|
||||
# expression
|
||||
# {% when value %}
|
||||
# expression
|
||||
# {% when first_value %}
|
||||
# first_expression
|
||||
# {% when second_value %}
|
||||
# second_expression
|
||||
# {% else %}
|
||||
# expression
|
||||
# third_expression
|
||||
# {% endcase %}
|
||||
# @liquid_syntax_keyword variable The name of the variable you want to base your case statement on.
|
||||
# @liquid_syntax_keyword value A specific value to check for.
|
||||
# @liquid_syntax_keyword expression An expression to be rendered when the variable's value matches the value being checked.
|
||||
# @liquid_syntax_keyword first_value A specific value to check for.
|
||||
# @liquid_syntax_keyword second_value A specific value to check for.
|
||||
# @liquid_syntax_keyword first_expression An expression to be rendered when the variable's value matches `first_value`.
|
||||
# @liquid_syntax_keyword second_expression An expression to be rendered when the variable's value matches `second_value`.
|
||||
# @liquid_syntax_keyword third_expression An expression to be rendered when the variable's value has no match.
|
||||
class Case < Block
|
||||
Syntax = /(#{QuotedFragment})/o
|
||||
WhenSyntax = /(#{QuotedFragment})(?:(?:\s+or\s+|\s*\,\s*)(#{QuotedFragment}.*))?/om
|
||||
|
||||
@@ -8,8 +8,7 @@ module Liquid
|
||||
# @liquid_summary
|
||||
# Loops through a group of strings and outputs them one at a time for each iteration of a [`for` loop](/api/liquid/tags#for).
|
||||
# @liquid_description
|
||||
# > Note:
|
||||
# > The `cycle` tag must be used inside a `for` loop.
|
||||
# The `cycle` tag must be used inside a `for` loop.
|
||||
# @liquid_syntax
|
||||
# {% cycle string, string, ... %}
|
||||
class Cycle < Tag
|
||||
|
||||
@@ -7,14 +7,14 @@ module Liquid
|
||||
# @liquid_name decrement
|
||||
# @liquid_summary
|
||||
# Creates a new variable, with a default value of -1, that's decreased by 1 with each subsequent call.
|
||||
# @liquid_desription
|
||||
# Variables that are declared with `decrement` are unique to the file ([layout](/themes/architecture/layouts), [section](/themes/architecture/sections),
|
||||
# or [template](/themes/architecture/templates)) that they're created in. However, these variables are shared across
|
||||
# [snippets](/themes/architecture#snippets) inside each of those files.
|
||||
# @liquid_description
|
||||
# Variables that are declared with `decrement` are unique to the [layout](/themes/architecture/layouts), [template](/themes/architecture/templates),
|
||||
# or [section](/themes/architecture/sections) file that they're created in. However, the variable is shared across
|
||||
# [snippets](/themes/architecture#snippets) included in the file.
|
||||
#
|
||||
# Similarly, variables that are created with `decrement` are are unique to those created with [`assign`](/api/liquid/tags#assign)
|
||||
# and [`capture`](/api/liquid/tags#capture). However, these variables are shared with variables created with
|
||||
# [`increment`](/api/liquid/tags#increment).
|
||||
# Similarly, variables that are created with `decrement` are independent from those created with [`assign`](/api/liquid/tags#assign)
|
||||
# and [`capture`](/api/liquid/tags#capture). However, `decrement` and [`increment`](/api/liquid/tags#increment) share
|
||||
# variables.
|
||||
# @liquid_syntax
|
||||
# {% decrement variable_name %}
|
||||
# @liquid_syntax_keyword variable_name The name of the variable being decremented.
|
||||
|
||||
@@ -7,14 +7,16 @@ module Liquid
|
||||
# @liquid_name echo
|
||||
# @liquid_summary
|
||||
# Outputs an expression.
|
||||
# @liquid_desription
|
||||
# Using the `echo` tag is the same as wrapping an expression in `{{` and `}}`, however you can use it inside
|
||||
# [`liquid` tags](/api/liquid/tags#liquid).
|
||||
# @liquid_description
|
||||
# Using the `echo` tag is the same as wrapping an expression in curly brackets (`{{` and `}}`). However, unlike the curly
|
||||
# bracket method, you can use the `echo` tag inside [`liquid` tags](/api/liquid/tags#liquid).
|
||||
#
|
||||
# > Note:
|
||||
# > Tip:
|
||||
# > You can use [filters](/api/liquid/filters) on expressions inside `echo` tags.
|
||||
# @liquid_syntax
|
||||
# {% echo expression %}
|
||||
# {% liquid
|
||||
# echo expression
|
||||
# %}
|
||||
# @liquid_syntax_keyword expression The expression to be output.
|
||||
class Echo < Tag
|
||||
attr_reader :variable
|
||||
|
||||
@@ -7,12 +7,12 @@ module Liquid
|
||||
# @liquid_name for
|
||||
# @liquid_summary
|
||||
# Renders an expression for every item in an array.
|
||||
# @liquid_desription
|
||||
# > Tip:
|
||||
# > Every `for` loop has an associated [`forloop` object](/api/liquid/objects#forloop) with information about the loop.
|
||||
#
|
||||
# @liquid_description
|
||||
# You can do a maximum of 50 iterations with a `for` loop. If you need to iterate over more than 50 items, then use the
|
||||
# [`paginate` tag](/api/liquid/tags#paginate) to split the items over multiple pages.
|
||||
#
|
||||
# > Tip:
|
||||
# > Every `for` loop has an associated [`forloop` object](/api/liquid/objects#forloop) with information about the loop.
|
||||
# @liquid_syntax
|
||||
# {% for variable in array %}
|
||||
# expression
|
||||
|
||||
@@ -7,17 +7,17 @@ module Liquid
|
||||
# @liquid_name increment
|
||||
# @liquid_summary
|
||||
# Creates a new variable, with a default value of 0, that's increased by 1 with each subsequent call.
|
||||
# @liquid_desription
|
||||
# Variables that are declared with `increment` are unique to the file ([layout](/themes/architecture/layouts), [section](/themes/architecture/sections),
|
||||
# or [template](/themes/architecture/templates)) that they're created in. However, these variables are shared across
|
||||
# [snippets](/themes/architecture#snippets) inside each of those files.
|
||||
# @liquid_description
|
||||
# Variables that are declared with `increment` are unique to the [layout](/themes/architecture/layouts), [template](/themes/architecture/templates),
|
||||
# or [section](/themes/architecture/sections) file that they're created in. However, the variable is shared across
|
||||
# [snippets](/themes/architecture#snippets) included in the file.
|
||||
#
|
||||
# Similarly, variables that are created with `increment` are are unique to those created with [`assign`](/api/liquid/tags#assign)
|
||||
# and [`capture`](/api/liquid/tags#capture). However, these variables are shared with variables created with
|
||||
# [`decrement`](/api/liquid/tags#decrement).
|
||||
# Similarly, variables that are created with `increment` are independent from those created with [`assign`](/api/liquid/tags#assign)
|
||||
# and [`capture`](/api/liquid/tags#capture). However, `increment` and [`decrement`](/api/liquid/tags#decrement) share
|
||||
# variables.
|
||||
# @liquid_syntax
|
||||
# {% increment variable_name %}
|
||||
# @liquid_syntax_keyword variable_name The name of the variable being decremented.
|
||||
# @liquid_syntax_keyword variable_name The name of the variable being incremented.
|
||||
class Increment < Tag
|
||||
def initialize(tag_name, markup, options)
|
||||
super
|
||||
|
||||
+10
-10
@@ -6,21 +6,21 @@ module Liquid
|
||||
# @liquid_category theme
|
||||
# @liquid_name include
|
||||
# @liquid_summary
|
||||
# Renders a [snippet](/themes/architecture#snippets).
|
||||
# Renders a [snippet](/themes/architecture#snippets) or [app block](/themes/architecture/sections/section-schema#render-app-blocks).
|
||||
# @liquid_description
|
||||
# > Tip:
|
||||
# > The `render` tag is also used to [render app blocks](/themes/architecture/sections/section-schema#render-app-blocks).
|
||||
# Inside snippets and app blocks, you can't directly access variables that are [created](/api/liquid/tags#variable-tags) outside
|
||||
# of the snippet or app block. However, you can [specify variables as parameters](/api/liquid/tags#render-passing-variables-to-snippets)
|
||||
# to pass outside variables to snippets.
|
||||
#
|
||||
# Inside the snippet, there's no direct access to variables that are [created](/api/liquid/tags#variable-tags) outside
|
||||
# of the snippet. If you want to pass in outside variables, then you can [specify variables as parameters](/api/liquid/tags#render-passing-variables-to-snippets).
|
||||
# While you can't directly access created variables, you can access global objects, as well as any objects that are
|
||||
# directly accessible outside the snippet or app block. For example, a snippet or app block inside the [product template](/themes/architecture/templates/product)
|
||||
# can access the [`product` object](/api/liquid/objects#product), and a snippet or app block inside a [section](/themes/architecture/sections)
|
||||
# can access the [`section` object](/api/liquid/objects#section).
|
||||
#
|
||||
# While there's no direct access to created variables, there's access to global objects, as well as any objects that are
|
||||
# directly accessible outside the snippet.
|
||||
#
|
||||
# Outside the snippet, you can't access variables created inside the snippet.
|
||||
# Outside a snippet or app block, you can't access variables created inside the snippet or app block.
|
||||
#
|
||||
# > Note:
|
||||
# > When a snippet is rendered using the `render` tag, you can't use the [`include` tag](/api/liquid/tags#include)
|
||||
# > When you render a snippet using the `render` tag, you can't use the [`include` tag](/api/liquid/tags#include)
|
||||
# > inside the snippet.
|
||||
# @liquid_syntax
|
||||
# {% render 'filename' %}
|
||||
|
||||
@@ -7,7 +7,7 @@ module Liquid
|
||||
# @liquid_name tablerow
|
||||
# @liquid_summary
|
||||
# Generates HTML table rows for every item in an array.
|
||||
# @liquid_desription
|
||||
# @liquid_description
|
||||
# The `tablerow` tag must be wrapped in HTML `<table>` and `</table>` tags.
|
||||
#
|
||||
# > Tip:
|
||||
|
||||
Reference in New Issue
Block a user