bridgetown-core 0.18.0 → 0.18.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c36f73b0c33a2bf052be5e78359a241dce3034f144f9ff12bdd37515ba008f5a
4
- data.tar.gz: fb6296ecf818c0fe40244359672babde4f4353549b4972ca5c112ff8ed8579bf
3
+ metadata.gz: 3016411256a8728e60755c9309a5b7ccd47a12a06e6c0e8a712d41052e0136eb
4
+ data.tar.gz: 3c29c8e06af9898d864f2b4157d25335e2225aca6539034b8fb013970414045b
5
5
  SHA512:
6
- metadata.gz: 52c7d713936d04fbcd76e0605d0eaf022800c3ca0ce3e5424630ff12486fa0cfdf786c693099211e2e2a5b2fe483a8eb1ab80a96eef92552397eaef348579ee8
7
- data.tar.gz: 76d621f1fc7779830b15768ae21c37e95c5baf0a0949deb59d5d6677a35d68519d12a1bb05299c292420ca1062d73267acb944e77d88ae45b1a57499361c90b2
6
+ metadata.gz: a0b79bd8f47b5c27d4332c2bb523b79680fe2fba04082c329e83e7d13a9f5749b004195f65098d92e9b85f5834749011d63ec346e2f564a08bb26d03d4bfc1f3
7
+ data.tar.gz: db88b4119f7679277736d40f1b43f015c501e0b3729c043de1fc2f707904ac917dc1231d9124ee46b96f25226dec7589441d75cab2e5563977eb55bed0549b76
@@ -20,8 +20,6 @@ class Bridgetown::Site
20
20
  print_stats if config["profile"]
21
21
  end
22
22
 
23
- # rubocop:disable Metrics/AbcSize
24
-
25
23
  # Reset all in-memory data and content.
26
24
  # @return [void]
27
25
  def reset
@@ -49,8 +47,6 @@ class Bridgetown::Site
49
47
  Bridgetown::Hooks.trigger :site, :after_reset, self
50
48
  end
51
49
 
52
- # rubocop:enable Metrics/AbcSize
53
-
54
50
  # Read data from disk and load it into internal memory.
55
51
  # @return [void]
56
52
  def read
@@ -101,6 +101,8 @@ module Bridgetown
101
101
  #
102
102
  # @return [String] The converted content.
103
103
  def convert(content, convertible)
104
+ return content if convertible.data[:template_engine] != "erb"
105
+
104
106
  erb_view = Bridgetown::ERBView.new(convertible)
105
107
 
106
108
  erb_renderer = Tilt::ErubiTemplate.new(
@@ -123,10 +125,13 @@ module Bridgetown
123
125
  if convertible.data[:template_engine] == "erb" ||
124
126
  (convertible.data[:template_engine].nil? &&
125
127
  @config[:template_engine] == "erb")
128
+ convertible.data[:template_engine] = "erb"
126
129
  return true
127
130
  end
128
131
 
129
- super(ext)
132
+ super(ext).tap do |ext_matches|
133
+ convertible.data[:template_engine] = "erb" if ext_matches
134
+ end
130
135
  end
131
136
 
132
137
  def output_ext(ext)
@@ -23,7 +23,10 @@ module Bridgetown
23
23
  #
24
24
  # @return [String] The converted content.
25
25
  def convert(content, convertible)
26
+ return content if convertible.data[:template_engine] != "liquid"
27
+
26
28
  self.class.cached_partials ||= {}
29
+ @payload = nil
27
30
 
28
31
  @site = convertible.site
29
32
  if convertible.is_a?(Bridgetown::Layout)
@@ -53,9 +56,14 @@ module Bridgetown
53
56
  # rubocop: enable Metrics/AbcSize
54
57
 
55
58
  def matches(ext, convertible)
56
- return true if convertible.render_with_liquid?
59
+ if convertible.render_with_liquid?
60
+ convertible.data[:template_engine] = "liquid"
61
+ return true
62
+ end
57
63
 
58
- super(ext)
64
+ super(ext).tap do |ext_matches|
65
+ convertible.data[:template_engine] = "liquid" if ext_matches
66
+ end
59
67
  end
60
68
 
61
69
  def output_ext(ext)
@@ -6,7 +6,7 @@ module Bridgetown
6
6
 
7
7
  def initialize(site)
8
8
  @site = site
9
- @layouts = {}
9
+ @layouts = HashWithDotAccess::Hash.new
10
10
  end
11
11
 
12
12
  def read
@@ -79,8 +79,7 @@ module Bridgetown
79
79
  rescue StandardError => e
80
80
  Bridgetown.logger.error "Conversion error:",
81
81
  "#{converter.class} encountered an error while "\
82
- "converting '#{document.relative_path}':"
83
- Bridgetown.logger.error("", e.to_s)
82
+ "converting `#{document.relative_path}'"
84
83
  raise e
85
84
  end
86
85
  end
@@ -145,13 +144,12 @@ module Bridgetown
145
144
  layout.current_document = document
146
145
  layout.current_document_output = output
147
146
  converter.convert layout_output, layout
147
+ rescue StandardError => e
148
+ Bridgetown.logger.error "Conversion error:",
149
+ "#{converter.class} encountered an error while "\
150
+ "converting `#{document.relative_path}'"
151
+ raise e
148
152
  end
149
- rescue StandardError => e
150
- Bridgetown.logger.error "Conversion error:",
151
- "#{converter.class} encountered an error while "\
152
- "converting '#{document.relative_path}':"
153
- Bridgetown.logger.error("", e.to_s)
154
- raise e
155
153
  end
156
154
 
157
155
  def add_regenerator_dependencies(layout)
@@ -38,8 +38,8 @@ module Bridgetown
38
38
  site.site_payload.site
39
39
  end
40
40
 
41
- def liquid_render(component, options = {})
42
- options[:_block_content] = yield if block_given?
41
+ def liquid_render(component, options = {}, &block)
42
+ options[:_block_content] = capture(&block) if block && respond_to?(:capture)
43
43
  render_statement = _render_statement(component, options)
44
44
 
45
45
  template = site.liquid_renderer.file(
@@ -3,7 +3,7 @@
3
3
  module Bridgetown
4
4
  module Tags
5
5
  class BlockRenderTag < Liquid::Block
6
- # rubocop:disable Metrics/AbcSize, Metrics/MethodLength
6
+ # rubocop:disable Metrics/MethodLength
7
7
  def render(context)
8
8
  context.stack({}) do
9
9
  # unindent the incoming text
@@ -37,7 +37,7 @@ module Bridgetown
37
37
  .render_tag(context, +"")
38
38
  end
39
39
  end
40
- # rubocop:enable Metrics/AbcSize, Metrics/MethodLength
40
+ # rubocop:enable Metrics/MethodLength
41
41
 
42
42
  private
43
43
 
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Bridgetown
4
- VERSION = "0.18.0"
4
+ VERSION = "0.18.5"
5
5
  CODE_NAME = "Taylor Street"
6
6
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bridgetown-core
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.18.0
4
+ version: 0.18.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bridgetown Team
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-10-29 00:00:00.000000000 Z
11
+ date: 2020-11-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport