Skip to content

Commit

Permalink
Merge pull request jekyll#4933 from pathawks/liquid
Browse files Browse the repository at this point in the history
Merge pull request 4933
  • Loading branch information
jekyllbot committed May 26, 2016
2 parents 753ff92 + 40ec84c commit 40c6702
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 16 deletions.
2 changes: 0 additions & 2 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@ AllCops:
- lib/jekyll/drops/site_drop.rb
- lib/jekyll/filters.rb
- lib/jekyll/frontmatter_defaults.rb
- lib/jekyll/liquid_renderer/table.rb
- lib/jekyll/liquid_renderer.rb
- lib/jekyll/reader.rb
- lib/jekyll/readers/layout_reader.rb
- lib/jekyll/readers/page_reader.rb
Expand Down
9 changes: 6 additions & 3 deletions lib/jekyll/liquid_renderer.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
require 'jekyll/liquid_renderer/file'
require 'jekyll/liquid_renderer/table'
require "jekyll/liquid_renderer/file"
require "jekyll/liquid_renderer/table"

module Jekyll
class LiquidRenderer
Expand All @@ -13,7 +13,10 @@ def reset
end

def file(filename)
filename = @site.in_source_dir(filename).sub(/\A#{Regexp.escape(@site.source)}\//, '')
filename = @site.in_source_dir(filename).sub(
%r!\A#{Regexp.escape(@site.source)}/!,
""
)

LiquidRenderer::File.new(self, filename).tap do
@stats[filename] ||= {}
Expand Down
22 changes: 11 additions & 11 deletions lib/jekyll/liquid_renderer/table.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,25 +31,25 @@ def generate_table_head_border(row_data, widths)
str = ""

row_data.each_index do |cell_index|
str << '-' * widths[cell_index]
str << '-+-' unless cell_index == row_data.length-1
str << "-" * widths[cell_index]
str << "-+-" unless cell_index == row_data.length-1
end

str << "\n"
str
end

def generate_row(row_data, widths)
str = ''
str = ""

row_data.each_with_index do |cell_data, cell_index|
if cell_index == 0
str << cell_data.ljust(widths[cell_index], ' ')
else
str << cell_data.rjust(widths[cell_index], ' ')
end
str << if cell_index == 0
cell_data.ljust(widths[cell_index], " ")
else
cell_data.rjust(widths[cell_index], " ")
end

str << ' | ' unless cell_index == row_data.length-1
str << " | " unless cell_index == row_data.length-1
end

str << "\n"
Expand Down Expand Up @@ -79,7 +79,7 @@ def data_for_table(n)
row << filename
row << file_stats[:count].to_s
row << format_bytes(file_stats[:bytes])
row << "%.3f" % file_stats[:time]
row << format("%.3f", file_stats[:time])
table << row
end

Expand All @@ -88,7 +88,7 @@ def data_for_table(n)

def format_bytes(bytes)
bytes /= 1024.0
"%.2fK" % bytes
format("%.2fK", bytes)
end
end
end

0 comments on commit 40c6702

Please sign in to comment.