mirror of
https://github.com/Shopify/liquid.git
synced 2026-09-15 08:50:45 -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?
|
||||
words = Utils.to_integer(words)
|
||||
|
||||
l = words
|
||||
l = 1 if l <= 0
|
||||
words = 1 if words <= 0
|
||||
|
||||
# Scan for non-space characters followed by one or more space characters
|
||||
# `l` times. Also ignore leading whitespace
|
||||
str = input[/\A[ ]*(?:[^ ]*[ ]+){#{l}}/]
|
||||
# `words` times. Also ignore leading whitespace
|
||||
str = input[/\A[ ]*(?:[^ ]*[ ]+){#{words}}/]
|
||||
|
||||
if str
|
||||
str.strip! # Remove trailing space
|
||||
|
||||
Reference in New Issue
Block a user