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 +4 -4
- data/lib/bridgetown-core/concerns/site/processable.rb +0 -4
- data/lib/bridgetown-core/converters/erb_templates.rb +6 -1
- data/lib/bridgetown-core/converters/liquid_templates.rb +10 -2
- data/lib/bridgetown-core/readers/layout_reader.rb +1 -1
- data/lib/bridgetown-core/renderer.rb +6 -8
- data/lib/bridgetown-core/ruby_template_view.rb +2 -2
- data/lib/bridgetown-core/tags/render_content.rb +2 -2
- data/lib/bridgetown-core/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3016411256a8728e60755c9309a5b7ccd47a12a06e6c0e8a712d41052e0136eb
|
4
|
+
data.tar.gz: 3c29c8e06af9898d864f2b4157d25335e2225aca6539034b8fb013970414045b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
-
|
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)
|
@@ -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
|
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] =
|
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/
|
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/
|
40
|
+
# rubocop:enable Metrics/MethodLength
|
41
41
|
|
42
42
|
private
|
43
43
|
|
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.
|
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-
|
11
|
+
date: 2020-11-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|