bridgetown-core 0.18.1 → 0.18.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1d25b97e8914ef6cab51dcd4de4c2f17f8ba44fa27acf05ed87ef205785a440f
4
- data.tar.gz: 556ab43a620ac12adf2d9e68abf42cb0a0143abc513dc2f579b8ee030103cf9b
3
+ metadata.gz: fad1c759bc15d188091ea79b5da7beee2b1b2f41c0bdac3d6196b4066a376379
4
+ data.tar.gz: 9dc54e1b1f2563bfeaf3e9cbb51cc0ca48bbf2f713aa030d027a34d3c7388b0f
5
5
  SHA512:
6
- metadata.gz: cc580ed174c76f365c6b15fff1dbf7927c1b94735833496f5397dff564688e5c132f120320158fc201cbc9b2f8fb25724b428cc99ed7021d9c1a478d860cecb9
7
- data.tar.gz: 50ba14145c5e255e3a0c10c22ea067fe655fd97b47596359a13762fc33dd323c7183015b1908106a21a7387064f181bba3f880f1520ea33104c2baa153d96b53
6
+ metadata.gz: 3c7ff76d444621a53ec11a7cb47df4a84012aea31318b821ab2446add1eb187ce306c0623fa55cb8c790a35817da0e73c4eb69cd8caed979c3acbcdb295ce866
7
+ data.tar.gz: 89708630ae7ced2085ba9577cd23d2d434230d79410eaeabc396483b86c041bbac78bec7fdb0ffb6ff45ff886e69dd4a9ca13d0719c04be96397288498b0d5e0
@@ -44,6 +44,14 @@ require "i18n"
44
44
  require "faraday"
45
45
  require "thor"
46
46
 
47
+ module HashWithDotAccess
48
+ class Hash # :nodoc:
49
+ def to_liquid
50
+ to_h.to_liquid
51
+ end
52
+ end
53
+ end
54
+
47
55
  SafeYAML::OPTIONS[:suppress_warnings] = true
48
56
 
49
57
  # Create our little String subclass for Ruby Front Matter
@@ -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)
@@ -127,7 +127,7 @@ module Bridgetown
127
127
  def obfuscate_link(input, prefix = "mailto")
128
128
  link = "<a href=\"#{prefix}:#{input}\">#{input}</a>"
129
129
  script = "<script type=\"text/javascript\">document.currentScript.insertAdjacentHTML("
130
- script += "beforebegin', '#{rot47(link)}'.replace(/[!-~]/g,"
130
+ script += "beforebegin', '#{rot47(link).gsub(%r!\\!, '\\\\\\')}'.replace(/[!-~]/g,"
131
131
  script += "function(c){{var j=c.charCodeAt(0);if((j>=33)&&(j<=126)){"
132
132
  script += "return String.fromCharCode(33+((j+ 14)%94));}"
133
133
  script += "else{return String.fromCharCode(j);}}}));</script>"
@@ -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)
@@ -20,14 +20,14 @@ module Bridgetown
20
20
  v.each do |nested_k, nested_v|
21
21
  next unless nested_v.is_a?(Rb)
22
22
 
23
- Bridgetown.logger.warn("Executing inline Ruby…", convertible.relative_path)
23
+ Bridgetown.logger.debug("Executing inline Ruby…", convertible.relative_path)
24
24
  convertible.data[k][nested_k] = run(nested_v, convertible, renderer)
25
- Bridgetown.logger.warn("Inline Ruby completed!", convertible.relative_path)
25
+ Bridgetown.logger.debug("Inline Ruby completed!", convertible.relative_path)
26
26
  end
27
27
  else
28
- Bridgetown.logger.warn("Executing inline Ruby…", convertible.relative_path)
28
+ Bridgetown.logger.debug("Executing inline Ruby…", convertible.relative_path)
29
29
  convertible.data[k] = run(v, convertible, renderer)
30
- Bridgetown.logger.warn("Inline Ruby completed!", convertible.relative_path)
30
+ Bridgetown.logger.debug("Inline Ruby completed!", convertible.relative_path)
31
31
  end
32
32
  end
33
33
  end
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Bridgetown
4
- VERSION = "0.18.1"
4
+ VERSION = "0.18.6"
5
5
  CODE_NAME = "Taylor Street"
6
6
  end
@@ -5,9 +5,10 @@
5
5
  "scripts": {
6
6
  "build": "bundle exec bridgetown build",
7
7
  "serve": "bundle exec bridgetown serve",
8
+ "clean": "bundle exec bridgetown clean",
8
9
  "webpack-build": "webpack --mode production",
9
10
  "webpack-dev": "webpack --mode development -w",
10
- "deploy": "yarn webpack-build && yarn build",
11
+ "deploy": "yarn clean && yarn webpack-build && yarn build",
11
12
  "sync": "node sync.js",
12
13
  "start": "node start.js"
13
14
  },
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.1
4
+ version: 0.18.6
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-30 00:00:00.000000000 Z
11
+ date: 2020-11-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport