Revert "Fix spacing"

This reverts commit 26eb27f79f.
This commit is contained in:
Mike Angell
2019-09-20 02:42:21 +10:00
parent 26eb27f79f
commit 00c8ca559a
78 changed files with 500 additions and 508 deletions
+2 -2
View File
@@ -4,10 +4,10 @@ require 'benchmark/ips'
require_relative 'theme_runner'
Liquid::Template.error_mode = ARGV.first.to_sym if ARGV.first
profiler = ThemeRunner.new
profiler = ThemeRunner.new
Benchmark.ips do |x|
x.time = 10
x.time = 10
x.warmup = 5
puts
+1 -1
View File
@@ -4,7 +4,7 @@ require 'stackprof'
require_relative 'theme_runner'
Liquid::Template.error_mode = ARGV.first.to_sym if ARGV.first
profiler = ThemeRunner.new
profiler = ThemeRunner.new
profiler.run
[:cpu, :object].each do |profile_type|
+1 -1
View File
@@ -8,7 +8,7 @@ class CommentForm < Liquid::Block
if markup =~ SYNTAX
@variable_name = Regexp.last_match(1)
@attributes = {}
@attributes = {}
else
raise SyntaxError, "Syntax Error in 'comment_form' - Valid syntax: comment_form [article]"
end
+1 -1
View File
@@ -11,7 +11,7 @@ module Database
# From vision source
db['products'].each do |product|
collections = db['collections'].find_all do |collection|
collections = db['collections'].find_all do |collection|
collection['products'].any? { |p| p['id'].to_i == product['id'].to_i }
end
product['collections'] = collections
+1 -1
View File
@@ -8,7 +8,7 @@ class Paginate < Liquid::Block
if markup =~ SYNTAX
@collection_name = Regexp.last_match(1)
@page_size = if Regexp.last_match(2)
@page_size = if Regexp.last_match(2)
Regexp.last_match(3).to_i
else
20
+7 -7
View File
@@ -58,9 +58,9 @@ class ThemeRunner
# `render` is called to benchmark just the render portion of liquid
def render
@compiled_tests.each do |test|
tmpl = test[:tmpl]
tmpl = test[:tmpl]
assigns = test[:assigns]
layout = test[:layout]
layout = test[:layout]
if layout
assigns['content_for_layout'] = tmpl.render!(assigns)
@@ -74,7 +74,7 @@ class ThemeRunner
private
def compile_and_render(template, layout, assigns, page_template, template_file)
compiled_test = compile_test(template, layout, assigns, page_template, template_file)
compiled_test = compile_test(template, layout, assigns, page_template, template_file)
assigns['content_for_layout'] = compiled_test[:tmpl].render!(assigns)
compiled_test[:layout].render!(assigns) if layout
end
@@ -88,7 +88,7 @@ class ThemeRunner
end
def compile_test(template, layout, assigns, page_template, template_file)
tmpl = init_template(page_template, template_file)
tmpl = init_template(page_template, template_file)
parsed_template = tmpl.parse(template).dup
if layout
@@ -113,9 +113,9 @@ class ThemeRunner
# set up a new Liquid::Template object for use in `compile_and_render` and `compile_test`
def init_template(page_template, template_file)
tmpl = Liquid::Template.new
tmpl.assigns['page_title'] = 'Page title'
tmpl.assigns['template'] = page_template
tmpl = Liquid::Template.new
tmpl.assigns['page_title'] = 'Page title'
tmpl.assigns['template'] = page_template
tmpl.registers[:file_system] = ThemeRunner::FileSystem.new(File.dirname(template_file))
tmpl
end