mirror of
https://github.com/Shopify/liquid.git
synced 2026-09-19 19:00:39 -07:00
Update lib/liquid/standardfilters.rb
Co-authored-by: Dylan Thacker-Smith <[email protected]>
This commit is contained in:
co-authored by
Dylan Thacker-Smith
parent
8bf0e7dfae
commit
94df9a8f52
@@ -91,12 +91,11 @@ module Liquid
|
|||||||
return if input.nil?
|
return if input.nil?
|
||||||
words = Utils.to_integer(words)
|
words = Utils.to_integer(words)
|
||||||
|
|
||||||
l = words
|
words = 1 if words <= 0
|
||||||
l = 1 if l <= 0
|
|
||||||
|
|
||||||
# Scan for non-space characters followed by one or more space characters
|
# Scan for non-space characters followed by one or more space characters
|
||||||
# `l` times. Also ignore leading whitespace
|
# `words` times. Also ignore leading whitespace
|
||||||
str = input[/\A[ ]*(?:[^ ]*[ ]+){#{l}}/]
|
str = input[/\A[ ]*(?:[^ ]*[ ]+){#{words}}/]
|
||||||
|
|
||||||
if str
|
if str
|
||||||
str.strip! # Remove trailing space
|
str.strip! # Remove trailing space
|
||||||
|
|||||||
Reference in New Issue
Block a user