mirror of
https://github.com/kemko/liquid.git
synced 2026-01-01 15:55:40 +03:00
Add ForceEqualSignAlignment to .rubocop.yml (#1190)
* Add ForceEqualSignAlignment to .rubocop.yml * Revert ForceEqualSignAlignment cop * Update method alignment * Undo addition of whitespace to improve readability * Fix missing alignment
This commit is contained in:
committed by
Mike Angell
parent
3784020a8d
commit
e83b1e4159
@@ -892,7 +892,7 @@ Lint/FormatParameterMismatch:
|
||||
Enabled: true
|
||||
|
||||
Lint/HandleExceptions:
|
||||
Enabled: true
|
||||
AllowComments: true
|
||||
|
||||
Lint/ImplicitStringConcatenation:
|
||||
Description: Checks for adjacent string literals on the same line, which could
|
||||
|
||||
@@ -38,6 +38,7 @@ module Liquid
|
||||
@left = left
|
||||
@operator = operator
|
||||
@right = right
|
||||
|
||||
@child_relation = nil
|
||||
@child_condition = nil
|
||||
end
|
||||
|
||||
@@ -7,8 +7,10 @@ module Liquid
|
||||
|
||||
def initialize(options = {})
|
||||
@template_options = options ? options.dup : {}
|
||||
|
||||
@locale = @template_options[:locale] ||= I18n.new
|
||||
@warnings = []
|
||||
|
||||
self.depth = 0
|
||||
self.partial = false
|
||||
end
|
||||
@@ -20,6 +22,7 @@ module Liquid
|
||||
def partial=(value)
|
||||
@partial = value
|
||||
@options = value ? partial_options : @template_options
|
||||
|
||||
@error_mode = @options[:error_mode] || Template.error_mode
|
||||
end
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@ module Liquid
|
||||
|
||||
file_system = (context.registers[:file_system] ||= Liquid::Template.file_system)
|
||||
source = file_system.read_template_file(template_name)
|
||||
|
||||
parse_context.partial = true
|
||||
|
||||
partial = Liquid::Template.parse(source, parse_context)
|
||||
|
||||
@@ -78,9 +78,12 @@ module Liquid
|
||||
return if input.nil?
|
||||
input_str = input.to_s
|
||||
length = Utils.to_integer(length)
|
||||
|
||||
truncate_string_str = truncate_string.to_s
|
||||
|
||||
l = length - truncate_string_str.length
|
||||
l = 0 if l < 0
|
||||
|
||||
input_str.length > length ? input_str[0...l].concat(truncate_string_str) : input_str
|
||||
end
|
||||
|
||||
@@ -88,8 +91,10 @@ module Liquid
|
||||
return if input.nil?
|
||||
wordlist = input.to_s.split
|
||||
words = Utils.to_integer(words)
|
||||
|
||||
l = words - 1
|
||||
l = 0 if l < 0
|
||||
|
||||
wordlist.length > l ? wordlist[0..l].join(" ").concat(truncate_string.to_s) : input
|
||||
end
|
||||
|
||||
|
||||
@@ -51,8 +51,8 @@ module Liquid
|
||||
|
||||
iteration += 1
|
||||
iteration = 0 if iteration >= @variables.size
|
||||
context.registers[:cycle][key] = iteration
|
||||
|
||||
context.registers[:cycle][key] = iteration
|
||||
output
|
||||
end
|
||||
|
||||
|
||||
@@ -105,9 +105,11 @@ module Liquid
|
||||
p = Parser.new(markup)
|
||||
@variable_name = p.consume(:id)
|
||||
raise SyntaxError, options[:locale].t("errors.syntax.for_invalid_in") unless p.id?('in')
|
||||
|
||||
collection_name = p.expression
|
||||
@name = "#{@variable_name}-#{collection_name}"
|
||||
@collection_name = Expression.parse(collection_name)
|
||||
|
||||
@name = "#{@variable_name}-#{collection_name}"
|
||||
@reversed = p.id?('reversed')
|
||||
|
||||
while p.look(:id) && p.look(:colon, 1)
|
||||
|
||||
@@ -48,6 +48,7 @@ module Liquid
|
||||
inner_context.template_name = template_name
|
||||
inner_context.partial = true
|
||||
inner_context['forloop'] = forloop if forloop
|
||||
|
||||
@attributes.each do |key, value|
|
||||
inner_context[key] = context.evaluate(value)
|
||||
end
|
||||
|
||||
@@ -27,7 +27,6 @@ module Liquid
|
||||
to = @attributes.key?('limit') ? from + context.evaluate(@attributes['limit']).to_i : nil
|
||||
|
||||
collection = Utils.slice_collection(collection, from, to)
|
||||
|
||||
length = collection.length
|
||||
|
||||
cols = context.evaluate(@attributes['cols']).to_i
|
||||
|
||||
@@ -252,6 +252,7 @@ class ErrorHandlingTest < Minitest::Test
|
||||
|
||||
begin
|
||||
Liquid::Template.file_system = TestFileSystem.new
|
||||
|
||||
template = Liquid::Template.parse("Argument error:\n{% include 'product' %}", line_numbers: true)
|
||||
page = template.render('errors' => ErrorDrop.new)
|
||||
ensure
|
||||
|
||||
Reference in New Issue
Block a user